From 2c3b84a2334b1d9d48b73cd30e97c32cfc4e9a53 Mon Sep 17 00:00:00 2001 From: XShine555 Date: Sat, 21 Mar 2026 20:33:15 +0100 Subject: [PATCH] Move --- .../Infrastructure/IKeycloakUserService.cs | 2 +- .../{CreatePlayList => }/CreatePlayListCommand.cs | 4 ++-- .../{DeletePlayList => }/DeletePlayListCommand.cs | 2 +- .../{UpdatePlayList => }/UpdatePlayListCommand.cs | 4 ++-- .../CreatePlayListCommandHandler.cs | 5 +++-- .../DeletePlayListCommandHandler.cs | 3 ++- .../GetPlayListByIdQueryHandler.cs | 5 +++-- .../GetPlayListsByUserIdQueryHandler.cs | 5 +++-- .../GetPlayListsQueryHandler.cs | 5 +++-- .../UpdatePlayListCommandHandler.cs | 5 +++-- .../{GetPlayListById => }/GetPlayListByIdQuery.cs | 4 ++-- .../GetPlayListsByUserIdQuery.cs | 4 ++-- .../{GetPlayLists => }/GetPlayListsQuery.cs | 4 ++-- .../{Contracts => Responses}/PlayListResponse.cs | 2 +- .../{CreateTrack => }/CreateTrackCommand.cs | 4 ++-- .../CreateTrackCommandHandler.cs | 5 +++-- .../GetTrackByIdQueryHandler.cs | 5 +++-- .../GetTracksByUserIdQueryHandler.cs | 5 +++-- .../GetTracks => Handler}/GetTracksQueryHandler.cs | 5 +++-- .../{GetTrackById => }/GetTrackByIdQuery.cs | 4 ++-- .../GetTracksByUserIdQuery.cs | 4 ++-- .../Queries/{GetTracks => }/GetTracksQuery.cs | 4 ++-- .../{Contracts => Responses}/TrackResponse.cs | 2 +- .../Commands/{CreateUser => }/CreateUserCommand.cs | 4 ++-- .../Commands/{DeleteUser => }/DeleteUserCommand.cs | 2 +- .../Users/Contracts/PaginatedUserResponse.cs | 12 ------------ .../CreateUserCommandHandler.cs | 5 +++-- .../DeleteUserCommandHandler.cs | 2 +- .../GetUserByIdQueryHandler.cs | 7 ++++--- .../GetUserByKeycloakQueryHandler.cs | 7 ++++--- .../GetUsers => Handlers}/GetUsersQueryHandler.cs | 14 ++++++++------ .../Queries/{GetUserById => }/GetUserByIdQuery.cs | 4 ++-- .../GetUserByKeycloakQuery.cs | 4 ++-- .../Users/Queries/GetUsers/GetUsersQuery.cs | 9 --------- Application/Users/Queries/GetUsersQuery.cs | 10 ++++++++++ .../KeycloakUserResponse.cs | 2 +- .../Users/{Contracts => Responses}/UserResponse.cs | 2 +- Infrastructure/Identity/KeycloakUserMapper.cs | 2 +- Infrastructure/Identity/KeycloakUserService.cs | 2 +- 39 files changed, 92 insertions(+), 88 deletions(-) rename Application/PlayLists/Commands/{CreatePlayList => }/CreatePlayListCommand.cs (75%) rename Application/PlayLists/Commands/{DeletePlayList => }/DeletePlayListCommand.cs (75%) rename Application/PlayLists/Commands/{UpdatePlayList => }/UpdatePlayListCommand.cs (76%) rename Application/PlayLists/{Commands/CreatePlayList => Handlers}/CreatePlayListCommandHandler.cs (97%) rename Application/PlayLists/{Commands/DeletePlayList => Handlers}/DeletePlayListCommandHandler.cs (97%) rename Application/PlayLists/{Queries/GetPlayListById => Handlers}/GetPlayListByIdQueryHandler.cs (85%) rename Application/PlayLists/{Queries/GetPlayListsByUserId => Handlers}/GetPlayListsByUserIdQueryHandler.cs (93%) rename Application/PlayLists/{Queries/GetPlayLists => Handlers}/GetPlayListsQueryHandler.cs (91%) rename Application/PlayLists/{Commands/UpdatePlayList => Handlers}/UpdatePlayListCommandHandler.cs (98%) rename Application/PlayLists/Queries/{GetPlayListById => }/GetPlayListByIdQuery.cs (63%) rename Application/PlayLists/Queries/{GetPlayListsByUserId => }/GetPlayListsByUserIdQuery.cs (75%) rename Application/PlayLists/Queries/{GetPlayLists => }/GetPlayListsQuery.cs (72%) rename Application/PlayLists/{Contracts => Responses}/PlayListResponse.cs (93%) rename Application/Tracks/Commands/{CreateTrack => }/CreateTrackCommand.cs (75%) rename Application/Tracks/{Commands/CreateTrack => Handler}/CreateTrackCommandHandler.cs (96%) rename Application/Tracks/{Queries/GetTrackById => Handler}/GetTrackByIdQueryHandler.cs (82%) rename Application/Tracks/{Queries/GetTracksByUserId => Handler}/GetTracksByUserIdQueryHandler.cs (93%) rename Application/Tracks/{Queries/GetTracks => Handler}/GetTracksQueryHandler.cs (92%) rename Application/Tracks/Queries/{GetTrackById => }/GetTrackByIdQuery.cs (64%) rename Application/Tracks/Queries/{GetTracksByUserId => }/GetTracksByUserIdQuery.cs (76%) rename Application/Tracks/Queries/{GetTracks => }/GetTracksQuery.cs (73%) rename Application/Tracks/{Contracts => Responses}/TrackResponse.cs (90%) rename Application/Users/Commands/{CreateUser => }/CreateUserCommand.cs (64%) rename Application/Users/Commands/{DeleteUser => }/DeleteUserCommand.cs (74%) delete mode 100644 Application/Users/Contracts/PaginatedUserResponse.cs rename Application/Users/{Commands/CreateUser => Handlers}/CreateUserCommandHandler.cs (94%) rename Application/Users/{Commands/DeleteUser => Handlers}/DeleteUserCommandHandler.cs (92%) rename Application/Users/{Queries/GetUserById => Handlers}/GetUserByIdQueryHandler.cs (90%) rename Application/Users/{Queries/GetUserByKeycloakId => Handlers}/GetUserByKeycloakQueryHandler.cs (89%) rename Application/Users/{Queries/GetUsers => Handlers}/GetUsersQueryHandler.cs (81%) rename Application/Users/Queries/{GetUserById => }/GetUserByIdQuery.cs (64%) rename Application/Users/Queries/{GetUserByKeycloakId => }/GetUserByKeycloakQuery.cs (63%) delete mode 100644 Application/Users/Queries/GetUsers/GetUsersQuery.cs create mode 100644 Application/Users/Queries/GetUsersQuery.cs rename Application/Users/{Contracts => Responses}/KeycloakUserResponse.cs (73%) rename Application/Users/{Contracts => Responses}/UserResponse.cs (79%) diff --git a/Application/Contracts/Infrastructure/IKeycloakUserService.cs b/Application/Contracts/Infrastructure/IKeycloakUserService.cs index 055f7f4..f78c4a3 100644 --- a/Application/Contracts/Infrastructure/IKeycloakUserService.cs +++ b/Application/Contracts/Infrastructure/IKeycloakUserService.cs @@ -1,5 +1,5 @@ using Ardalis.Result; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Responses; namespace Musify.Application.Contracts.Infrastructure { diff --git a/Application/PlayLists/Commands/CreatePlayList/CreatePlayListCommand.cs b/Application/PlayLists/Commands/CreatePlayListCommand.cs similarity index 75% rename from Application/PlayLists/Commands/CreatePlayList/CreatePlayListCommand.cs rename to Application/PlayLists/Commands/CreatePlayListCommand.cs index b59d8ec..0ceddcc 100644 --- a/Application/PlayLists/Commands/CreatePlayList/CreatePlayListCommand.cs +++ b/Application/PlayLists/Commands/CreatePlayListCommand.cs @@ -1,9 +1,9 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Application; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; -namespace Musify.Application.PlayLists.Commands.CreatePlayList +namespace Musify.Application.PlayLists.Commands { public record CreatePlayListCommand( Guid UserId, diff --git a/Application/PlayLists/Commands/DeletePlayList/DeletePlayListCommand.cs b/Application/PlayLists/Commands/DeletePlayListCommand.cs similarity index 75% rename from Application/PlayLists/Commands/DeletePlayList/DeletePlayListCommand.cs rename to Application/PlayLists/Commands/DeletePlayListCommand.cs index 4057db9..d4fd556 100644 --- a/Application/PlayLists/Commands/DeletePlayList/DeletePlayListCommand.cs +++ b/Application/PlayLists/Commands/DeletePlayListCommand.cs @@ -1,7 +1,7 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; -namespace Musify.Application.PlayLists.Commands.DeletePlayList +namespace Musify.Application.PlayLists.Commands { public record DeletePlayListCommand(Guid UserId, Guid PlayListId) : IRequest >; diff --git a/Application/PlayLists/Commands/UpdatePlayList/UpdatePlayListCommand.cs b/Application/PlayLists/Commands/UpdatePlayListCommand.cs similarity index 76% rename from Application/PlayLists/Commands/UpdatePlayList/UpdatePlayListCommand.cs rename to Application/PlayLists/Commands/UpdatePlayListCommand.cs index 1ef0e49..32442ef 100644 --- a/Application/PlayLists/Commands/UpdatePlayList/UpdatePlayListCommand.cs +++ b/Application/PlayLists/Commands/UpdatePlayListCommand.cs @@ -1,9 +1,9 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Application; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; -namespace Musify.Application.PlayLists.Commands.UpdatePlayList +namespace Musify.Application.PlayLists.Commands { public record UpdatePlayListCommand( Guid UserId, diff --git a/Application/PlayLists/Commands/CreatePlayList/CreatePlayListCommandHandler.cs b/Application/PlayLists/Handlers/CreatePlayListCommandHandler.cs similarity index 97% rename from Application/PlayLists/Commands/CreatePlayList/CreatePlayListCommandHandler.cs rename to Application/PlayLists/Handlers/CreatePlayListCommandHandler.cs index 3d4a6f2..c26a888 100644 --- a/Application/PlayLists/Commands/CreatePlayList/CreatePlayListCommandHandler.cs +++ b/Application/PlayLists/Handlers/CreatePlayListCommandHandler.cs @@ -5,10 +5,11 @@ using Microsoft.Extensions.Logging; using Musify.Application.Configuration; using Musify.Application.Contracts.Infrastructure; using Musify.Application.Events; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Commands; +using Musify.Application.PlayLists.Responses; using Musify.Domain.Entities; -namespace Musify.Application.PlayLists.Commands.CreatePlayList +namespace Musify.Application.PlayLists.Handlers { public class CreatePlayListCommandHandler(IEventBus eventBus, IDatabase database, IStorageHandler storageHandler, IPictureHandler pictureHandler, ILogger logger, ApplicationStorageConfiguration storageConfiguration, PlayListConfiguration playListConfiguration) diff --git a/Application/PlayLists/Commands/DeletePlayList/DeletePlayListCommandHandler.cs b/Application/PlayLists/Handlers/DeletePlayListCommandHandler.cs similarity index 97% rename from Application/PlayLists/Commands/DeletePlayList/DeletePlayListCommandHandler.cs rename to Application/PlayLists/Handlers/DeletePlayListCommandHandler.cs index fc03dd8..10c1a3c 100644 --- a/Application/PlayLists/Commands/DeletePlayList/DeletePlayListCommandHandler.cs +++ b/Application/PlayLists/Handlers/DeletePlayListCommandHandler.cs @@ -4,8 +4,9 @@ using Microsoft.Extensions.Logging; using Musify.Application.Configuration; using Musify.Application.Contracts.Infrastructure; using Musify.Application.Events; +using Musify.Application.PlayLists.Commands; -namespace Musify.Application.PlayLists.Commands.DeletePlayList +namespace Musify.Application.PlayLists.Handlers { public class DeletePlayListCommandHandler(IDatabase database, IEventBus eventBus, ApplicationStorageConfiguration storageConfiguration, PlayListConfiguration playListConfiguration, ILogger logger) diff --git a/Application/PlayLists/Queries/GetPlayListById/GetPlayListByIdQueryHandler.cs b/Application/PlayLists/Handlers/GetPlayListByIdQueryHandler.cs similarity index 85% rename from Application/PlayLists/Queries/GetPlayListById/GetPlayListByIdQueryHandler.cs rename to Application/PlayLists/Handlers/GetPlayListByIdQueryHandler.cs index f2313f4..55301ab 100644 --- a/Application/PlayLists/Queries/GetPlayListById/GetPlayListByIdQueryHandler.cs +++ b/Application/PlayLists/Handlers/GetPlayListByIdQueryHandler.cs @@ -2,9 +2,10 @@ using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; +using Musify.Application.PlayLists.Queries; -namespace Musify.Application.PlayLists.Queries.GetPlayListById +namespace Musify.Application.PlayLists.Handlers { public class GetPlayListByIdQueryHandler(IDatabase database) : IRequestHandler> > diff --git a/Application/PlayLists/Queries/GetPlayListsByUserId/GetPlayListsByUserIdQueryHandler.cs b/Application/PlayLists/Handlers/GetPlayListsByUserIdQueryHandler.cs similarity index 93% rename from Application/PlayLists/Queries/GetPlayListsByUserId/GetPlayListsByUserIdQueryHandler.cs rename to Application/PlayLists/Handlers/GetPlayListsByUserIdQueryHandler.cs index a54bf3d..18c1fda 100644 --- a/Application/PlayLists/Queries/GetPlayListsByUserId/GetPlayListsByUserIdQueryHandler.cs +++ b/Application/PlayLists/Handlers/GetPlayListsByUserIdQueryHandler.cs @@ -3,10 +3,11 @@ using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Musify.Application.Contracts.Application; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; +using Musify.Application.PlayLists.Queries; using X.PagedList.EF; -namespace Musify.Application.PlayLists.Queries.GetPlayListsByUserId +namespace Musify.Application.PlayLists.Handlers { public class GetPlayListsByUserIdQueryHandler(IDatabase database) : IRequestHandler > >> diff --git a/Application/PlayLists/Queries/GetPlayLists/GetPlayListsQueryHandler.cs b/Application/PlayLists/Handlers/GetPlayListsQueryHandler.cs similarity index 91% rename from Application/PlayLists/Queries/GetPlayLists/GetPlayListsQueryHandler.cs rename to Application/PlayLists/Handlers/GetPlayListsQueryHandler.cs index 8a5835b..8cb758e 100644 --- a/Application/PlayLists/Queries/GetPlayLists/GetPlayListsQueryHandler.cs +++ b/Application/PlayLists/Handlers/GetPlayListsQueryHandler.cs @@ -3,10 +3,11 @@ using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Musify.Application.Contracts.Application; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; +using Musify.Application.PlayLists.Queries; using X.PagedList.EF; -namespace Musify.Application.PlayLists.Queries.GetPlayLists +namespace Musify.Application.PlayLists.Handlers { public class GetPlayListsQueryHandler(IDatabase database) : IRequestHandler >> > diff --git a/Application/PlayLists/Commands/UpdatePlayList/UpdatePlayListCommandHandler.cs b/Application/PlayLists/Handlers/UpdatePlayListCommandHandler.cs similarity index 98% rename from Application/PlayLists/Commands/UpdatePlayList/UpdatePlayListCommandHandler.cs rename to Application/PlayLists/Handlers/UpdatePlayListCommandHandler.cs index e58e352..ffd1a0d 100644 --- a/Application/PlayLists/Commands/UpdatePlayList/UpdatePlayListCommandHandler.cs +++ b/Application/PlayLists/Handlers/UpdatePlayListCommandHandler.cs @@ -5,9 +5,10 @@ using Microsoft.Extensions.Logging; using Musify.Application.Configuration; using Musify.Application.Contracts.Infrastructure; using Musify.Application.Events; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Commands; +using Musify.Application.PlayLists.Responses; -namespace Musify.Application.PlayLists.Commands.UpdatePlayList +namespace Musify.Application.PlayLists.Handlers { public class UpdatePlayListCommandHandler(IEventBus eventBus, IDatabase database, IStorageHandler storageHandler, ILogger logger, ApplicationStorageConfiguration storageConfiguration, diff --git a/Application/PlayLists/Queries/GetPlayListById/GetPlayListByIdQuery.cs b/Application/PlayLists/Queries/GetPlayListByIdQuery.cs similarity index 63% rename from Application/PlayLists/Queries/GetPlayListById/GetPlayListByIdQuery.cs rename to Application/PlayLists/Queries/GetPlayListByIdQuery.cs index 031af87..4bf4360 100644 --- a/Application/PlayLists/Queries/GetPlayListById/GetPlayListByIdQuery.cs +++ b/Application/PlayLists/Queries/GetPlayListByIdQuery.cs @@ -1,8 +1,8 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; -namespace Musify.Application.PlayLists.Queries.GetPlayListById +namespace Musify.Application.PlayLists.Queries { public record GetPlayListByIdQuery(Guid Id) : IRequest>>; diff --git a/Application/PlayLists/Queries/GetPlayListsByUserId/GetPlayListsByUserIdQuery.cs b/Application/PlayLists/Queries/GetPlayListsByUserIdQuery.cs similarity index 75% rename from Application/PlayLists/Queries/GetPlayListsByUserId/GetPlayListsByUserIdQuery.cs rename to Application/PlayLists/Queries/GetPlayListsByUserIdQuery.cs index b90358a..5610553 100644 --- a/Application/PlayLists/Queries/GetPlayListsByUserId/GetPlayListsByUserIdQuery.cs +++ b/Application/PlayLists/Queries/GetPlayListsByUserIdQuery.cs @@ -1,9 +1,9 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Application; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; -namespace Musify.Application.PlayLists.Queries.GetPlayListsByUserId +namespace Musify.Application.PlayLists.Queries { public record GetPlayListsByUserIdQuery( Guid UserId, diff --git a/Application/PlayLists/Queries/GetPlayLists/GetPlayListsQuery.cs b/Application/PlayLists/Queries/GetPlayListsQuery.cs similarity index 72% rename from Application/PlayLists/Queries/GetPlayLists/GetPlayListsQuery.cs rename to Application/PlayLists/Queries/GetPlayListsQuery.cs index e5de1e1..9764acd 100644 --- a/Application/PlayLists/Queries/GetPlayLists/GetPlayListsQuery.cs +++ b/Application/PlayLists/Queries/GetPlayListsQuery.cs @@ -1,9 +1,9 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Application; -using Musify.Application.PlayLists.Contracts; +using Musify.Application.PlayLists.Responses; -namespace Musify.Application.PlayLists.Queries.GetPlayLists +namespace Musify.Application.PlayLists.Queries { public record GetPlayListsQuery(int PageNumber = 1, int PageSize = 10) : IRequest> >>; diff --git a/Application/PlayLists/Contracts/PlayListResponse.cs b/Application/PlayLists/Responses/PlayListResponse.cs similarity index 93% rename from Application/PlayLists/Contracts/PlayListResponse.cs rename to Application/PlayLists/Responses/PlayListResponse.cs index 8ec1f54..d2888fc 100644 --- a/Application/PlayLists/Contracts/PlayListResponse.cs +++ b/Application/PlayLists/Responses/PlayListResponse.cs @@ -1,6 +1,6 @@ using Musify.Domain.Entities; -namespace Musify.Application.PlayLists.Contracts +namespace Musify.Application.PlayLists.Responses { public record PlayListResponse( Guid Id, diff --git a/Application/Tracks/Commands/CreateTrack/CreateTrackCommand.cs b/Application/Tracks/Commands/CreateTrackCommand.cs similarity index 75% rename from Application/Tracks/Commands/CreateTrack/CreateTrackCommand.cs rename to Application/Tracks/Commands/CreateTrackCommand.cs index c10007c..2a6c939 100644 --- a/Application/Tracks/Commands/CreateTrack/CreateTrackCommand.cs +++ b/Application/Tracks/Commands/CreateTrackCommand.cs @@ -1,9 +1,9 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Application; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Responses; -namespace Musify.Application.Tracks.Commands.CreateTrack +namespace Musify.Application.Tracks.Commands { public record CreateTrackCommand( Guid UserId, diff --git a/Application/Tracks/Commands/CreateTrack/CreateTrackCommandHandler.cs b/Application/Tracks/Handler/CreateTrackCommandHandler.cs similarity index 96% rename from Application/Tracks/Commands/CreateTrack/CreateTrackCommandHandler.cs rename to Application/Tracks/Handler/CreateTrackCommandHandler.cs index 2b0a745..9ab3158 100644 --- a/Application/Tracks/Commands/CreateTrack/CreateTrackCommandHandler.cs +++ b/Application/Tracks/Handler/CreateTrackCommandHandler.cs @@ -4,10 +4,11 @@ using Microsoft.Extensions.Logging; using Musify.Application.Configuration; using Musify.Application.Contracts.Infrastructure; using Musify.Application.Events; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Commands; +using Musify.Application.Tracks.Responses; using Musify.Domain.Entities; -namespace Musify.Application.Tracks.Commands.CreateTrack +namespace Musify.Application.Tracks.Handler { public class CreateTrackCommandHandler(IDatabase database, IPictureHandler pictureHandler, IEventBus eventBus, IStorageHandler storageHandler, ILogger logger, ApplicationStorageConfiguration storageConfiguration, TrackConfiguration trackConfiguration) diff --git a/Application/Tracks/Queries/GetTrackById/GetTrackByIdQueryHandler.cs b/Application/Tracks/Handler/GetTrackByIdQueryHandler.cs similarity index 82% rename from Application/Tracks/Queries/GetTrackById/GetTrackByIdQueryHandler.cs rename to Application/Tracks/Handler/GetTrackByIdQueryHandler.cs index 151ac1f..c0d4b2e 100644 --- a/Application/Tracks/Queries/GetTrackById/GetTrackByIdQueryHandler.cs +++ b/Application/Tracks/Handler/GetTrackByIdQueryHandler.cs @@ -1,9 +1,10 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Queries; +using Musify.Application.Tracks.Responses; -namespace Musify.Application.Tracks.Queries.GetTrackById +namespace Musify.Application.Tracks.Handler { public class GetTrackByIdQueryHandler(IDatabase database) : IRequestHandler >> diff --git a/Application/Tracks/Queries/GetTracksByUserId/GetTracksByUserIdQueryHandler.cs b/Application/Tracks/Handler/GetTracksByUserIdQueryHandler.cs similarity index 93% rename from Application/Tracks/Queries/GetTracksByUserId/GetTracksByUserIdQueryHandler.cs rename to Application/Tracks/Handler/GetTracksByUserIdQueryHandler.cs index b4c5285..4dd81b8 100644 --- a/Application/Tracks/Queries/GetTracksByUserId/GetTracksByUserIdQueryHandler.cs +++ b/Application/Tracks/Handler/GetTracksByUserIdQueryHandler.cs @@ -3,10 +3,11 @@ using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Musify.Application.Contracts.Application; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Queries; +using Musify.Application.Tracks.Responses; using X.PagedList.EF; -namespace Musify.Application.Tracks.Queries.GetTracksByUserId +namespace Musify.Application.Tracks.Handler { public class GetTracksByUserIdQueryHandler(IDatabase database) : IRequestHandler> >> diff --git a/Application/Tracks/Queries/GetTracks/GetTracksQueryHandler.cs b/Application/Tracks/Handler/GetTracksQueryHandler.cs similarity index 92% rename from Application/Tracks/Queries/GetTracks/GetTracksQueryHandler.cs rename to Application/Tracks/Handler/GetTracksQueryHandler.cs index e0bd672..59e43e3 100644 --- a/Application/Tracks/Queries/GetTracks/GetTracksQueryHandler.cs +++ b/Application/Tracks/Handler/GetTracksQueryHandler.cs @@ -3,10 +3,11 @@ using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Musify.Application.Contracts.Application; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Queries; +using Musify.Application.Tracks.Responses; using X.PagedList.EF; -namespace Musify.Application.Tracks.Queries.GetTracks +namespace Musify.Application.Tracks.Handler { public class GetTracksQueryHandler(IDatabase database) : IRequestHandler> > > diff --git a/Application/Tracks/Queries/GetTrackById/GetTrackByIdQuery.cs b/Application/Tracks/Queries/GetTrackByIdQuery.cs similarity index 64% rename from Application/Tracks/Queries/GetTrackById/GetTrackByIdQuery.cs rename to Application/Tracks/Queries/GetTrackByIdQuery.cs index 9a3f9c4..1008b99 100644 --- a/Application/Tracks/Queries/GetTrackById/GetTrackByIdQuery.cs +++ b/Application/Tracks/Queries/GetTrackByIdQuery.cs @@ -1,8 +1,8 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Responses; -namespace Musify.Application.Tracks.Queries.GetTrackById +namespace Musify.Application.Tracks.Queries { public record GetTrackByIdQuery(Guid TrackId) : IRequest >>; diff --git a/Application/Tracks/Queries/GetTracksByUserId/GetTracksByUserIdQuery.cs b/Application/Tracks/Queries/GetTracksByUserIdQuery.cs similarity index 76% rename from Application/Tracks/Queries/GetTracksByUserId/GetTracksByUserIdQuery.cs rename to Application/Tracks/Queries/GetTracksByUserIdQuery.cs index 7968dff..25afa9f 100644 --- a/Application/Tracks/Queries/GetTracksByUserId/GetTracksByUserIdQuery.cs +++ b/Application/Tracks/Queries/GetTracksByUserIdQuery.cs @@ -1,9 +1,9 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Application; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Responses; -namespace Musify.Application.Tracks.Queries.GetTracksByUserId +namespace Musify.Application.Tracks.Queries { public record GetTracksByUserIdQuery( Guid UserId, diff --git a/Application/Tracks/Queries/GetTracks/GetTracksQuery.cs b/Application/Tracks/Queries/GetTracksQuery.cs similarity index 73% rename from Application/Tracks/Queries/GetTracks/GetTracksQuery.cs rename to Application/Tracks/Queries/GetTracksQuery.cs index 37a81cb..3a10860 100644 --- a/Application/Tracks/Queries/GetTracks/GetTracksQuery.cs +++ b/Application/Tracks/Queries/GetTracksQuery.cs @@ -1,9 +1,9 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Application; -using Musify.Application.Tracks.Contracts; +using Musify.Application.Tracks.Responses; -namespace Musify.Application.Tracks.Queries.GetTracks +namespace Musify.Application.Tracks.Queries { public record GetTracksQuery(int PageNumber = 1, int PageSize = 10) : IRequest >> >; diff --git a/Application/Tracks/Contracts/TrackResponse.cs b/Application/Tracks/Responses/TrackResponse.cs similarity index 90% rename from Application/Tracks/Contracts/TrackResponse.cs rename to Application/Tracks/Responses/TrackResponse.cs index 8a0a67e..78143dd 100644 --- a/Application/Tracks/Contracts/TrackResponse.cs +++ b/Application/Tracks/Responses/TrackResponse.cs @@ -1,6 +1,6 @@ using Musify.Domain.Entities; -namespace Musify.Application.Tracks.Contracts +namespace Musify.Application.Tracks.Responses { public record TrackResponse( Guid Id, diff --git a/Application/Users/Commands/CreateUser/CreateUserCommand.cs b/Application/Users/Commands/CreateUserCommand.cs similarity index 64% rename from Application/Users/Commands/CreateUser/CreateUserCommand.cs rename to Application/Users/Commands/CreateUserCommand.cs index ebb068b..afa6f51 100644 --- a/Application/Users/Commands/CreateUser/CreateUserCommand.cs +++ b/Application/Users/Commands/CreateUserCommand.cs @@ -1,8 +1,8 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Responses; -namespace Musify.Application.Users.Commands.CreateUser +namespace Musify.Application.Users.Commands { public record CreateUserCommand(Guid Id) : IRequest>>; diff --git a/Application/Users/Commands/DeleteUser/DeleteUserCommand.cs b/Application/Users/Commands/DeleteUserCommand.cs similarity index 74% rename from Application/Users/Commands/DeleteUser/DeleteUserCommand.cs rename to Application/Users/Commands/DeleteUserCommand.cs index 720fc53..2773d0a 100644 --- a/Application/Users/Commands/DeleteUser/DeleteUserCommand.cs +++ b/Application/Users/Commands/DeleteUserCommand.cs @@ -1,7 +1,7 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; -namespace Musify.Application.Users.Commands.DeleteUser +namespace Musify.Application.Users.Commands { public record DeleteUserCommand(Guid Id) : IRequest>; diff --git a/Application/Users/Contracts/PaginatedUserResponse.cs b/Application/Users/Contracts/PaginatedUserResponse.cs deleted file mode 100644 index 042dd32..0000000 --- a/Application/Users/Contracts/PaginatedUserResponse.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Musify.Application.Users.Contracts -{ - public record PaginatedUserResponse( - IReadOnlyCollection Users, - int PageNumber, - int PageSize, - int PageCount, - int TotalItemCount, - bool HasNextPage, - bool HasPreviousPage - ); -} \ No newline at end of file diff --git a/Application/Users/Commands/CreateUser/CreateUserCommandHandler.cs b/Application/Users/Handlers/CreateUserCommandHandler.cs similarity index 94% rename from Application/Users/Commands/CreateUser/CreateUserCommandHandler.cs rename to Application/Users/Handlers/CreateUserCommandHandler.cs index add9aef..64ab778 100644 --- a/Application/Users/Commands/CreateUser/CreateUserCommandHandler.cs +++ b/Application/Users/Handlers/CreateUserCommandHandler.cs @@ -3,10 +3,11 @@ using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Commands; +using Musify.Application.Users.Responses; using Musify.Domain.Entities; -namespace Musify.Application.Users.Commands.CreateUser +namespace Musify.Application.Users.Handlers { public class CreateUserCommandHandler(IDatabase database, IKeycloakUserService keycloakUserClient, ILogger logger) : IRequestHandler >> diff --git a/Application/Users/Commands/DeleteUser/DeleteUserCommandHandler.cs b/Application/Users/Handlers/DeleteUserCommandHandler.cs similarity index 92% rename from Application/Users/Commands/DeleteUser/DeleteUserCommandHandler.cs rename to Application/Users/Handlers/DeleteUserCommandHandler.cs index 6cb9845..906bee3 100644 --- a/Application/Users/Commands/DeleteUser/DeleteUserCommandHandler.cs +++ b/Application/Users/Handlers/DeleteUserCommandHandler.cs @@ -2,7 +2,7 @@ using DispatchR.Abstractions.Send; using Musify.Application.Contracts.Infrastructure; -namespace Musify.Application.Users.Commands.DeleteUser +namespace Musify.Application.Users.Commands { public class DeleteUserCommandHandler(IDatabase database) : IRequestHandler> diff --git a/Application/Users/Queries/GetUserById/GetUserByIdQueryHandler.cs b/Application/Users/Handlers/GetUserByIdQueryHandler.cs similarity index 90% rename from Application/Users/Queries/GetUserById/GetUserByIdQueryHandler.cs rename to Application/Users/Handlers/GetUserByIdQueryHandler.cs index f57b93b..44e0008 100644 --- a/Application/Users/Queries/GetUserById/GetUserByIdQueryHandler.cs +++ b/Application/Users/Handlers/GetUserByIdQueryHandler.cs @@ -2,12 +2,13 @@ using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Queries; +using Musify.Application.Users.Responses; -namespace Musify.Application.Users.Queries.GetUserById +namespace Musify.Application.Users.Handlers { public class GetUserByIdQueryHandler(IDatabase database, IKeycloakUserService keycloakUserClient) - : IRequestHandler>> + : IRequestHandler >> { public async Task> Handle(GetUserByIdQuery request, CancellationToken cancellationToken) { diff --git a/Application/Users/Queries/GetUserByKeycloakId/GetUserByKeycloakQueryHandler.cs b/Application/Users/Handlers/GetUserByKeycloakQueryHandler.cs similarity index 89% rename from Application/Users/Queries/GetUserByKeycloakId/GetUserByKeycloakQueryHandler.cs rename to Application/Users/Handlers/GetUserByKeycloakQueryHandler.cs index 2f7c897..f8e89cc 100644 --- a/Application/Users/Queries/GetUserByKeycloakId/GetUserByKeycloakQueryHandler.cs +++ b/Application/Users/Handlers/GetUserByKeycloakQueryHandler.cs @@ -2,12 +2,13 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Queries; +using Musify.Application.Users.Responses; -namespace Musify.Application.Users.Queries.GetUserByKeycloakId +namespace Musify.Application.Users.Handlers { public class GetUserByKeycloakQueryHandler(IDatabase database, IKeycloakUserService keycloakUserClient) - : IRequestHandler>> + : IRequestHandler >> { public async Task> Handle(GetUserByKeycloakQuery request, CancellationToken cancellationToken) { diff --git a/Application/Users/Queries/GetUsers/GetUsersQueryHandler.cs b/Application/Users/Handlers/GetUsersQueryHandler.cs similarity index 81% rename from Application/Users/Queries/GetUsers/GetUsersQueryHandler.cs rename to Application/Users/Handlers/GetUsersQueryHandler.cs index 9e7ecf3..8c5d856 100644 --- a/Application/Users/Queries/GetUsers/GetUsersQueryHandler.cs +++ b/Application/Users/Handlers/GetUsersQueryHandler.cs @@ -1,17 +1,19 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; using Microsoft.EntityFrameworkCore; +using Musify.Application.Contracts.Application; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Queries; +using Musify.Application.Users.Responses; using X.PagedList; using X.PagedList.Extensions; -namespace Musify.Application.Users.Queries.GetUsers +namespace Musify.Application.Users.Handlers { public class GetUsersQueryHandler(IDatabase database, IKeycloakUserService keycloakUserClient) - : IRequestHandler >> + : IRequestHandler > >> { - public async Task> Handle(GetUsersQuery request, CancellationToken cancellationToken) + public async Task >> Handle(GetUsersQuery request, CancellationToken cancellationToken) { var pageNumber = request.PageNumber < 1 ? 1 : request.PageNumber; var pageSize = request.PageSize < 1 ? 10 : request.PageSize; @@ -44,7 +46,7 @@ namespace Musify.Application.Users.Queries.GetUsers var pagedUsers = new StaticPagedList(users, pageNumber, pageSize, totalItemCount); - var response = new PaginatedUserResponse( + var response = new PaginatedResponse( pagedUsers.ToArray(), pagedUsers.PageNumber, pagedUsers.PageSize, @@ -56,4 +58,4 @@ namespace Musify.Application.Users.Queries.GetUsers return Result.Success(response); } } -} +} \ No newline at end of file diff --git a/Application/Users/Queries/GetUserById/GetUserByIdQuery.cs b/Application/Users/Queries/GetUserByIdQuery.cs similarity index 64% rename from Application/Users/Queries/GetUserById/GetUserByIdQuery.cs rename to Application/Users/Queries/GetUserByIdQuery.cs index adc9340..fbdf6fd 100644 --- a/Application/Users/Queries/GetUserById/GetUserByIdQuery.cs +++ b/Application/Users/Queries/GetUserByIdQuery.cs @@ -1,8 +1,8 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Responses; -namespace Musify.Application.Users.Queries.GetUserById +namespace Musify.Application.Users.Queries { public record GetUserByIdQuery(Guid Id) : IRequest >>; diff --git a/Application/Users/Queries/GetUserByKeycloakId/GetUserByKeycloakQuery.cs b/Application/Users/Queries/GetUserByKeycloakQuery.cs similarity index 63% rename from Application/Users/Queries/GetUserByKeycloakId/GetUserByKeycloakQuery.cs rename to Application/Users/Queries/GetUserByKeycloakQuery.cs index 55910b2..e53d449 100644 --- a/Application/Users/Queries/GetUserByKeycloakId/GetUserByKeycloakQuery.cs +++ b/Application/Users/Queries/GetUserByKeycloakQuery.cs @@ -1,8 +1,8 @@ using Ardalis.Result; using DispatchR.Abstractions.Send; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Responses; -namespace Musify.Application.Users.Queries.GetUserByKeycloakId +namespace Musify.Application.Users.Queries { public record GetUserByKeycloakQuery(Guid Id) : IRequest >>; diff --git a/Application/Users/Queries/GetUsers/GetUsersQuery.cs b/Application/Users/Queries/GetUsers/GetUsersQuery.cs deleted file mode 100644 index 7d3aeb2..0000000 --- a/Application/Users/Queries/GetUsers/GetUsersQuery.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Ardalis.Result; -using DispatchR.Abstractions.Send; -using Musify.Application.Users.Contracts; - -namespace Musify.Application.Users.Queries.GetUsers -{ - public record GetUsersQuery(int PageNumber, int PageSize, string UsernameSearch) - : IRequest> >; -} diff --git a/Application/Users/Queries/GetUsersQuery.cs b/Application/Users/Queries/GetUsersQuery.cs new file mode 100644 index 0000000..338e01f --- /dev/null +++ b/Application/Users/Queries/GetUsersQuery.cs @@ -0,0 +1,10 @@ +using Ardalis.Result; +using DispatchR.Abstractions.Send; +using Musify.Application.Contracts.Application; +using Musify.Application.Users.Responses; + +namespace Musify.Application.Users.Queries +{ + public record GetUsersQuery(int PageNumber, int PageSize, string UsernameSearch) + : IRequest >> >; +} diff --git a/Application/Users/Contracts/KeycloakUserResponse.cs b/Application/Users/Responses/KeycloakUserResponse.cs similarity index 73% rename from Application/Users/Contracts/KeycloakUserResponse.cs rename to Application/Users/Responses/KeycloakUserResponse.cs index c4ad490..8cedf5d 100644 --- a/Application/Users/Contracts/KeycloakUserResponse.cs +++ b/Application/Users/Responses/KeycloakUserResponse.cs @@ -1,4 +1,4 @@ -namespace Musify.Application.Users.Contracts +namespace Musify.Application.Users.Responses { public record KeycloakUserResponse( Guid Id, diff --git a/Application/Users/Contracts/UserResponse.cs b/Application/Users/Responses/UserResponse.cs similarity index 79% rename from Application/Users/Contracts/UserResponse.cs rename to Application/Users/Responses/UserResponse.cs index 435536c..758153f 100644 --- a/Application/Users/Contracts/UserResponse.cs +++ b/Application/Users/Responses/UserResponse.cs @@ -1,4 +1,4 @@ -namespace Musify.Application.Users.Contracts +namespace Musify.Application.Users.Responses { public record UserResponse( string Id, diff --git a/Infrastructure/Identity/KeycloakUserMapper.cs b/Infrastructure/Identity/KeycloakUserMapper.cs index 768e069..fdac511 100644 --- a/Infrastructure/Identity/KeycloakUserMapper.cs +++ b/Infrastructure/Identity/KeycloakUserMapper.cs @@ -1,5 +1,5 @@ using Keycloak.Net.Models.Users; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Responses; namespace Musify.Infrastructure.Identity { diff --git a/Infrastructure/Identity/KeycloakUserService.cs b/Infrastructure/Identity/KeycloakUserService.cs index 175fc3e..16ea1fa 100644 --- a/Infrastructure/Identity/KeycloakUserService.cs +++ b/Infrastructure/Identity/KeycloakUserService.cs @@ -3,7 +3,7 @@ using Keycloak.Net; using Keycloak.Net.Models.Users; using Microsoft.Extensions.Logging; using Musify.Application.Contracts.Infrastructure; -using Musify.Application.Users.Contracts; +using Musify.Application.Users.Responses; using Musify.Infrastructure.Configuration; namespace Musify.Infrastructure.Identity