Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manipulating collections sends out all collections #20

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Shared/Dtos/FromClient/Identity/RegisterUserDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace Shared.Dtos.FromClient.Identity;

public class RegisterUserDto
{
[EmailAddress] public string Email { get; set; }
[MaxLength(50)] public string Username { get; set; }
[MinLength(8)] [MaxLength(256)] public string Password { get; set; }
[EmailAddress] public required string Email { get; set; }
[MaxLength(50)] public required string Username { get; set; }
[MinLength(8)] [MaxLength(256)] public required string Password { get; set; }
public string? Base64Image { get; set; }
public string? BlobUrl { get; set; }
}
2 changes: 1 addition & 1 deletion api/Events/Auth/Client/ClientWantsToSignUp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace api.Events.Auth.Client;

public class ClientWantsToSignUpDto : BaseDto
{
public RegisterUserDto RegisterUserDto { get; set; }
public required RegisterUserDto RegisterUserDto { get; set; }
}

[ValidateDataAnnotations]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ public class ClientWantsToCreateCollection(CollectionsService collectionsService
public override async Task Handle(ClientWantsToCreateCollectionDto dto, IWebSocketConnection socket)
{
var email = jwtService.GetEmailFromJwt(dto.Jwt!);
var collection = await collectionsService.CreateCollection(dto.CreateCollectionDto, email);
socket.SendDto(new ServerSavesCollection
await collectionsService.CreateCollection(dto.CreateCollectionDto, email);
var allCollections = await collectionsService.GetCollectionsForUser(email);
socket.SendDto(new ServerSendsAllCollections()
{
Collection = collection
Collections = allCollections.ToList()
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public override async Task Handle(ClientWantsToDeleteCollectionDto dto, IWebSock
{
var email = jwtService.GetEmailFromJwt(dto.Jwt!);
await collectionsService.DeleteCollection(dto.CollectionId, email);
socket.SendDto(new ServerDeletesCollection());

var allCollections = await collectionsService.GetCollectionsForUser(email);
socket.SendDto(new ServerSendsAllCollections()
{
Collections = allCollections.ToList()
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ public override async Task Handle(ClientWantsToUpdateCollectionDto dto, IWebSock
{
var email = jwtService.GetEmailFromJwt(dto.Jwt!);
var collection = await collectionsService.UpdateCollection(dto.UpdateCollectionDto, email);
socket.SendDto(new ServerSavesCollection
var allCollections = await collectionsService.GetCollectionsForUser(email);
socket.SendDto(new ServerSendsAllCollections()
{
Collection = collection
Collections = allCollections.ToList()
});
}
}
5 changes: 1 addition & 4 deletions api/Events/Global/ServerConfirmsDelete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

namespace api.Events.Global;

public class ServerConfirmsDelete: BaseDto
{

}
public class ServerConfirmsDelete: BaseDto;
5 changes: 2 additions & 3 deletions api/Events/PlantEvents/Client/ClientWantsToDeletePlant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ public class ClientWantsToDeletePlant(PlantService plantService, JwtService jwtS
{
public override async Task Handle(ClientWantsToDeletePlantDto dto, IWebSocketConnection socket)
{
var email = jwtService.GetEmailFromJwt(dto.Jwt);
var email = jwtService.GetEmailFromJwt(dto.Jwt!);
await plantService.DeletePlant(dto.PlantId, email);
var serverConfirmsDelete = new ServerConfirmsDelete();
socket.SendDto(serverConfirmsDelete);
socket.SendDto( new ServerConfirmsDelete());
}
}

Loading