-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into jwt-claims
# Conflicts: # api/Events/Auth/Client/ClientWantsToLogIn.cs
- Loading branch information
Showing
11 changed files
with
143 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Shared.Dtos.FromClient; | ||
|
||
public class UpdateUserDto | ||
{ | ||
[EmailAddress] public string UserEmail { get; set; } = null!; | ||
[MaxLength(50)] public string? Username { get; set; } | ||
[MinLength(8)] [MaxLength(256)] public string? Password { get; set; } | ||
public string? Base64Image { get; set; } | ||
public string? BlobUrl { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using lib; | ||
|
||
namespace Shared.Dtos; | ||
|
||
public class GetUserDto : BaseDto | ||
{ | ||
public string UserEmail { get; set; } = null!; | ||
public string Username { get; set; } = null!; | ||
public string? BlobUrl { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
using lib; | ||
using Shared.Dtos; | ||
|
||
namespace api.Events.Auth.Server; | ||
|
||
public class ServerAuthenticatesUser : BaseDto | ||
{ | ||
public string? Jwt { get; set; } | ||
public GetUserDto GetUserDto { get; set; } = null!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using api.EventFilters; | ||
using api.Extensions; | ||
using Core.Services; | ||
using Fleck; | ||
using lib; | ||
using Shared.Dtos; | ||
using Shared.Dtos.FromClient; | ||
using Shared.Exceptions; | ||
using Shared.Models; | ||
|
||
namespace api.Events.User; | ||
|
||
public class ClientWantsToUpdateUserDto : BaseDtoWithJwt | ||
{ | ||
public UpdateUserDto UpdateUserDto { get; set; } = null!; | ||
} | ||
|
||
[ValidateDataAnnotations] | ||
public class ClientWantsToUpdateProfile (UserService userService) : BaseEventHandler<ClientWantsToUpdateUserDto> | ||
{ | ||
public override async Task Handle(ClientWantsToUpdateUserDto dto, IWebSocketConnection socket) | ||
{ | ||
var getUserDto = await userService.UpdateUser(dto.UpdateUserDto); | ||
if (getUserDto == null) | ||
{ | ||
throw new AppException("Failed to update user."); | ||
} | ||
socket.SendDto(new ServerConfirmsUpdate | ||
{ | ||
GetUserDto = getUserDto | ||
}); | ||
} | ||
} | ||
|
||
public class ServerConfirmsUpdate : BaseDto | ||
{ | ||
public GetUserDto? GetUserDto { get; set; } = null!; | ||
} |