From 6d1c53beeb7347a30a2c6137061331f0fbaf885d Mon Sep 17 00:00:00 2001
From: Artemy <109195690+stalcker2288969@users.noreply.github.com>
Date: Thu, 16 Jul 2026 19:27:45 +0700
Subject: [PATCH] Refactor: migrate Core -> Domain and reorganize projects
Large refactor that renames/moves core types into a new Govor.Domain surface and reorganizes the Application layer. Models, configurations, migrations and many files moved from Govor.Core/Govor.Data to Govor.Domain; numerous Application services, interfaces and implementations were relocated or added (authentication, friends, messages, medias, push notifications, user sessions, storage, synching, private chats, etc.). Tests updated to use Govor.Domain namespaces and adjusted project references (removed Govor.Data reference from API tests). Also updated API, Hub and mapping code and project files to reflect the new structure and naming. This is primarily a codebase-wide namespace and module reorganization to establish a Domain project and restructure application services.
---
.../Controllers/SessionControllerTests.cs | 2 +-
Govor.API.Tests/Govor.API.Tests.csproj | 1 -
Govor.API.Tests/Hubs/PresenceHubTests.cs | 4 +-
.../Controllers/AuthControllerTests.cs | 6 +-
.../Controllers/ChatLoadControllerTests.cs | 3 +-
.../FriendsRequestQueryControllerTests.cs | 2 +-
.../Controllers/FriendshipControllerTests.cs | 2 +-
.../Controllers/MediaControllerTests.cs | 2 +-
.../OnlinePingingControllerTests.cs | 1 +
.../Controllers/ProfileControllerTests.cs | 4 +-
.../IntegrationTests/Hubs/FriendsHubTests.cs | 2 +-
.../PrivateChatGroupManagerTests.cs | 3 +-
Govor.API.Tests/LocalStorageServiceTests.cs | 1 -
.../Validators/ChatGroupValidatorTests.cs | 4 +-
.../Validators/FriendshipValidatorTests.cs | 4 +-
...orTests.cs => InvitationConstantsTests.cs} | 10 +-
.../Validators/MessageValidatorTests.cs | 6 +-
.../Validators/PrivateChatValidatorTests.cs | 4 +-
...alidatorTests.cs => UserConstantsTests.cs} | 10 +-
.../Common/Extensions/AddOptionExtensions.cs | 2 +-
.../ConfigurationProgramExtensions.cs | 94 +-
Govor.API/Common/Mapping/MappingProfile.cs | 7 +-
...serProfileToUserProfileDtoMappingAction.cs | 3 +-
.../Mapping/UserToUserDtoMappingAction.cs | 6 +-
.../AdminStuff/FriendshipsController.cs | 15 +-
.../AdminStuff/InviteUserController.cs | 38 +-
.../Controllers/AdminStuff/UsersController.cs | 12 +-
.../Authentication/AuthController.cs | 134 +--
.../Authentication/RefreshController.cs | 52 +-
.../Authentication/SessionKeysController.cs | 7 +-
Govor.API/Controllers/ChatLoadController.cs | 30 +-
.../Friends/FriendsRequestQueryController.cs | 25 +-
.../Friends/FriendshipController.cs | 6 +-
Govor.API/Controllers/InviteController.cs | 4 +-
Govor.API/Controllers/MediaController.cs | 6 +-
.../Controllers/OnlinePingingController.cs | 16 +-
.../Controllers/PrivateChatController.cs | 33 +-
Govor.API/Controllers/ProfileController.cs | 25 +-
Govor.API/Controllers/PushTokensController.cs | 14 +-
Govor.API/Controllers/SessionController.cs | 43 +-
Govor.API/Filters/HubExceptionFilter.cs | 1 -
Govor.API/Govor.API.csproj | 5 +-
Govor.API/Hubs/ChatsHub.cs | 26 +-
Govor.API/Hubs/FriendsHub.cs | 25 +-
.../Infrastructure/ChatNotificationService.cs | 38 +-
.../Hubs/Infrastructure/ConnectionManager.cs | 3 +
.../Hubs/Infrastructure/ConnectionStore.cs | 2 +-
.../Infrastructure/PrivateChatGroupManager.cs | 4 +-
Govor.API/Hubs/PresenceHub.cs | 37 +-
Govor.API/Hubs/ProfileHub.cs | 11 +-
Govor.API/Program.cs | 9 +-
Govor.API/Properties/launchSettings.json | 2 +-
Govor.API/appsettings.Development.json | 2 +-
Govor.API/appsettings.json | 4 +-
.../AdminsStuff/InvitationGeneratorTests.cs | 4 +-
.../Validators/UsernameValidatorTests.cs | 2 +-
.../Authentication/AuthServiceTests.cs | 12 +-
.../Authentication/JwtServiceTests.cs | 2 +-
.../FriendRequestCommandServiceTests.cs | 7 +-
.../Friends/FriendRequestQueryServiceTests.cs | 8 +-
.../Friends/FriendshipServiceTests.cs | 8 +-
.../AccesserToDownloadMediaServiceTests.cs | 4 +-
.../Messages/MessageCommandServiceTests.cs | 13 +-
.../Services/Messages/MessagesLoaderTests.cs | 9 +-
.../Services/PasswordHasherTests.cs | 2 +-
.../Services/PingHandlerServiceTests.cs | 4 +-
.../Services/ProfileServiceTests.cs | 5 +-
.../PushNotificationServiceTests.cs | 3 +-
.../Services/SynchingServiceTests.cs | 2 +-
.../Services/UserGroupsGetterServiceTests.cs | 6 +-
.../UserNotificationScopeServiceTests.cs | 4 +-
.../Services/UserPrivateChatsCreatorTests.cs | 6 +-
.../UserSessions/UserSessionOpenerTests.cs | 4 +-
.../UserSessions/UserSessionReaderTests.cs | 6 +-
.../UserSessions/UserSessionRefresherTests.cs | 8 +-
.../UserSessions/UserSessionRevokerTests.cs | 8 +-
.../Services/VerifyFriendshipTests.cs | 5 +-
.../Authentication/AuthService.cs | 101 +++
.../Exceptions}/InvalidUsernameException.cs | 4 +-
.../Exceptions/LoginUserException.cs | 5 +
.../Exceptions/UserAlreadyExistException.cs | 5 +
.../Exceptions/UserNotRegisteredException.cs | 5 +
.../Authentication/IAuthService.cs | 11 +
.../Authentication/IInvitesService.cs | 12 +
.../IPasswordHasher.cs | 2 +-
.../Authentication/InvitesService.cs | 56 ++
.../JWT}/IJwtService.cs | 4 +-
.../JWT}/IJwtTokenHasher.cs | 2 +-
.../JWT}/JwtAccessOption.cs | 2 +-
.../JWT}/JwtRefreshOption.cs | 2 +-
.../JWT}/JwtService.cs | 7 +-
.../JWT}/JwtTokenHasher.cs | 3 +-
.../Authentication/PasswordHasher.cs | 4 +-
.../AuthService/LoginUserException.cs | 5 -
.../AuthService/UserAlreadyExistException.cs | 5 -
.../AuthService/UserNotRegisteredException.cs | 5 -
.../RequestAlreadySentException.cs | 2 +-
.../FriendsService/SearchUsersException.cs | 2 +-
.../SendFriendRequestException.cs | 2 +-
.../InviteLinkInvalidException.cs | 2 +-
.../VerifyFriendship/FriendshipException.cs | 2 +-
.../Friends/FriendRequestCommandService.cs | 126 +++
.../Friends/FriendRequestQueryService.cs | 36 +
.../Friends/FriendsBlockService.cs | 4 +-
.../Friends/FriendshipService.cs | 62 ++
.../Friends/IFriendRequestCommandService.cs | 11 +
.../Friends/IFriendRequestQueryService.cs | 4 +-
.../Friends/IFriendsBlockService.cs | 2 +-
.../Friends/IFriendshipService.cs | 4 +-
.../IVerifyFriendship.cs | 2 +-
.../Friends/VerifierFriendship.cs | 59 ++
Govor.Application/Govor.Application.csproj | 14 +-
.../{Interfaces => Groups}/IGroupService.cs | 8 +-
.../IUserGroupsGetterService.cs | 4 +-
.../Groups/UserGroupsGetterService.cs | 25 +
.../AdminsStuff/IInvitationGetter.cs | 10 +
.../AdminsStuff}/IInvitionGenerator.cs | 2 +-
.../AdminsStuff}/IUsersAdministration.cs | 4 +-
.../AdminsStuff/InvitationGenerator.cs | 11 +-
.../AdminsStuff/InvitationGetter.cs | 41 +
.../AdminsStuff/UsersService.cs | 51 +-
.../Extensions/CurrentUserService.cs | 2 -
.../Extensions/CurrentUserSessionService.cs | 1 -
.../Extensions}/IConnectionStore.cs | 2 +-
.../Extensions/ICurrentUserService.cs | 2 +-
.../Extensions/ICurrentUserSessionService.cs | 2 +-
.../Extensions}/IFriendsService.cs | 6 +-
.../Validators/IUsernameValidator.cs | 9 +
.../Validators/UsernameValidator.cs | 72 +-
.../Interfaces/Authentication/IAuthService.cs | 10 -
.../Authentication/IInvitesService.cs | 10 -
.../Authentication/IUsernameValidator.cs | 8 -
.../Friends/IFriendRequestCommandService.cs | 10 -
.../Interfaces/IProfileService.cs | 10 -
.../IUserPrivateChatsGetterService.cs | 8 -
.../Messages/IMessageCommandService.cs | 30 -
.../Messages/Parameters/DeleteMessage.cs | 5 -
.../Interfaces/Messages/Parameters/Result.cs | 3 -
.../Messages/Parameters/SendMedia.cs | 5 -
.../IPushNotificationService.cs | 10 -
.../UserSession/IUserSessionOpener.cs | 10 -
.../UserSession/IUserSessionReader.cs | 6 -
.../UserSession/IUserSessionRefresher.cs | 8 -
.../UserSession/IUserSessionRevoker.cs | 8 -
.../Medias/AccesserToDownloadMediaService.cs | 7 +-
.../Medias/IAccesserToDownloadMedia.cs | 2 +-
.../{Interfaces => }/Medias/IMediaService.cs | 6 +-
.../{Services => }/Medias/MediaService.cs | 9 +-
.../Messages/IMessageEditingService.cs | 8 +
.../Messages/IMessageRemovingService.cs | 8 +
.../Messages/IMessageSendingService.cs | 8 +
.../IMessagesLoader.cs | 4 +-
.../Messages/MessageEditingService.cs | 57 ++
.../Messages/MessageRemovingService.cs | 24 +
.../Messages/MessageSendingService.cs | 77 ++
Govor.Application/Messages/MessagesLoader.cs | 107 +++
.../Messages/Parameters/DeleteMessage.cs | 5 +
.../Parameters/DeleteMessageResult.cs | 6 +
.../Messages/Parameters/EditMessage.cs | 2 +-
.../Messages/Parameters/EditMessageResult.cs | 9 +
.../Messages/Parameters/Result.cs | 3 +
.../Messages/Parameters/SendMedia.cs | 3 +
.../Messages/Parameters/SendMessage.cs | 4 +-
.../Messages/Parameters/SendMessageResult.cs | 6 +
.../IPingHandlerService.cs | 2 +-
.../PingHandlerService.cs | 5 +-
.../IPrivateChatGroupManager.cs | 4 +-
.../IUserPrivateChatsCreator.cs | 4 +-
.../IUserPrivateChatsGetterService.cs | 11 +
.../UserPrivateChatsCreator.cs | 34 +-
.../UserPrivateChatsGetter.cs | 46 +
Govor.Application/Profiles/IProfileService.cs | 10 +
Govor.Application/Profiles/ProfileService.cs | 78 ++
.../IPushNotificationService.cs | 12 +
.../PushNotifications/IPushTokenService.cs | 14 +
.../PushNotifications/Models/PushMessage.cs | 0
.../Models/SendPushResult.cs | 0
.../Providers/FirebasePushProvider.cs | 4 +-
.../Providers}/IPushNotificationProvider.cs | 2 +-
.../Providers/NullPushProvider.cs | 2 +-
.../PushNotificationService.cs | 119 +++
.../PushNotifications/PushTokenService.cs | 168 ++++
.../Services/Authentication/AuthService.cs | 102 ---
.../Friends/FriendRequestCommandService.cs | 105 ---
.../Friends/FriendRequestQueryService.cs | 44 -
.../Services/Friends/FriendshipService.cs | 80 --
Govor.Application/Services/InvitesService.cs | 53 --
.../Messages/MessageCommandService.cs | 229 -----
.../Services/Messages/MessagesLoader.cs | 142 ---
Govor.Application/Services/ProfileService.cs | 56 --
.../PushNotificationService.cs | 98 --
.../Services/UserGroupsGetterService.cs | 28 -
.../Services/UserPrivateChatsGetter.cs | 28 -
.../UserSessions/UserSessionReader.cs | 34 -
.../UserSessions/UserSessionRefresher.cs | 77 --
.../UserSessions/UserSessionRevoker.cs | 73 --
.../Services/VerifierFriendship.cs | 72 --
.../IStorageService.cs | 2 +-
.../LocalStorageService.cs | 3 +-
.../ISynchingService.cs | 2 +-
.../{Services => Synching}/SynchingService.cs | 4 +-
.../Users/IUserNameExistValidator.cs | 6 +
.../Users/UserNameExistValidator.cs | 26 +
.../UserOnlineStatus/IOnlineUserStore.cs | 2 +-
.../IUserNotificationScopeService.cs | 2 +-
.../UserOnlineStatus/IUserPresenceReader.cs | 2 +-
.../UserOnlineStatus/OnlineUserStore.cs | 3 +-
.../UserNotificationScopeService.cs | 20 +-
.../UserOnlineStatus/UserPresenceReader.cs | 4 +-
.../Crypto/IOneTimePreKeysRotator.cs | 2 +-
.../Crypto/ISessionKeyAttacher.cs | 4 +-
.../Crypto/ISessionKeysReader.cs | 4 +-
.../Crypto/OneTimePreKeysRotator.cs | 9 +-
.../UserSessions/Crypto/SessionKeyAttacher.cs | 9 +-
.../UserSessions/Crypto/SessionKeysReader.cs | 8 +-
.../Users/UserSessions/IUserSessionOpener.cs | 11 +
.../Users/UserSessions/IUserSessionReader.cs | 8 +
.../UserSessions/IUserSessionRefresher.cs | 8 +
.../Users/UserSessions/IUserSessionRevoker.cs | 10 +
.../Users/UserSessions/RefreshResult.cs | 3 +
.../UserSessions/UserSessionOpener.cs | 79 +-
.../Users/UserSessions/UserSessionReader.cs | 46 +
.../UserSessions/UserSessionRefresher.cs | 80 ++
.../Users/UserSessions/UserSessionRevoker.cs | 85 ++
.../Govor.ConsoleClient.csproj | 1 -
Govor.Contracts/DTOs/FriendshipDto.cs | 2 +-
Govor.Contracts/Govor.Contracts.csproj | 2 +-
.../Requests/AvatarUploadRequest.cs | 4 +-
Govor.Contracts/Requests/LoginRequest.cs | 8 +-
.../Requests/MediaUploadRequest.cs | 4 +-
.../Requests/RegistrationRequest.cs | 8 +-
.../Requests/SignalR/MediaReference.cs | 2 +-
.../Requests/SignalR/MessageRequest.cs | 2 +-
Govor.Contracts/Responses/MessageResponse.cs | 2 +-
.../Responses/SignalR/MessageEditResponse.cs | 2 +-
.../SignalR/MessageRemovedResponse.cs | 2 +-
.../Responses/SignalR/UserMessageResponse.cs | 4 +-
Govor.Core/Govor.Core.csproj | 13 -
.../Validators/AdminValidator.cs | 34 -
.../Validators/ChatGroupValidator.cs | 44 -
.../Validators/FriendshipValidator.cs | 40 -
.../Validators/IObjectValidator.cs | 9 -
.../Validators/InvitationValidator.cs | 43 -
.../Validators/MediaAttachmentsValidator.cs | 40 -
.../Validators/MessageValidator.cs | 44 -
.../Validators/PrivateChatValidator.cs | 38 -
.../Validators/UserValidator.cs | 46 -
.../Repositories/Admins/IAdminsExist.cs | 9 -
.../Repositories/Admins/IAdminsReader.cs | 9 -
.../Repositories/Admins/IAdminsRepository.cs | 6 -
.../Repositories/Admins/IAdminsWriter.cs | 10 -
.../Friendships/IFriendshipsExist.cs | 7 -
.../Friendships/IFriendshipsReader.cs | 11 -
.../Friendships/IFriendshipsRepository.cs | 6 -
.../Friendships/IFriendshipsWriter.cs | 10 -
.../Groups/IGroupMessagesReader.cs | 8 -
.../Repositories/Groups/IGroupsExist.cs | 9 -
.../Repositories/Groups/IGroupsReader.cs | 13 -
.../Repositories/Groups/IGroupsRepository.cs | 6 -
.../Repositories/Groups/IGroupsWriter.cs | 10 -
.../Repositories/Invaites/IInvitesExist.cs | 10 -
.../Repositories/Invaites/IInvitesReader.cs | 11 -
.../Invaites/IInvitesRepository.cs | 6 -
.../Repositories/Invaites/IInvitesWriter.cs | 10 -
.../IMediaAttachmentsExist.cs | 9 -
.../IMediaAttachmentsReader.cs | 10 -
.../IMediaAttachmentsRepository.cs | 6 -
.../IMediaAttachmentsWriter.cs | 10 -
.../Repositories/Messages/IMessagesExist.cs | 9 -
.../Repositories/Messages/IMessagesReader.cs | 13 -
.../Messages/IMessagesRepository.cs | 6 -
.../Repositories/Messages/IMessagesWriter.cs | 10 -
.../PrivateChats/IPrivateChatsExist.cs | 7 -
.../PrivateChats/IPrivateChatsReader.cs | 11 -
.../PrivateChats/IPrivateChatsRepository.cs | 8 -
.../PrivateChats/IPrivateChatsWriter.cs | 10 -
.../PushTokens/IPushTokenReader.cs | 10 -
.../PushTokens/IPushTokenRepository.cs | 6 -
.../PushTokens/IPushTokenWriter.cs | 11 -
.../IUserSessionsExist.cs | 10 -
.../IUserSessionsReader.cs | 14 -
.../IUserSessionsRepository.cs | 8 -
.../IUserSessionsWriter.cs | 12 -
Govor.Core/Repositories/Users/IUsersExist.cs | 10 -
Govor.Core/Repositories/Users/IUsersReader.cs | 14 -
.../Repositories/Users/IUsersRepository.cs | 6 -
Govor.Core/Repositories/Users/IUsersWriter.cs | 11 -
Govor.Data.Tests/Govor.Data.Tests.csproj | 4 -
.../Repositories/AdminsRepositoryTests.cs | 14 +-
.../FriendshipsRepositoryTests.cs | 12 +-
.../Repositories/GroupRepositoryTests.cs | 12 +-
.../Repositories/InvitesRepositoryTests.cs | 12 +-
.../Repositories/MediaAttachmentsTests.cs | 14 +-
.../Repositories/MessagesRepositoryTests.cs | 14 +-
.../PrivateChatsRepositoryTests.cs | 12 +-
.../Repositories/PushTokenRepository.cs | 6 +-
.../UserSessionsRepositoryTests.cs | 10 +-
.../Repositories/UsersRepositoryTests.cs | 14 +-
.../20260301080331_Init.Designer.cs | 848 ------------------
...260301091506_FixRecipientIndex.Designer.cs | 838 -----------------
.../20260301091506_FixRecipientIndex.cs | 67 --
.../20260301120522_FixPushTokensIndexs.cs | 82 --
Govor.Data/Repositories/AdminsRepository.cs | 108 ---
.../Exceptions/AdditionException.cs | 10 -
.../Exceptions/NotFoundByKeyException.cs | 14 -
.../Exceptions/NotFoundException.cs | 11 -
.../Exceptions/RemoveException.cs | 4 -
.../Exceptions/UpdateException.cs | 12 -
.../Repositories/FriendshipsRepository.cs | 150 ----
Govor.Data/Repositories/GroupRepository.cs | 166 ----
Govor.Data/Repositories/InvitesRepository.cs | 154 ----
.../MediaAttachmentsRepository.cs | 128 ---
Govor.Data/Repositories/MessagesRepository.cs | 179 ----
.../Repositories/PrivateChatsRepository.cs | 126 ---
.../Repositories/PushTokenRepository.cs | 150 ----
.../Repositories/UserSessionsRepository.cs | 169 ----
Govor.Data/Repositories/UsersRepository.cs | 222 -----
.../Common/Constants/InvitationConstants.cs | 6 +
.../Common/Constants/UserConstants.cs | 7 +
Govor.Domain/Common/Error.cs | 9 +
.../Common}/Extensions/QueryableExtensions.cs | 2 +-
Govor.Domain/Common/Result.cs | 49 +
.../Configurations/AdminConfiguration.cs | 4 +-
.../Configurations/ChatGroupConfigurator.cs | 4 +-
.../Configurations/FriendshipConfiguration.cs | 4 +-
.../GroupAdminsConfiguration.cs | 4 +-
.../GroupInvitationConfiguration.cs | 4 +-
.../GroupMembershipConfiguration.cs | 12 +-
.../Configurations/InvitationConfiguration.cs | 4 +-
.../MediaAttachmentsConfiguration.cs | 4 +-
.../Configurations/MediaFileConfiguration.cs | 4 +-
.../MessageReactionConfiguration.cs | 4 +-
.../MessageViewConfiguration.cs | 4 +-
.../Configurations/MessagesConfiguration.cs | 4 +-
.../OneTimePreKeyConfiguration.cs | 4 +-
.../PrivacyRuleEntityConfiguration.cs | 5 +-
.../PrivacyUserSettingsConfiguration.cs | 4 +-
.../PrivateChatsConfiguration.cs | 4 +-
.../SignedPreKeyConfiguration.cs | 4 +-
.../Configurations/UserConfiguration.cs | 4 +-
.../UserCryptoSessionConfiguration.cs | 4 +-
.../UserPushTokenConfiguration.cs | 4 +-
.../UserSessionConfiguration.cs | 18 +-
.../Govor.Domain.csproj | 5 -
.../GovorCoreException.cs | 2 +-
.../GovorDbContext.cs | 12 +-
.../20260716110338_InitialCreate.Designer.cs | 150 ++--
.../20260716110338_InitialCreate.cs | 56 +-
.../Migrations/GovorDbContextModelSnapshot.cs | 146 +--
.../Models/ChatGroup.cs | 4 +-
.../Models/Friendship.cs | 4 +-
.../Models/GroupAdmins.cs | 2 +-
.../Models/GroupInvitation.cs | 4 +-
.../Models/GroupMembership.cs | 3 +-
.../Models/Invitation.cs | 4 +-
.../Models/MediaFile.cs | 6 +-
.../Models/Messages/MediaAttachments.cs | 2 +-
.../Models/Messages/Message.cs | 2 +-
.../Models/Messages/MessageReaction.cs | 4 +-
.../Models/Messages/MessageView.cs | 2 +-
.../Models/PrivateChat.cs | 4 +-
.../Models/Users/Admin.cs | 2 +-
.../Models/Users/Crypto/OneTimePreKey.cs | 2 +-
.../Models/Users/Crypto/SignedPreKey.cs | 2 +-
.../Models/Users/Crypto/UserCryptoSession.cs | 2 +-
.../Models/Users/PrivacyRuleEntity.cs | 2 +-
.../Models/Users/PrivacyUserSettings.cs | 2 +-
.../Models/Users/User.cs | 2 +-
.../Models/Users/UserPushToken.cs | 4 +-
.../Models/Users/UserSession.cs | 20 +-
Govor.sln | 21 +-
371 files changed, 2729 insertions(+), 6694 deletions(-)
rename Govor.API.Tests/UnitTests/Infrastructure/Validators/{InvitationValidatorTests.cs => InvitationConstantsTests.cs} (94%)
rename Govor.API.Tests/UnitTests/Infrastructure/Validators/{UserValidatorTests.cs => UserConstantsTests.cs} (96%)
create mode 100644 Govor.Application/Authentication/AuthService.cs
rename Govor.Application/{Exceptions/AuthService => Authentication/Exceptions}/InvalidUsernameException.cs (55%)
create mode 100644 Govor.Application/Authentication/Exceptions/LoginUserException.cs
create mode 100644 Govor.Application/Authentication/Exceptions/UserAlreadyExistException.cs
create mode 100644 Govor.Application/Authentication/Exceptions/UserNotRegisteredException.cs
create mode 100644 Govor.Application/Authentication/IAuthService.cs
create mode 100644 Govor.Application/Authentication/IInvitesService.cs
rename Govor.Application/{Interfaces => Authentication}/IPasswordHasher.cs (73%)
create mode 100644 Govor.Application/Authentication/InvitesService.cs
rename Govor.Application/{Interfaces/Authentication => Authentication/JWT}/IJwtService.cs (74%)
rename Govor.Application/{Interfaces/Authentication => Authentication/JWT}/IJwtTokenHasher.cs (69%)
rename Govor.Application/{Services/Authentication => Authentication/JWT}/JwtAccessOption.cs (66%)
rename Govor.Application/{Services/Authentication => Authentication/JWT}/JwtRefreshOption.cs (62%)
rename Govor.Application/{Services/Authentication => Authentication/JWT}/JwtService.cs (94%)
rename Govor.Application/{Services/Authentication => Authentication/JWT}/JwtTokenHasher.cs (91%)
rename Govor.Application/{Services => }/Authentication/PasswordHasher.cs (76%)
delete mode 100644 Govor.Application/Exceptions/AuthService/LoginUserException.cs
delete mode 100644 Govor.Application/Exceptions/AuthService/UserAlreadyExistException.cs
delete mode 100644 Govor.Application/Exceptions/AuthService/UserNotRegisteredException.cs
create mode 100644 Govor.Application/Friends/FriendRequestCommandService.cs
create mode 100644 Govor.Application/Friends/FriendRequestQueryService.cs
rename Govor.Application/{Services => }/Friends/FriendsBlockService.cs (79%)
create mode 100644 Govor.Application/Friends/FriendshipService.cs
create mode 100644 Govor.Application/Friends/IFriendRequestCommandService.cs
rename Govor.Application/{Interfaces => }/Friends/IFriendRequestQueryService.cs (69%)
rename Govor.Application/{Interfaces => }/Friends/IFriendsBlockService.cs (81%)
rename Govor.Application/{Interfaces => }/Friends/IFriendshipService.cs (73%)
rename Govor.Application/{Interfaces => Friends}/IVerifyFriendship.cs (80%)
create mode 100644 Govor.Application/Friends/VerifierFriendship.cs
rename Govor.Application/{Interfaces => Groups}/IGroupService.cs (79%)
rename Govor.Application/{Interfaces => Groups}/IUserGroupsGetterService.cs (61%)
create mode 100644 Govor.Application/Groups/UserGroupsGetterService.cs
create mode 100644 Govor.Application/Infrastructure/AdminsStuff/IInvitationGetter.cs
rename Govor.Application/{Interfaces => Infrastructure/AdminsStuff}/IInvitionGenerator.cs (73%)
rename Govor.Application/{Interfaces => Infrastructure/AdminsStuff}/IUsersAdministration.cs (66%)
create mode 100644 Govor.Application/Infrastructure/AdminsStuff/InvitationGetter.cs
rename Govor.Application/{Interfaces => Infrastructure/Extensions}/IConnectionStore.cs (78%)
rename Govor.Application/{Interfaces => }/Infrastructure/Extensions/ICurrentUserService.cs (50%)
rename Govor.Application/{Interfaces => }/Infrastructure/Extensions/ICurrentUserSessionService.cs (53%)
rename Govor.Application/{Interfaces => Infrastructure/Extensions}/IFriendsService.cs (81%)
create mode 100644 Govor.Application/Infrastructure/Validators/IUsernameValidator.cs
delete mode 100644 Govor.Application/Interfaces/Authentication/IAuthService.cs
delete mode 100644 Govor.Application/Interfaces/Authentication/IInvitesService.cs
delete mode 100644 Govor.Application/Interfaces/Authentication/IUsernameValidator.cs
delete mode 100644 Govor.Application/Interfaces/Friends/IFriendRequestCommandService.cs
delete mode 100644 Govor.Application/Interfaces/IProfileService.cs
delete mode 100644 Govor.Application/Interfaces/IUserPrivateChatsGetterService.cs
delete mode 100644 Govor.Application/Interfaces/Messages/IMessageCommandService.cs
delete mode 100644 Govor.Application/Interfaces/Messages/Parameters/DeleteMessage.cs
delete mode 100644 Govor.Application/Interfaces/Messages/Parameters/Result.cs
delete mode 100644 Govor.Application/Interfaces/Messages/Parameters/SendMedia.cs
delete mode 100644 Govor.Application/Interfaces/PushNotifications/IPushNotificationService.cs
delete mode 100644 Govor.Application/Interfaces/UserSession/IUserSessionOpener.cs
delete mode 100644 Govor.Application/Interfaces/UserSession/IUserSessionReader.cs
delete mode 100644 Govor.Application/Interfaces/UserSession/IUserSessionRefresher.cs
delete mode 100644 Govor.Application/Interfaces/UserSession/IUserSessionRevoker.cs
rename Govor.Application/{Services => }/Medias/AccesserToDownloadMediaService.cs (91%)
rename Govor.Application/{Interfaces => }/Medias/IAccesserToDownloadMedia.cs (69%)
rename Govor.Application/{Interfaces => }/Medias/IMediaService.cs (79%)
rename Govor.Application/{Services => }/Medias/MediaService.cs (96%)
create mode 100644 Govor.Application/Messages/IMessageEditingService.cs
create mode 100644 Govor.Application/Messages/IMessageRemovingService.cs
create mode 100644 Govor.Application/Messages/IMessageSendingService.cs
rename Govor.Application/{Interfaces => Messages}/IMessagesLoader.cs (80%)
create mode 100644 Govor.Application/Messages/MessageEditingService.cs
create mode 100644 Govor.Application/Messages/MessageRemovingService.cs
create mode 100644 Govor.Application/Messages/MessageSendingService.cs
create mode 100644 Govor.Application/Messages/MessagesLoader.cs
create mode 100644 Govor.Application/Messages/Parameters/DeleteMessage.cs
create mode 100644 Govor.Application/Messages/Parameters/DeleteMessageResult.cs
rename Govor.Application/{Interfaces => }/Messages/Parameters/EditMessage.cs (52%)
create mode 100644 Govor.Application/Messages/Parameters/EditMessageResult.cs
create mode 100644 Govor.Application/Messages/Parameters/Result.cs
create mode 100644 Govor.Application/Messages/Parameters/SendMedia.cs
rename Govor.Application/{Interfaces => }/Messages/Parameters/SendMessage.cs (58%)
create mode 100644 Govor.Application/Messages/Parameters/SendMessageResult.cs
rename Govor.Application/{Interfaces => PingHandler}/IPingHandlerService.cs (61%)
rename Govor.Application/{Services => PingHandler}/PingHandlerService.cs (90%)
rename Govor.Application/{Interfaces => PrivateUserChats}/IPrivateChatGroupManager.cs (71%)
rename Govor.Application/{Interfaces => PrivateUserChats}/IUserPrivateChatsCreator.cs (59%)
create mode 100644 Govor.Application/PrivateUserChats/IUserPrivateChatsGetterService.cs
rename Govor.Application/{Services => PrivateUserChats}/UserPrivateChatsCreator.cs (51%)
create mode 100644 Govor.Application/PrivateUserChats/UserPrivateChatsGetter.cs
create mode 100644 Govor.Application/Profiles/IProfileService.cs
create mode 100644 Govor.Application/Profiles/ProfileService.cs
create mode 100644 Govor.Application/PushNotifications/IPushNotificationService.cs
create mode 100644 Govor.Application/PushNotifications/IPushTokenService.cs
rename Govor.Application/{Interfaces => }/PushNotifications/Models/PushMessage.cs (100%)
rename Govor.Application/{Interfaces => }/PushNotifications/Models/SendPushResult.cs (100%)
rename Govor.Application/{Services => }/PushNotifications/Providers/FirebasePushProvider.cs (97%)
rename Govor.Application/{Interfaces/PushNotifications => PushNotifications/Providers}/IPushNotificationProvider.cs (84%)
rename Govor.Application/{Services => }/PushNotifications/Providers/NullPushProvider.cs (88%)
create mode 100644 Govor.Application/PushNotifications/PushNotificationService.cs
create mode 100644 Govor.Application/PushNotifications/PushTokenService.cs
delete mode 100644 Govor.Application/Services/Authentication/AuthService.cs
delete mode 100644 Govor.Application/Services/Friends/FriendRequestCommandService.cs
delete mode 100644 Govor.Application/Services/Friends/FriendRequestQueryService.cs
delete mode 100644 Govor.Application/Services/Friends/FriendshipService.cs
delete mode 100644 Govor.Application/Services/InvitesService.cs
delete mode 100644 Govor.Application/Services/Messages/MessageCommandService.cs
delete mode 100644 Govor.Application/Services/Messages/MessagesLoader.cs
delete mode 100644 Govor.Application/Services/ProfileService.cs
delete mode 100644 Govor.Application/Services/PushNotifications/PushNotificationService.cs
delete mode 100644 Govor.Application/Services/UserGroupsGetterService.cs
delete mode 100644 Govor.Application/Services/UserPrivateChatsGetter.cs
delete mode 100644 Govor.Application/Services/UserSessions/UserSessionReader.cs
delete mode 100644 Govor.Application/Services/UserSessions/UserSessionRefresher.cs
delete mode 100644 Govor.Application/Services/UserSessions/UserSessionRevoker.cs
delete mode 100644 Govor.Application/Services/VerifierFriendship.cs
rename Govor.Application/{Interfaces => Storage}/IStorageService.cs (80%)
rename Govor.Application/{Services => Storage}/LocalStorageService.cs (97%)
rename Govor.Application/{Interfaces => Synching}/ISynchingService.cs (89%)
rename Govor.Application/{Services => Synching}/SynchingService.cs (82%)
create mode 100644 Govor.Application/Users/IUserNameExistValidator.cs
create mode 100644 Govor.Application/Users/UserNameExistValidator.cs
rename Govor.Application/{Interfaces => Users}/UserOnlineStatus/IOnlineUserStore.cs (83%)
rename Govor.Application/{Interfaces => Users}/UserOnlineStatus/IUserNotificationScopeService.cs (63%)
rename Govor.Application/{Interfaces => Users}/UserOnlineStatus/IUserPresenceReader.cs (61%)
rename Govor.Application/{Services => Users}/UserOnlineStatus/OnlineUserStore.cs (94%)
rename Govor.Application/{Services => Users}/UserOnlineStatus/UserNotificationScopeService.cs (67%)
rename Govor.Application/{Services => Users}/UserOnlineStatus/UserPresenceReader.cs (60%)
rename Govor.Application/{Interfaces/UserSession => Users/UserSessions}/Crypto/IOneTimePreKeysRotator.cs (78%)
rename Govor.Application/{Interfaces/UserSession => Users/UserSessions}/Crypto/ISessionKeyAttacher.cs (70%)
rename Govor.Application/{Interfaces/UserSession => Users/UserSessions}/Crypto/ISessionKeysReader.cs (75%)
rename Govor.Application/{Services => Users}/UserSessions/Crypto/OneTimePreKeysRotator.cs (90%)
rename Govor.Application/{Services => Users}/UserSessions/Crypto/SessionKeyAttacher.cs (90%)
rename Govor.Application/{Services => Users}/UserSessions/Crypto/SessionKeysReader.cs (89%)
create mode 100644 Govor.Application/Users/UserSessions/IUserSessionOpener.cs
create mode 100644 Govor.Application/Users/UserSessions/IUserSessionReader.cs
create mode 100644 Govor.Application/Users/UserSessions/IUserSessionRefresher.cs
create mode 100644 Govor.Application/Users/UserSessions/IUserSessionRevoker.cs
create mode 100644 Govor.Application/Users/UserSessions/RefreshResult.cs
rename Govor.Application/{Services => Users}/UserSessions/UserSessionOpener.cs (52%)
create mode 100644 Govor.Application/Users/UserSessions/UserSessionReader.cs
create mode 100644 Govor.Application/Users/UserSessions/UserSessionRefresher.cs
create mode 100644 Govor.Application/Users/UserSessions/UserSessionRevoker.cs
delete mode 100644 Govor.Core/Govor.Core.csproj
delete mode 100644 Govor.Core/Infrastructure/Validators/AdminValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/ChatGroupValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/FriendshipValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/IObjectValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/InvitationValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/MediaAttachmentsValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/MessageValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/PrivateChatValidator.cs
delete mode 100644 Govor.Core/Infrastructure/Validators/UserValidator.cs
delete mode 100644 Govor.Core/Repositories/Admins/IAdminsExist.cs
delete mode 100644 Govor.Core/Repositories/Admins/IAdminsReader.cs
delete mode 100644 Govor.Core/Repositories/Admins/IAdminsRepository.cs
delete mode 100644 Govor.Core/Repositories/Admins/IAdminsWriter.cs
delete mode 100644 Govor.Core/Repositories/Friendships/IFriendshipsExist.cs
delete mode 100644 Govor.Core/Repositories/Friendships/IFriendshipsReader.cs
delete mode 100644 Govor.Core/Repositories/Friendships/IFriendshipsRepository.cs
delete mode 100644 Govor.Core/Repositories/Friendships/IFriendshipsWriter.cs
delete mode 100644 Govor.Core/Repositories/Groups/IGroupMessagesReader.cs
delete mode 100644 Govor.Core/Repositories/Groups/IGroupsExist.cs
delete mode 100644 Govor.Core/Repositories/Groups/IGroupsReader.cs
delete mode 100644 Govor.Core/Repositories/Groups/IGroupsRepository.cs
delete mode 100644 Govor.Core/Repositories/Groups/IGroupsWriter.cs
delete mode 100644 Govor.Core/Repositories/Invaites/IInvitesExist.cs
delete mode 100644 Govor.Core/Repositories/Invaites/IInvitesReader.cs
delete mode 100644 Govor.Core/Repositories/Invaites/IInvitesRepository.cs
delete mode 100644 Govor.Core/Repositories/Invaites/IInvitesWriter.cs
delete mode 100644 Govor.Core/Repositories/MediasAttachments/IMediaAttachmentsExist.cs
delete mode 100644 Govor.Core/Repositories/MediasAttachments/IMediaAttachmentsReader.cs
delete mode 100644 Govor.Core/Repositories/MediasAttachments/IMediaAttachmentsRepository.cs
delete mode 100644 Govor.Core/Repositories/MediasAttachments/IMediaAttachmentsWriter.cs
delete mode 100644 Govor.Core/Repositories/Messages/IMessagesExist.cs
delete mode 100644 Govor.Core/Repositories/Messages/IMessagesReader.cs
delete mode 100644 Govor.Core/Repositories/Messages/IMessagesRepository.cs
delete mode 100644 Govor.Core/Repositories/Messages/IMessagesWriter.cs
delete mode 100644 Govor.Core/Repositories/PrivateChats/IPrivateChatsExist.cs
delete mode 100644 Govor.Core/Repositories/PrivateChats/IPrivateChatsReader.cs
delete mode 100644 Govor.Core/Repositories/PrivateChats/IPrivateChatsRepository.cs
delete mode 100644 Govor.Core/Repositories/PrivateChats/IPrivateChatsWriter.cs
delete mode 100644 Govor.Core/Repositories/PushTokens/IPushTokenReader.cs
delete mode 100644 Govor.Core/Repositories/PushTokens/IPushTokenRepository.cs
delete mode 100644 Govor.Core/Repositories/PushTokens/IPushTokenWriter.cs
delete mode 100644 Govor.Core/Repositories/UserSessionsRepository/IUserSessionsExist.cs
delete mode 100644 Govor.Core/Repositories/UserSessionsRepository/IUserSessionsReader.cs
delete mode 100644 Govor.Core/Repositories/UserSessionsRepository/IUserSessionsRepository.cs
delete mode 100644 Govor.Core/Repositories/UserSessionsRepository/IUserSessionsWriter.cs
delete mode 100644 Govor.Core/Repositories/Users/IUsersExist.cs
delete mode 100644 Govor.Core/Repositories/Users/IUsersReader.cs
delete mode 100644 Govor.Core/Repositories/Users/IUsersRepository.cs
delete mode 100644 Govor.Core/Repositories/Users/IUsersWriter.cs
delete mode 100644 Govor.Data/Migrations/20260301080331_Init.Designer.cs
delete mode 100644 Govor.Data/Migrations/20260301091506_FixRecipientIndex.Designer.cs
delete mode 100644 Govor.Data/Migrations/20260301091506_FixRecipientIndex.cs
delete mode 100644 Govor.Data/Migrations/20260301120522_FixPushTokensIndexs.cs
delete mode 100644 Govor.Data/Repositories/AdminsRepository.cs
delete mode 100644 Govor.Data/Repositories/Exceptions/AdditionException.cs
delete mode 100644 Govor.Data/Repositories/Exceptions/NotFoundByKeyException.cs
delete mode 100644 Govor.Data/Repositories/Exceptions/NotFoundException.cs
delete mode 100644 Govor.Data/Repositories/Exceptions/RemoveException.cs
delete mode 100644 Govor.Data/Repositories/Exceptions/UpdateException.cs
delete mode 100644 Govor.Data/Repositories/FriendshipsRepository.cs
delete mode 100644 Govor.Data/Repositories/GroupRepository.cs
delete mode 100644 Govor.Data/Repositories/InvitesRepository.cs
delete mode 100644 Govor.Data/Repositories/MediaAttachmentsRepository.cs
delete mode 100644 Govor.Data/Repositories/MessagesRepository.cs
delete mode 100644 Govor.Data/Repositories/PrivateChatsRepository.cs
delete mode 100644 Govor.Data/Repositories/PushTokenRepository.cs
delete mode 100644 Govor.Data/Repositories/UserSessionsRepository.cs
delete mode 100644 Govor.Data/Repositories/UsersRepository.cs
create mode 100644 Govor.Domain/Common/Constants/InvitationConstants.cs
create mode 100644 Govor.Domain/Common/Constants/UserConstants.cs
create mode 100644 Govor.Domain/Common/Error.cs
rename {Govor.Core/Infrastructure => Govor.Domain/Common}/Extensions/QueryableExtensions.cs (86%)
create mode 100644 Govor.Domain/Common/Result.cs
rename {Govor.Data => Govor.Domain}/Configurations/AdminConfiguration.cs (83%)
rename {Govor.Data => Govor.Domain}/Configurations/ChatGroupConfigurator.cs (92%)
rename {Govor.Data => Govor.Domain}/Configurations/FriendshipConfiguration.cs (91%)
rename {Govor.Data => Govor.Domain}/Configurations/GroupAdminsConfiguration.cs (85%)
rename {Govor.Data => Govor.Domain}/Configurations/GroupInvitationConfiguration.cs (92%)
rename {Govor.Data => Govor.Domain}/Configurations/GroupMembershipConfiguration.cs (64%)
rename {Govor.Data => Govor.Domain}/Configurations/InvitationConfiguration.cs (87%)
rename {Govor.Data => Govor.Domain}/Configurations/MediaAttachmentsConfiguration.cs (89%)
rename {Govor.Data => Govor.Domain}/Configurations/MediaFileConfiguration.cs (91%)
rename {Govor.Data => Govor.Domain}/Configurations/MessageReactionConfiguration.cs (90%)
rename {Govor.Data => Govor.Domain}/Configurations/MessageViewConfiguration.cs (85%)
rename {Govor.Data => Govor.Domain}/Configurations/MessagesConfiguration.cs (92%)
rename {Govor.Data => Govor.Domain}/Configurations/OneTimePreKeyConfiguration.cs (92%)
rename {Govor.Data => Govor.Domain}/Configurations/PrivacyRuleEntityConfiguration.cs (90%)
rename {Govor.Data => Govor.Domain}/Configurations/PrivacyUserSettingsConfiguration.cs (92%)
rename {Govor.Data => Govor.Domain}/Configurations/PrivateChatsConfiguration.cs (81%)
rename {Govor.Data => Govor.Domain}/Configurations/SignedPreKeyConfiguration.cs (90%)
rename {Govor.Data => Govor.Domain}/Configurations/UserConfiguration.cs (92%)
rename {Govor.Data => Govor.Domain}/Configurations/UserCryptoSessionConfiguration.cs (93%)
rename {Govor.Data => Govor.Domain}/Configurations/UserPushTokenConfiguration.cs (91%)
rename {Govor.Data => Govor.Domain}/Configurations/UserSessionConfiguration.cs (76%)
rename Govor.Data/Govor.Data.csproj => Govor.Domain/Govor.Domain.csproj (83%)
rename {Govor.Core => Govor.Domain}/GovorCoreException.cs (93%)
rename {Govor.Data => Govor.Domain}/GovorDbContext.cs (93%)
rename Govor.Data/Migrations/20260301120522_FixPushTokensIndexs.Designer.cs => Govor.Domain/Migrations/20260716110338_InitialCreate.Designer.cs (81%)
rename Govor.Data/Migrations/20260301080331_Init.cs => Govor.Domain/Migrations/20260716110338_InitialCreate.cs (95%)
rename {Govor.Data => Govor.Domain}/Migrations/GovorDbContextModelSnapshot.cs (81%)
rename {Govor.Core => Govor.Domain}/Models/ChatGroup.cs (93%)
rename {Govor.Core => Govor.Domain}/Models/Friendship.cs (85%)
rename {Govor.Core => Govor.Domain}/Models/GroupAdmins.cs (80%)
rename {Govor.Core => Govor.Domain}/Models/GroupInvitation.cs (87%)
rename {Govor.Core => Govor.Domain}/Models/GroupMembership.cs (77%)
rename {Govor.Core => Govor.Domain}/Models/Invitation.cs (93%)
rename {Govor.Core => Govor.Domain}/Models/MediaFile.cs (80%)
rename {Govor.Core => Govor.Domain}/Models/Messages/MediaAttachments.cs (93%)
rename {Govor.Core => Govor.Domain}/Models/Messages/Message.cs (96%)
rename {Govor.Core => Govor.Domain}/Models/Messages/MessageReaction.cs (83%)
rename {Govor.Core => Govor.Domain}/Models/Messages/MessageView.cs (82%)
rename {Govor.Core => Govor.Domain}/Models/PrivateChat.cs (86%)
rename {Govor.Core => Govor.Domain}/Models/Users/Admin.cs (81%)
rename {Govor.Core => Govor.Domain}/Models/Users/Crypto/OneTimePreKey.cs (87%)
rename {Govor.Core => Govor.Domain}/Models/Users/Crypto/SignedPreKey.cs (86%)
rename {Govor.Core => Govor.Domain}/Models/Users/Crypto/UserCryptoSession.cs (88%)
rename {Govor.Core => Govor.Domain}/Models/Users/PrivacyRuleEntity.cs (91%)
rename {Govor.Core => Govor.Domain}/Models/Users/PrivacyUserSettings.cs (94%)
rename {Govor.Core => Govor.Domain}/Models/Users/User.cs (94%)
rename {Govor.Core => Govor.Domain}/Models/Users/UserPushToken.cs (89%)
rename {Govor.Core => Govor.Domain}/Models/Users/UserSession.cs (61%)
diff --git a/Govor.API.Tests/Controllers/SessionControllerTests.cs b/Govor.API.Tests/Controllers/SessionControllerTests.cs
index f3190db..c7d22d5 100644
--- a/Govor.API.Tests/Controllers/SessionControllerTests.cs
+++ b/Govor.API.Tests/Controllers/SessionControllerTests.cs
@@ -3,7 +3,7 @@ using Govor.API.Controllers;
using Govor.Application.Interfaces.Infrastructure.Extensions;
using Govor.Application.Interfaces.UserSession;
using Govor.Contracts.DTOs;
-using Govor.Core.Models.Users;
+using Govor.Domain.Models.Users;
using Govor.Data.Repositories.Exceptions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
diff --git a/Govor.API.Tests/Govor.API.Tests.csproj b/Govor.API.Tests/Govor.API.Tests.csproj
index 26fdd64..da8779c 100644
--- a/Govor.API.Tests/Govor.API.Tests.csproj
+++ b/Govor.API.Tests/Govor.API.Tests.csproj
@@ -27,6 +27,5 @@
-
diff --git a/Govor.API.Tests/Hubs/PresenceHubTests.cs b/Govor.API.Tests/Hubs/PresenceHubTests.cs
index 8318c70..99ddc91 100644
--- a/Govor.API.Tests/Hubs/PresenceHubTests.cs
+++ b/Govor.API.Tests/Hubs/PresenceHubTests.cs
@@ -2,8 +2,8 @@ using AutoFixture;
using Govor.API.Common.SignalR.Helpers;
using Govor.API.Hubs;
using Govor.Application.Interfaces.UserOnlineStatus;
-using Govor.Core.Models.Users;
-using Govor.Core.Repositories.Users;
+using Govor.Domain.Models.Users;
+using Govor.Domain.Repositories.Users;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
diff --git a/Govor.API.Tests/IntegrationTests/Controllers/AuthControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/AuthControllerTests.cs
index d216655..54f4953 100644
--- a/Govor.API.Tests/IntegrationTests/Controllers/AuthControllerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Controllers/AuthControllerTests.cs
@@ -1,12 +1,12 @@
using AutoFixture;
using Govor.API.Controllers.Authentication;
-using Govor.Application.Exceptions.AuthService;
+using Govor.Application.Authentication.Exceptions;
using Govor.Application.Exceptions.InvitesService;
using Govor.Application.Interfaces.Authentication;
using Govor.Application.Interfaces.UserSession;
using Govor.Contracts.Requests;
-using Govor.Core.Models;
-using Govor.Core.Models.Users;
+using Govor.Domain.Models;
+using Govor.Domain.Models.Users;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Moq;
diff --git a/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs
index bc5fb08..cfaf2bd 100644
--- a/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs
@@ -3,9 +3,10 @@ using AutoMapper;
using Govor.API.Controllers;
using Govor.Application.Interfaces;
using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.Messages;
using Govor.Contracts.Requests;
using Govor.Contracts.Responses;
-using Govor.Core.Models.Messages;
+using Govor.Domain.Models.Messages;
using Govor.Data.Repositories.Exceptions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
diff --git a/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs
index 1d2b6c1..2f9b8a1 100644
--- a/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs
@@ -4,7 +4,7 @@ using Govor.API.Controllers.Friends;
using Govor.Application.Interfaces.Friends;
using Govor.Application.Interfaces.Infrastructure.Extensions;
using Govor.Contracts.DTOs;
-using Govor.Core.Models;
+using Govor.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Moq;
diff --git a/Govor.API.Tests/IntegrationTests/Controllers/FriendshipControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/FriendshipControllerTests.cs
index 6d712fb..98eb09e 100644
--- a/Govor.API.Tests/IntegrationTests/Controllers/FriendshipControllerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Controllers/FriendshipControllerTests.cs
@@ -5,7 +5,7 @@ using Govor.Application.Exceptions.FriendsService;
using Govor.Application.Interfaces.Friends;
using Govor.Application.Interfaces.Infrastructure.Extensions;
using Govor.Contracts.DTOs;
-using Govor.Core.Models.Users;
+using Govor.Domain.Models.Users;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Moq;
diff --git a/Govor.API.Tests/IntegrationTests/Controllers/MediaControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/MediaControllerTests.cs
index 0cf8f7e..3e74058 100644
--- a/Govor.API.Tests/IntegrationTests/Controllers/MediaControllerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Controllers/MediaControllerTests.cs
@@ -4,7 +4,7 @@ using Govor.API.Controllers;
using Govor.Application.Interfaces.Infrastructure.Extensions;
using Govor.Application.Interfaces.Medias;
using Govor.Contracts.Requests;
-using Govor.Core.Models.Messages;
+using Govor.Domain.Models.Messages;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
diff --git a/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs
index 0133572..d99c066 100644
--- a/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs
@@ -1,6 +1,7 @@
using Govor.API.Controllers;
using Govor.Application.Interfaces;
using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.PingHandler;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Moq;
diff --git a/Govor.API.Tests/IntegrationTests/Controllers/ProfileControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/ProfileControllerTests.cs
index 1e73e2d..83653e8 100644
--- a/Govor.API.Tests/IntegrationTests/Controllers/ProfileControllerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Controllers/ProfileControllerTests.cs
@@ -8,8 +8,8 @@ using Govor.Application.Interfaces.Medias;
using Govor.Application.Profiles;
using Govor.Contracts.DTOs;
using Govor.Contracts.Requests;
-using Govor.Core.Models;
-using Govor.Core.Models.Messages;
+using Govor.Domain.Models;
+using Govor.Domain.Models.Messages;
using Govor.Data.Repositories.Exceptions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
diff --git a/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs b/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs
index e0ee94d..c5a2bd0 100644
--- a/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs
@@ -7,7 +7,7 @@ using Govor.Application.Interfaces.Friends;
using Govor.Application.Interfaces.Infrastructure.Extensions;
using Govor.Contracts.DTOs;
using Govor.Contracts.Responses.SignalR;
-using Govor.Core.Models;
+using Govor.Domain.Models;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using Moq;
diff --git a/Govor.API.Tests/IntegrationTests/Hubs/Infrastructure/PrivateChatGroupManagerTests.cs b/Govor.API.Tests/IntegrationTests/Hubs/Infrastructure/PrivateChatGroupManagerTests.cs
index bf931f4..57c69cc 100644
--- a/Govor.API.Tests/IntegrationTests/Hubs/Infrastructure/PrivateChatGroupManagerTests.cs
+++ b/Govor.API.Tests/IntegrationTests/Hubs/Infrastructure/PrivateChatGroupManagerTests.cs
@@ -1,7 +1,8 @@
using Govor.API.Hubs;
using Govor.API.Hubs.Infrastructure;
+using Govor.Application.Infrastructure.Extensions;
using Govor.Application.Interfaces;
-using Govor.Core.Models;
+using Govor.Domain.Models;
using Microsoft.AspNetCore.SignalR;
using Moq;
diff --git a/Govor.API.Tests/LocalStorageServiceTests.cs b/Govor.API.Tests/LocalStorageServiceTests.cs
index aff7ac8..f6be86e 100644
--- a/Govor.API.Tests/LocalStorageServiceTests.cs
+++ b/Govor.API.Tests/LocalStorageServiceTests.cs
@@ -1,6 +1,5 @@
using AutoFixture;
using Govor.Application.Interfaces;
-using Govor.Application.Services;
using Microsoft.AspNetCore.Hosting;
using Moq;
diff --git a/Govor.API.Tests/UnitTests/Infrastructure/Validators/ChatGroupValidatorTests.cs b/Govor.API.Tests/UnitTests/Infrastructure/Validators/ChatGroupValidatorTests.cs
index 42986c0..57a0afe 100644
--- a/Govor.API.Tests/UnitTests/Infrastructure/Validators/ChatGroupValidatorTests.cs
+++ b/Govor.API.Tests/UnitTests/Infrastructure/Validators/ChatGroupValidatorTests.cs
@@ -1,6 +1,6 @@
using AutoFixture;
-using Govor.Core.Infrastructure.Validators;
-using Govor.Core.Models;
+using Govor.Domain.Common.Constants;
+using Govor.Domain.Models;
namespace Govor.API.Tests.UnitTests.Infrastructure.Validators;
diff --git a/Govor.API.Tests/UnitTests/Infrastructure/Validators/FriendshipValidatorTests.cs b/Govor.API.Tests/UnitTests/Infrastructure/Validators/FriendshipValidatorTests.cs
index 2b49311..5d8bf0a 100644
--- a/Govor.API.Tests/UnitTests/Infrastructure/Validators/FriendshipValidatorTests.cs
+++ b/Govor.API.Tests/UnitTests/Infrastructure/Validators/FriendshipValidatorTests.cs
@@ -1,6 +1,6 @@
using AutoFixture;
-using Govor.Core.Infrastructure.Validators;
-using Govor.Core.Models;
+using Govor.Domain.Common.Constants;
+using Govor.Domain.Models;
namespace Govor.API.Tests.UnitTests.Infrastructure.Validators;
diff --git a/Govor.API.Tests/UnitTests/Infrastructure/Validators/InvitationValidatorTests.cs b/Govor.API.Tests/UnitTests/Infrastructure/Validators/InvitationConstantsTests.cs
similarity index 94%
rename from Govor.API.Tests/UnitTests/Infrastructure/Validators/InvitationValidatorTests.cs
rename to Govor.API.Tests/UnitTests/Infrastructure/Validators/InvitationConstantsTests.cs
index 38a7775..bb787f7 100644
--- a/Govor.API.Tests/UnitTests/Infrastructure/Validators/InvitationValidatorTests.cs
+++ b/Govor.API.Tests/UnitTests/Infrastructure/Validators/InvitationConstantsTests.cs
@@ -1,18 +1,18 @@
using AutoFixture;
-using Govor.Core.Infrastructure.Validators;
-using Govor.Core.Models;
+using Govor.Domain.Common.Constants;
+using Govor.Domain.Models;
namespace Govor.API.Tests.UnitTests.Infrastructure.Validators;
[TestFixture]
-public class InvitationValidatorTests
+public class InvitationConstantsTests
{
private IObjectValidator _messageValidator;
private Fixture _fixture;
- public InvitationValidatorTests()
+ public InvitationConstantsTests()
{
- _messageValidator = new InvitationValidator();
+ _messageValidator = new InvitationConstants();
_fixture = new Fixture();
diff --git a/Govor.API.Tests/UnitTests/Infrastructure/Validators/MessageValidatorTests.cs b/Govor.API.Tests/UnitTests/Infrastructure/Validators/MessageValidatorTests.cs
index 8472243..aa9fb94 100644
--- a/Govor.API.Tests/UnitTests/Infrastructure/Validators/MessageValidatorTests.cs
+++ b/Govor.API.Tests/UnitTests/Infrastructure/Validators/MessageValidatorTests.cs
@@ -1,7 +1,7 @@
using AutoFixture;
-using Govor.Core.Infrastructure.Validators;
-using Govor.Core.Models;
-using Govor.Core.Models.Messages;
+using Govor.Domain.Common.Constants;
+using Govor.Domain.Models;
+using Govor.Domain.Models.Messages;
namespace Govor.API.Tests.UnitTests.Infrastructure.Validators;
diff --git a/Govor.API.Tests/UnitTests/Infrastructure/Validators/PrivateChatValidatorTests.cs b/Govor.API.Tests/UnitTests/Infrastructure/Validators/PrivateChatValidatorTests.cs
index 43d54d1..f38c98e 100644
--- a/Govor.API.Tests/UnitTests/Infrastructure/Validators/PrivateChatValidatorTests.cs
+++ b/Govor.API.Tests/UnitTests/Infrastructure/Validators/PrivateChatValidatorTests.cs
@@ -1,6 +1,6 @@
using AutoFixture;
-using Govor.Core.Infrastructure.Validators;
-using Govor.Core.Models;
+using Govor.Domain.Common.Constants;
+using Govor.Domain.Models;
namespace Govor.API.Tests.UnitTests.Infrastructure.Validators;
diff --git a/Govor.API.Tests/UnitTests/Infrastructure/Validators/UserValidatorTests.cs b/Govor.API.Tests/UnitTests/Infrastructure/Validators/UserConstantsTests.cs
similarity index 96%
rename from Govor.API.Tests/UnitTests/Infrastructure/Validators/UserValidatorTests.cs
rename to Govor.API.Tests/UnitTests/Infrastructure/Validators/UserConstantsTests.cs
index c7d9162..487d1ec 100644
--- a/Govor.API.Tests/UnitTests/Infrastructure/Validators/UserValidatorTests.cs
+++ b/Govor.API.Tests/UnitTests/Infrastructure/Validators/UserConstantsTests.cs
@@ -1,12 +1,12 @@
using AutoFixture;
-using Govor.Core.Infrastructure.Validators;
-using Govor.Core.Models;
-using Govor.Core.Models.Users;
+using Govor.Domain.Common.Constants;
+using Govor.Domain.Models;
+using Govor.Domain.Models.Users;
namespace Govor.API.Tests.UnitTests.Infrastructure.Validators;
[TestFixture]
-public class UserValidatorTests
+public class UserConstantsTests
{
private IObjectValidator _userValidator;
private Fixture _fixture;
@@ -14,7 +14,7 @@ public class UserValidatorTests
[SetUp]
public void SetUp()
{
- _userValidator = new UserValidator();
+ _userValidator = new UserConstants();
_fixture = new Fixture();
diff --git a/Govor.API/Common/Extensions/AddOptionExtensions.cs b/Govor.API/Common/Extensions/AddOptionExtensions.cs
index 060de2b..b31b5cf 100644
--- a/Govor.API/Common/Extensions/AddOptionExtensions.cs
+++ b/Govor.API/Common/Extensions/AddOptionExtensions.cs
@@ -1,4 +1,4 @@
-using Govor.Application.Services.Authentication;
+using Govor.Application.Authentication.JWT;
namespace Govor.API.Common.Extensions;
diff --git a/Govor.API/Common/Extensions/ConfigurationProgramExtensions.cs b/Govor.API/Common/Extensions/ConfigurationProgramExtensions.cs
index 6de6259..f79650d 100644
--- a/Govor.API/Common/Extensions/ConfigurationProgramExtensions.cs
+++ b/Govor.API/Common/Extensions/ConfigurationProgramExtensions.cs
@@ -1,46 +1,27 @@
using Govor.API.Common.Mapping;
using Govor.API.Common.SignalR.Helpers;
using Govor.API.Hubs.Infrastructure;
+using Govor.Application.Authentication;
+using Govor.Application.Authentication.JWT;
+using Govor.Application.Friends;
+using Govor.Application.Groups;
using Govor.Application.Infrastructure.AdminsStuff;
using Govor.Application.Infrastructure.Extensions;
using Govor.Application.Infrastructure.Validators;
-using Govor.Application.Interfaces;
-using Govor.Application.Interfaces.Authentication;
-using Govor.Application.Interfaces.Friends;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
-using Govor.Application.Interfaces.Medias;
-using Govor.Application.Interfaces.Messages;
-using Govor.Application.Interfaces.PushNotifications;
-using Govor.Application.Interfaces.UserOnlineStatus;
-using Govor.Application.Interfaces.UserSession;
-using Govor.Application.Interfaces.UserSession.Crypto;
-using Govor.Application.Services;
-using Govor.Application.Services.Authentication;
-using Govor.Application.Services.Friends;
-using Govor.Application.Services.Medias;
-using Govor.Application.Services.Messages;
-using Govor.Application.Services.PushNotifications;
-using Govor.Application.Services.PushNotifications.Providers;
-using Govor.Application.Services.UserOnlineStatus;
-using Govor.Application.Services.UserSessions;
-using Govor.Application.Services.UserSessions.Crypto;
-using Govor.Core.Infrastructure.Extensions;
-using Govor.Core.Infrastructure.Validators;
-using Govor.Core.Models;
-using Govor.Core.Models.Messages;
-using Govor.Core.Models.Users;
-using Govor.Core.Repositories.Admins;
-using Govor.Core.Repositories.Friendships;
-using Govor.Core.Repositories.Groups;
-using Govor.Core.Repositories.Invaites;
-using Govor.Core.Repositories.MediasAttachments;
-using Govor.Core.Repositories.Messages;
-using Govor.Core.Repositories.PrivateChats;
-using Govor.Core.Repositories.PushTokens;
-using Govor.Core.Repositories.Users;
-using Govor.Core.Repositories.UserSessionsRepository;
-using Govor.Data;
-using Govor.Data.Repositories;
+using Govor.Application.Medias;
+using Govor.Application.Messages;
+using Govor.Application.PingHandler;
+using Govor.Application.PrivateUserChats;
+using Govor.Application.Profiles;
+using Govor.Application.PushNotifications;
+using Govor.Application.PushNotifications.Providers;
+using Govor.Application.Storage;
+using Govor.Application.Synching;
+using Govor.Application.Users;
+using Govor.Application.Users.UserOnlineStatus;
+using Govor.Application.Users.UserSessions;
+using Govor.Application.Users.UserSessions.Crypto;
+using Govor.Domain;
using Microsoft.EntityFrameworkCore;
namespace Govor.API.Common.Extensions;
@@ -56,6 +37,7 @@ public static class ConfigurationProgramExtensions
services.AddScoped();
services.AddScoped();
services.AddScoped();
+ services.AddScoped();
services.AddScoped();
services.AddScoped();
@@ -80,7 +62,10 @@ public static class ConfigurationProgramExtensions
services.AddScoped();
- services.AddScoped();
+ //services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
services.AddScoped();
services.AddScoped();
services.AddScoped();
@@ -88,6 +73,9 @@ public static class ConfigurationProgramExtensions
services.AddScoped();
services.AddScoped();
+ // User
+ services.AddScoped();
+
// UserSession
services.AddScoped();
services.AddScoped();
@@ -104,6 +92,7 @@ public static class ConfigurationProgramExtensions
services.AddSingleton();
// Pushs
+ services.AddScoped();
services.AddScoped();
services.AddSingleton();
@@ -122,34 +111,7 @@ public static class ConfigurationProgramExtensions
services.AddScoped();
}
-
- public static void AddRepositories(this IServiceCollection services)
- {
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- services.AddScoped();
- // other
- }
-
- public static void AddValidators(this IServiceCollection services)
- {
- services.AddScoped, UserValidator>();
- services.AddScoped, MessageValidator>();
- services.AddScoped, MediaAttachmentsValidator>();
- services.AddScoped, AdminValidator>();
- services.AddScoped, InvitationValidator>();
- services.AddScoped, FriendshipValidator>();
- services.AddScoped, PrivateChatValidator>();
- services.AddScoped, ChatGroupValidator>();
- }
-
+
public static void AddGovorDbContext(this IServiceCollection services, IConfiguration configuration)
{
var useMySql = configuration.GetValue("UseMySql");
diff --git a/Govor.API/Common/Mapping/MappingProfile.cs b/Govor.API/Common/Mapping/MappingProfile.cs
index 4ad619d..0921426 100644
--- a/Govor.API/Common/Mapping/MappingProfile.cs
+++ b/Govor.API/Common/Mapping/MappingProfile.cs
@@ -1,11 +1,10 @@
using AutoMapper;
-using Govor.API.Extensions.Mapping;
using Govor.Application.Profiles;
using Govor.Contracts.DTOs;
using Govor.Contracts.Responses;
-using Govor.Core.Models;
-using Govor.Core.Models.Messages;
-using Govor.Core.Models.Users;
+using Govor.Domain.Models;
+using Govor.Domain.Models.Messages;
+using Govor.Domain.Models.Users;
namespace Govor.API.Common.Mapping;
diff --git a/Govor.API/Common/Mapping/UserProfileToUserProfileDtoMappingAction.cs b/Govor.API/Common/Mapping/UserProfileToUserProfileDtoMappingAction.cs
index 2a7be87..01d57e1 100644
--- a/Govor.API/Common/Mapping/UserProfileToUserProfileDtoMappingAction.cs
+++ b/Govor.API/Common/Mapping/UserProfileToUserProfileDtoMappingAction.cs
@@ -1,8 +1,7 @@
using AutoMapper;
-using Govor.Application.Interfaces.UserOnlineStatus;
using Govor.Application.Profiles;
+using Govor.Application.Users.UserOnlineStatus;
using Govor.Contracts.DTOs;
-using Govor.Core.Models.Users;
namespace Govor.API.Common.Mapping;
diff --git a/Govor.API/Common/Mapping/UserToUserDtoMappingAction.cs b/Govor.API/Common/Mapping/UserToUserDtoMappingAction.cs
index c915fb3..c90ee9b 100644
--- a/Govor.API/Common/Mapping/UserToUserDtoMappingAction.cs
+++ b/Govor.API/Common/Mapping/UserToUserDtoMappingAction.cs
@@ -1,9 +1,9 @@
using AutoMapper;
-using Govor.Application.Interfaces.UserOnlineStatus;
+using Govor.Application.Users.UserOnlineStatus;
using Govor.Contracts.DTOs;
-using Govor.Core.Models.Users;
+using Govor.Domain.Models.Users;
-namespace Govor.API.Extensions.Mapping;
+namespace Govor.API.Common.Mapping;
public class UserToUserDtoMappingAction : IMappingAction
{
diff --git a/Govor.API/Controllers/AdminStuff/FriendshipsController.cs b/Govor.API/Controllers/AdminStuff/FriendshipsController.cs
index 94b5225..2a0e85b 100644
--- a/Govor.API/Controllers/AdminStuff/FriendshipsController.cs
+++ b/Govor.API/Controllers/AdminStuff/FriendshipsController.cs
@@ -1,8 +1,3 @@
-using Govor.Contracts.DTOs;
-using Govor.Core.Models;
-using Govor.Core.Models.Users;
-using Govor.Core.Repositories.Friendships;
-using Govor.Data.Repositories.Exceptions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -14,14 +9,8 @@ namespace Govor.API.Controllers.AdminStuff;
public class FriendshipsController : Controller
{
private readonly ILogger _logger;
- private readonly IFriendshipsRepository _friendshipsRepository;
- public FriendshipsController(ILogger logger, IFriendshipsRepository friendshipsRepository)
- {
- _logger = logger;
- _friendshipsRepository = friendshipsRepository;
- }
-
+ /*
[HttpGet]
public async Task Get()
{
@@ -88,5 +77,5 @@ public class FriendshipsController : Controller
_logger.LogError(ex, ex.Message);
return StatusCode(500, new { error = "Internal server error." });
}
- }
+ }*/
}
\ No newline at end of file
diff --git a/Govor.API/Controllers/AdminStuff/InviteUserController.cs b/Govor.API/Controllers/AdminStuff/InviteUserController.cs
index 204ae79..d55043f 100644
--- a/Govor.API/Controllers/AdminStuff/InviteUserController.cs
+++ b/Govor.API/Controllers/AdminStuff/InviteUserController.cs
@@ -1,8 +1,6 @@
-using Govor.Application.Interfaces;
+using Govor.Application.Infrastructure.AdminsStuff;
using Govor.Contracts.DTOs;
using Govor.Contracts.Requests;
-using Govor.Core.Repositories.Invaites;
-using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Govor.API.Controllers.AdminStuff;
@@ -12,17 +10,17 @@ namespace Govor.API.Controllers.AdminStuff;
//[Authorize(Roles = "Admin")]
public class InviteUserController : Controller
{
- private readonly IInvitesRepository _repository;
+ private readonly IInvitationGetter _invitationGetter;
private readonly IInvitationGenerator _invitationGenerator;
private readonly ILogger _logger;
public InviteUserController(IInvitationGenerator invitationGenerator,
- IInvitesRepository repository,
+ IInvitationGetter invitationGetter,
ILogger logger)
{
_invitationGenerator = invitationGenerator;
_logger = logger;
- _repository = repository;
+ _invitationGetter = invitationGetter;
}
[HttpPost("[action]")]
@@ -51,7 +49,7 @@ public class InviteUserController : Controller
{
_logger.LogInformation("Getting all active invitations by administrator");
- var read = await _repository.GetAllAsync();
+ var read = await _invitationGetter.GetAllAsync();
var result = read.Where(x => x.IsActive).ToList();
List dtos = new List();
@@ -86,7 +84,7 @@ public class InviteUserController : Controller
try
{
_logger.LogInformation("Getting all invitations by administrator");
- var read = await _repository.GetAllAsync();
+ var read = await _invitationGetter.GetAllAsync();
List dtos = new List();
@@ -120,18 +118,22 @@ public class InviteUserController : Controller
try
{
_logger.LogInformation("Getting invitations {id} by administrator");
- var read = await _repository.FindByIdAsync(id);
+ var read = await _invitationGetter.FindByIdAsync(id);
+
+ if(read.IsFailure)
+ return NotFound(read.Error);
+ var dto = read.Value;
var response = new InvitationResponses(){
- Id = read.Id,
- Description = read.Description,
- IsAdmin = read.IsAdmin,
- MaxParticipants = read.MaxParticipants,
- Code = read.Code,
- CreatedAt = read.DateCreated,
- EndAt = read.EndDate,
- IsActive = read.IsActive,
- ParticipantCount = read.Users.Count,
+ Id = dto.Id,
+ Description = dto.Description,
+ IsAdmin = dto.IsAdmin,
+ MaxParticipants = dto.MaxParticipants,
+ Code = dto.Code,
+ CreatedAt = dto.DateCreated,
+ EndAt = dto.EndDate,
+ IsActive = dto.IsActive,
+ ParticipantCount = dto.Users.Count,
};
return Ok(response);
diff --git a/Govor.API/Controllers/AdminStuff/UsersController.cs b/Govor.API/Controllers/AdminStuff/UsersController.cs
index 7440264..0a60b3d 100644
--- a/Govor.API/Controllers/AdminStuff/UsersController.cs
+++ b/Govor.API/Controllers/AdminStuff/UsersController.cs
@@ -1,10 +1,7 @@
-using Govor.Application.Interfaces;
+using Govor.Application.Infrastructure.AdminsStuff;
using Govor.Contracts.Responses.Admins;
-using Govor.Core.Infrastructure.Extensions;
-using Govor.Core.Models.Users;
-using Govor.Data.Repositories.Exceptions;
+using Govor.Domain.Models.Users;
using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
namespace Govor.API.Controllers.AdminStuff;
@@ -54,11 +51,6 @@ public class UsersController : Controller
var read = await _users.GetUserById(id);
return Ok(BuildUserDtos([read]).First());
}
- catch (NotFoundByKeyException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return NotFound(ex.Message);
- }
catch (Exception e)
{
_logger.LogError(e, e.Message);
diff --git a/Govor.API/Controllers/Authentication/AuthController.cs b/Govor.API/Controllers/Authentication/AuthController.cs
index 897803f..f1c7fa8 100644
--- a/Govor.API/Controllers/Authentication/AuthController.cs
+++ b/Govor.API/Controllers/Authentication/AuthController.cs
@@ -1,7 +1,6 @@
-using Govor.Application.Exceptions.AuthService;
-using Govor.Application.Exceptions.InvitesService;
-using Govor.Application.Interfaces.Authentication;
-using Govor.Application.Interfaces.UserSession;
+using Govor.Application.Authentication;
+using Govor.Application.Authentication.Exceptions;
+using Govor.Application.Users.UserSessions;
using Govor.Contracts.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -29,83 +28,84 @@ public class AuthController : Controller
_invitesService = invitesService;
_logger = logger;
}
-
- //[RequireHttps]
- [HttpPost("register")]// api/auth/register
+
+ [HttpPost("register")] // api/auth/register
public async Task Register([FromBody] RegistrationRequest registrationRequest)
{
- try
+
+ var inviteResult = await _invitesService.ValidateAsync(registrationRequest.InviteLink);
+ if (!inviteResult.IsSuccess)
{
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
+ _logger.LogWarning("Invite link invalid: {InviteLink}. Error: {Error}", registrationRequest.InviteLink,
+ inviteResult.Error);
+ return BadRequest($"Invite link invalid: {inviteResult.Error.Message}");
+ }
+
+ var userResult = await _accountService.RegistrationAsync(
+ registrationRequest.Name,
+ registrationRequest.Password,
+ inviteResult.Value);
- var invite = await _invitesService.ValidateAsync(registrationRequest.InviteLink);
+ if (userResult.IsFailure)
+ {
+ _logger.LogWarning("Registration failed for user {Name}. Error: {Error}", registrationRequest.Name,
+ userResult.Error);
+
+ return userResult.Error.Code switch
+ {
+ nameof(UserAlreadyExistException) => BadRequest($"Registration failed: {userResult.Error.Message}"),
+ nameof(InvalidUsernameException) => BadRequest($"Invalid username: {userResult.Error.Message}"),
+ _ => BadRequest($"Registration failed: {userResult.Error.Message}")
+ };
+ }
- var user = await _accountService.RegistrationAsync(registrationRequest.Name, registrationRequest.Password,
- invite);
-
- _logger.LogInformation($"Register request for {user.Username} with id {user.Id} processed successfully");
+ var user = userResult.Value;
+ _logger.LogInformation("Register request for {Username} with id {Id} processed successfully", user.Username,
+ user.Id);
+
+ var sessionResult = await _userSession.OpenSessionAsync(user, registrationRequest.DeviceInfo);
+ if (sessionResult.IsFailure)
+ {
+ _logger.LogError("Failed to open session for user {Username}. Error: {Error}", user.Username,
+ sessionResult.Error.Message);
+ return StatusCode(500, "An error occurred while creating the session.");
+ }
- var tokens = await _userSession.OpenSessionAsync(user, registrationRequest.DeviceInfo);
-
- _logger.LogInformation($"Session for user {user.Username} with id {user.Id} has been opened");
-
- return Ok(tokens);
- }
- catch (UserAlreadyExistException ex)
- {
- _logger.LogWarning(ex, $"Registration failed for user {registrationRequest.Name}");
- return BadRequest("Registration failed: user already exists.");
- }
- catch (InviteLinkInvalidException ex)
- {
- _logger.LogWarning(ex, $"Invite link invalid: {registrationRequest.InviteLink}");
- return BadRequest("Invite link invalid.");
- }
- catch (InvalidUsernameException ex)
- {
- _logger.LogWarning(ex, $"Invalid username: {registrationRequest.Name}");
- return BadRequest($"Invalid username: {ex.Message}");
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Unexpected error during registration for user {Name}", registrationRequest.Name);
- return StatusCode(500, "An unexpected error occurred. Please try again later.");
- }
+ _logger.LogInformation("Session for user {Username} with id {Id} has been opened", user.Username, user.Id);
+ return Ok(sessionResult.Value);
}
+
- //[RequireHttps]
- [HttpPost("login")]// api/auth/login
+ [HttpPost("login")] // api/auth/login
public async Task Login([FromBody] LoginRequest loginRequest)
{
- try
+ var userResult = await _accountService.LoginAsync(loginRequest.Name, loginRequest.Password);
+
+ if (userResult.IsFailure)
{
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- var user = await _accountService.LoginAsync(loginRequest.Name, loginRequest.Password);
- _logger.LogInformation($"Login request for {user.Username} with id {user.Id} processed successfully");
+ _logger.LogWarning("Login failed for user {Name}. Error: {Code}", loginRequest.Name, userResult.Error);
- var tokens = await _userSession.OpenSessionAsync(user, loginRequest.DeviceInfo);
-
- _logger.LogInformation($"Session for user {user.Username} with id {user.Id} has been opened");
-
- return Ok(tokens);
+ return userResult.Error.Code switch
+ {
+ nameof(UserNotRegisteredException) => BadRequest("Login failed: user does not exist."),
+ nameof(InvalidOperationException) => BadRequest("Login failed: username or password is incorrect."),
+ _ => BadRequest($"Login failed: {userResult.Error.Message}")
+ };
}
- catch (UserNotRegisteredException ex)
+
+ var user = userResult.Value;
+ _logger.LogInformation("Login request for {Username} with id {Id} processed successfully", user.Username, user.Id);
+
+ var sessionResult = await _userSession.OpenSessionAsync(user, loginRequest.DeviceInfo);
+
+ if (sessionResult.IsFailure)
{
- _logger.LogWarning(ex, "Login failed for user {Name}", loginRequest.Name);
- return BadRequest("Login failed: user does not exist.");
- }
- catch (LoginUserException ex)
- {
- _logger.LogWarning(ex, "Login failed for user {Name}", loginRequest.Name);
- return BadRequest("Login failed: username or password is incorrect.");
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Unexpected error during login for user {Name}", loginRequest.Name);
- return StatusCode(500, "An unexpected error occurred. Please try again later.");
+ _logger.LogError("Failed to open session for user {Username}. Error: {Error}", user.Username, sessionResult.Error);
+ return StatusCode(500, "An error occurred while creating the session.");
}
+
+ _logger.LogInformation("Session for user {Username} with id {Id} has been opened", user.Username, user.Id);
+
+ return Ok(sessionResult.Value);
}
}
\ No newline at end of file
diff --git a/Govor.API/Controllers/Authentication/RefreshController.cs b/Govor.API/Controllers/Authentication/RefreshController.cs
index ebf95c1..68e81fd 100644
--- a/Govor.API/Controllers/Authentication/RefreshController.cs
+++ b/Govor.API/Controllers/Authentication/RefreshController.cs
@@ -1,4 +1,4 @@
-using Govor.Application.Interfaces.UserSession;
+using Govor.Application.Users.UserSessions;
using Govor.Contracts.Requests;
using Govor.Contracts.Responses;
using Microsoft.AspNetCore.Authorization;
@@ -13,7 +13,7 @@ public class RefreshController : Controller
{
private readonly ILogger _logger;
private readonly IUserSessionRefresher _userSession;
-
+
public RefreshController(
ILogger logger,
IUserSessionRefresher userSession)
@@ -21,41 +21,35 @@ public class RefreshController : Controller
_logger = logger;
_userSession = userSession;
}
-
+
//[RequireHttps]
[HttpPost("refresh")] // api/auth/token/refresh
public async Task Refresh([FromBody] RefreshTokenRequest refreshRequest)
{
- try
+ if (string.IsNullOrWhiteSpace(refreshRequest.RefreshToken))
{
- if (!ModelState.IsValid)
- return BadRequest(ModelState);
-
- if (string.IsNullOrEmpty(refreshRequest.RefreshToken))
- throw new InvalidOperationException("Refresh token cant be empty.");
-
- var result = await _userSession.RefreshTokenAsync(refreshRequest.RefreshToken);
+ _logger.LogWarning("Refresh request failed: token is empty.");
+ return BadRequest("Refresh token can't be empty.");
+ }
+
+ var result = await _userSession.RefreshTokenAsync(refreshRequest.RefreshToken);
- return Ok(new RefreshTokenResponse()
- {
- AccessToken = result.accessToken,
- RefreshToken = result.refreshToken
- });
- }
- catch (InvalidOperationException ex)
+ if (result.IsFailure)
{
- _logger.LogWarning(ex, "Invalid refresh token.");
- return BadRequest(ex.Message);
+ _logger.LogWarning("Refresh token failed. Error Code: {Code}", result.Error.Code);
+
+ return result.Error.Code switch
+ {
+ "Auth.EmptyToken" => BadRequest(result.Error.Message),
+ "Auth.InvalidToken" => Unauthorized(result.Error.Message),
+ _ => BadRequest($"Refresh failed: {result.Error.Message}")
+ };
}
- catch (UnauthorizedAccessException ex)
+
+ return Ok(new RefreshTokenResponse
{
- _logger.LogWarning(ex, "Refresh token failed.");
- return Unauthorized("Invalid refresh token");
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, ex.Message);
- return StatusCode(500, "An unexpected error occurred.");
- }
+ AccessToken = result.Value.accessToken,
+ RefreshToken = result.Value.refreshToken
+ });
}
}
\ No newline at end of file
diff --git a/Govor.API/Controllers/Authentication/SessionKeysController.cs b/Govor.API/Controllers/Authentication/SessionKeysController.cs
index 77929ec..4f6558e 100644
--- a/Govor.API/Controllers/Authentication/SessionKeysController.cs
+++ b/Govor.API/Controllers/Authentication/SessionKeysController.cs
@@ -1,7 +1,6 @@
-using Govor.Application.Interfaces.Friends;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
-using Govor.Application.Interfaces.UserSession;
-using Govor.Application.Interfaces.UserSession.Crypto;
+using Govor.Application.Friends;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.Users.UserSessions.Crypto;
using Govor.Contracts.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Govor.API/Controllers/ChatLoadController.cs b/Govor.API/Controllers/ChatLoadController.cs
index e4be8b9..550a8ce 100644
--- a/Govor.API/Controllers/ChatLoadController.cs
+++ b/Govor.API/Controllers/ChatLoadController.cs
@@ -1,9 +1,8 @@
using AutoMapper;
-using Govor.Application.Interfaces;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.Messages;
using Govor.Contracts.Requests;
using Govor.Contracts.Responses;
-using Govor.Data.Repositories.Exceptions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -52,16 +51,6 @@ public class ChatLoadController : Controller
return Ok(response);
}
- catch (UnauthorizedAccessException ex)
- {
- _logger.LogWarning(ex.Message);
- return Forbid(ex.Message);
- }
- catch (NotFoundException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return BadRequest(ex.Message);
- }
catch (ArgumentException ex)
{
_logger.LogWarning(ex, ex.Message);
@@ -95,21 +84,6 @@ public class ChatLoadController : Controller
return Ok(response);
}
- catch (InvalidOperationException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return BadRequest(ex.Message);
- }
- catch (UnauthorizedAccessException ex)
- {
- _logger.LogWarning(ex.Message);
- return Forbid(ex.Message);
- }
- catch (NotFoundException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return BadRequest(ex.Message);
- }
catch (ArgumentException ex)
{
_logger.LogWarning(ex, ex.Message);
diff --git a/Govor.API/Controllers/Friends/FriendsRequestQueryController.cs b/Govor.API/Controllers/Friends/FriendsRequestQueryController.cs
index 542ee89..2d1d367 100644
--- a/Govor.API/Controllers/Friends/FriendsRequestQueryController.cs
+++ b/Govor.API/Controllers/Friends/FriendsRequestQueryController.cs
@@ -1,8 +1,7 @@
using AutoMapper;
-using Govor.Application.Interfaces.Friends;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.Friends;
+using Govor.Application.Infrastructure.Extensions;
using Govor.Contracts.DTOs;
-using Govor.Core.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -41,16 +40,6 @@ public class FriendsRequestQueryController : Controller
return Ok(response);
}
- catch (InvalidOperationException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return Ok(new List());
- }
- catch (UnauthorizedAccessException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return Forbid(ex.Message);
- }
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
@@ -72,16 +61,6 @@ public class FriendsRequestQueryController : Controller
return Ok(response);
}
- catch (InvalidOperationException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return Ok(new List());
- }
- catch (UnauthorizedAccessException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return Forbid(ex.Message);
- }
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
diff --git a/Govor.API/Controllers/Friends/FriendshipController.cs b/Govor.API/Controllers/Friends/FriendshipController.cs
index 25c0065..d375717 100644
--- a/Govor.API/Controllers/Friends/FriendshipController.cs
+++ b/Govor.API/Controllers/Friends/FriendshipController.cs
@@ -1,9 +1,7 @@
using AutoMapper;
-using Govor.Application.Exceptions.FriendsService;
-using Govor.Application.Interfaces.Friends;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.Friends;
+using Govor.Application.Infrastructure.Extensions;
using Govor.Contracts.DTOs;
-using Govor.Core.Models.Users;
using Microsoft.AspNetCore.Mvc;
namespace Govor.API.Controllers.Friends;
diff --git a/Govor.API/Controllers/InviteController.cs b/Govor.API/Controllers/InviteController.cs
index 26ff900..e7de645 100644
--- a/Govor.API/Controllers/InviteController.cs
+++ b/Govor.API/Controllers/InviteController.cs
@@ -1,5 +1,5 @@
-using Govor.Application.Interfaces;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.Groups;
+using Govor.Application.Infrastructure.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Govor.API/Controllers/MediaController.cs b/Govor.API/Controllers/MediaController.cs
index 6c0a870..d6ab259 100644
--- a/Govor.API/Controllers/MediaController.cs
+++ b/Govor.API/Controllers/MediaController.cs
@@ -1,7 +1,7 @@
-using Govor.Application.Interfaces.Infrastructure.Extensions;
-using Govor.Application.Interfaces.Medias;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.Medias;
using Govor.Contracts.Requests;
-using Govor.Core.Models;
+using Govor.Domain.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Govor.API/Controllers/OnlinePingingController.cs b/Govor.API/Controllers/OnlinePingingController.cs
index 0a58dfc..001ce34 100644
--- a/Govor.API/Controllers/OnlinePingingController.cs
+++ b/Govor.API/Controllers/OnlinePingingController.cs
@@ -1,6 +1,6 @@
-using Govor.Application.Interfaces;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
-using Govor.Application.Interfaces.UserOnlineStatus;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.PingHandler;
+using Govor.Application.Users.UserOnlineStatus;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -40,16 +40,6 @@ public class OnlinePingingController : Controller
_logger.LogInformation($"Ping from user {id} processed successfully");
return Ok();
}
- catch (InvalidOperationException e)
- {
- _logger.LogError(e, e.Message);
- return BadRequest("User can't be found in our database.");
- }
- catch (UnauthorizedAccessException e)
- {
- _logger.LogError(e, e.Message);
- return Forbid(e.Message);
- }
catch (Exception e)
{
_logger.LogError(e, e.Message);
diff --git a/Govor.API/Controllers/PrivateChatController.cs b/Govor.API/Controllers/PrivateChatController.cs
index 7efc26f..da3873f 100644
--- a/Govor.API/Controllers/PrivateChatController.cs
+++ b/Govor.API/Controllers/PrivateChatController.cs
@@ -1,10 +1,9 @@
-using Govor.Application.Interfaces;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.Exceptions.VerifyFriendship;
+using Govor.Application.Friends;
+using Govor.Application.Infrastructure.AdminsStuff;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.PrivateUserChats;
using Govor.Contracts.DTOs;
-using Govor.Core.Models;
-using Govor.Core.Repositories.PrivateChats;
-using Govor.Core.Repositories.Users;
-using Govor.Data.Repositories.Exceptions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -16,7 +15,6 @@ namespace Govor.API.Controllers;
public class PrivateChatController : Controller
{
private readonly ICurrentUserService _currentUser;
- private readonly IUsersRepository _usersRepository;
private readonly IVerifyFriendship _verifyFriendship;
private readonly IUserPrivateChatsCreator _userPrivateChatsCreator;
private readonly IUserPrivateChatsGetterService _privateChatsGetter;
@@ -24,15 +22,12 @@ public class PrivateChatController : Controller
public PrivateChatController(
ICurrentUserService currentUser,
- IUsersRepository usersRepository,
IVerifyFriendship verifyFriendship,
- IPrivateChatsRepository privateChats,
IUserPrivateChatsCreator userPrivateChatsCreator,
IUserPrivateChatsGetterService userPrivateChatsGetterService,
ILogger logger)
{
_currentUser = currentUser;
- _usersRepository = usersRepository;
_verifyFriendship = verifyFriendship;
_userPrivateChatsCreator = userPrivateChatsCreator;
_privateChatsGetter = userPrivateChatsGetterService;
@@ -46,14 +41,8 @@ public class PrivateChatController : Controller
{
var currentId = _currentUser.GetCurrentUserId();
- if (!await _usersRepository.ExistsByIdAsync(friendId))
- {
- _logger.LogWarning("User not exist {0}", friendId);
- return NotFound("User not exist.");
- }
-
await _verifyFriendship.VerifyAsync(currentId, friendId);
-
+
var chat = await _userPrivateChatsCreator.CreateAsync(currentId, friendId);
return Ok(chat.Id);
}
@@ -62,16 +51,16 @@ public class PrivateChatController : Controller
_logger.LogWarning(ex.Message);
return Forbid(ex.Message);
}
- catch (NotFoundException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return BadRequest(ex.Message);
- }
catch (ArgumentException ex)
{
_logger.LogWarning(ex, ex.Message);
return BadRequest(ex.Message);
}
+ catch (FriendshipException ex)
+ {
+ _logger.LogWarning(ex, ex.Message);
+ return Forbid(ex.Message);
+ }
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
diff --git a/Govor.API/Controllers/ProfileController.cs b/Govor.API/Controllers/ProfileController.cs
index a58f72e..0f45836 100644
--- a/Govor.API/Controllers/ProfileController.cs
+++ b/Govor.API/Controllers/ProfileController.cs
@@ -1,12 +1,11 @@
using AutoMapper;
using Govor.API.Hubs;
-using Govor.Application.Interfaces;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
-using Govor.Application.Interfaces.Medias;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.Medias;
+using Govor.Application.Profiles;
using Govor.Contracts.DTOs;
using Govor.Contracts.Requests;
-using Govor.Core.Models;
-using Govor.Data.Repositories.Exceptions;
+using Govor.Domain.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
@@ -91,8 +90,12 @@ public class ProfileController : ControllerBase
try
{
var userId = _currentUserService.GetCurrentUserId();
- var user = await _profileService.GetUserProfileAsync(userId);
+ var result = await _profileService.GetUserProfileAsync(userId);
+ if(result.IsFailure)
+ return NotFound(result.Error);
+
+ var user = result.Value;
var dto = _mapper.Map(user);
return Ok(dto);
}
@@ -101,11 +104,6 @@ public class ProfileController : ControllerBase
_logger.LogWarning(ex.Message);
return Forbid(ex.Message);
}
- catch (NotFoundException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return NotFound("Profile not found");
- }
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
@@ -128,11 +126,6 @@ public class ProfileController : ControllerBase
_logger.LogWarning(ex.Message);
return Forbid(ex.Message);
}
- catch (NotFoundException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return NotFound("Profile not found");
- }
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
diff --git a/Govor.API/Controllers/PushTokensController.cs b/Govor.API/Controllers/PushTokensController.cs
index 9577d29..2b53ae4 100644
--- a/Govor.API/Controllers/PushTokensController.cs
+++ b/Govor.API/Controllers/PushTokensController.cs
@@ -1,6 +1,6 @@
-using Govor.Application.Interfaces.Infrastructure.Extensions;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.PushNotifications;
using Govor.Contracts.Requests;
-using Govor.Core.Repositories.PushTokens;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -13,15 +13,15 @@ public class PushTokensController : Controller
{
private readonly ICurrentUserService _currentUser;
private readonly ICurrentUserSessionService _currentSession;
- private readonly IPushTokenRepository _pushTokenRepo;
+ private readonly IPushTokenService _pushTokenService;
public PushTokensController(
+ IPushTokenService pushTokenService,
ICurrentUserService currentUser,
- ICurrentUserSessionService currentSession,
- IPushTokenRepository pushTokenRepository)
+ ICurrentUserSessionService currentSession)
{
+ _pushTokenService = pushTokenService;
_currentUser = currentUser;
- _pushTokenRepo = pushTokenRepository;
_currentSession = currentSession;
}
@@ -39,7 +39,7 @@ public class PushTokensController : Controller
var currentId = _currentUser.GetCurrentUserId();
var currentSessionId = _currentSession.GetUserSessionId();
- await _pushTokenRepo.AddOrUpdateTokenAsync(
+ await _pushTokenService.AddOrUpdateTokenAsync(
userId: currentId,
sessionId: currentSessionId,
token: req.Token,
diff --git a/Govor.API/Controllers/SessionController.cs b/Govor.API/Controllers/SessionController.cs
index f68b91b..7aacee4 100644
--- a/Govor.API/Controllers/SessionController.cs
+++ b/Govor.API/Controllers/SessionController.cs
@@ -1,9 +1,7 @@
using AutoMapper;
-using Govor.Application.Interfaces.Infrastructure.Extensions;
-using Govor.Application.Interfaces.UserSession;
+using Govor.Application.Infrastructure.Extensions;
+using Govor.Application.Users.UserSessions;
using Govor.Contracts.DTOs;
-using Govor.Core.Repositories.PushTokens;
-using Govor.Data.Repositories.Exceptions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -43,7 +41,11 @@ public class SessionController : Controller
try
{
var sessions = await _userSessionReader.GetAllSessionsAsync(_currentUserService.GetCurrentUserId());
- return Ok(_mapper.Map>(sessions));
+
+ if(sessions.IsFailure)
+ return NotFound(sessions.Error);
+
+ return Ok(_mapper.Map>(sessions.Value));
}
catch (UnauthorizedAccessException ex)
{
@@ -65,8 +67,12 @@ public class SessionController : Controller
if (sessionId == Guid.Empty)
return BadRequest("Invalid sessionId.");
- await _userSessionRevoker.CloseSessionByIdAsync(sessionId,
+ var res = await _userSessionRevoker.CloseSessionByIdAsync(sessionId,
_currentUserService.GetCurrentUserId());
+
+ if (res.IsFailure)
+ return BadRequest(res.Error);
+
return Ok();
}
catch (InvalidOperationException ex)
@@ -79,11 +85,6 @@ public class SessionController : Controller
_logger.LogWarning(ex, ex.Message);
return Forbid(ex.Message);
}
- catch (NotFoundException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return NotFound(ex.Message);
- }
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
@@ -96,11 +97,14 @@ public class SessionController : Controller
{
try
{
- await _userSessionRevoker.CloseSessionByIdAsync(
+ var res = await _userSessionRevoker.CloseSessionByIdAsync(
_currentUserSessionService.GetUserSessionId(),
_currentUserService.GetCurrentUserId());
-
- return Ok();
+
+ if(res.IsFailure)
+ return NotFound(res.Error);
+
+ return Ok();
}
catch (InvalidOperationException ex)
{
@@ -112,11 +116,6 @@ public class SessionController : Controller
_logger.LogWarning(ex, ex.Message);
return Forbid(ex.Message);
}
- catch (NotFoundException ex)
- {
- _logger.LogWarning(ex, ex.Message);
- return NotFound(ex.Message);
- }
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
@@ -129,7 +128,11 @@ public class SessionController : Controller
{
try
{
- await _userSessionRevoker.CloseAllSessionsAsync(_currentUserService.GetCurrentUserId());
+ var res = await _userSessionRevoker.CloseAllSessionsAsync(_currentUserService.GetCurrentUserId());
+
+ if(res.IsFailure)
+ return NotFound(res.Error);
+
return Ok();
}
catch (UnauthorizedAccessException ex)
diff --git a/Govor.API/Filters/HubExceptionFilter.cs b/Govor.API/Filters/HubExceptionFilter.cs
index fa814fb..f11b6ef 100644
--- a/Govor.API/Filters/HubExceptionFilter.cs
+++ b/Govor.API/Filters/HubExceptionFilter.cs
@@ -70,7 +70,6 @@ public class HubExceptionFilter : IHubFilter
}
}
- // Ничего не возвращаем, если не поддерживается
return null;
}
}
\ No newline at end of file
diff --git a/Govor.API/Govor.API.csproj b/Govor.API/Govor.API.csproj
index 76f5525..c109986 100644
--- a/Govor.API/Govor.API.csproj
+++ b/Govor.API/Govor.API.csproj
@@ -24,10 +24,7 @@
-
-
-
-
+
diff --git a/Govor.API/Hubs/ChatsHub.cs b/Govor.API/Hubs/ChatsHub.cs
index e9136fa..02bb92c 100644
--- a/Govor.API/Hubs/ChatsHub.cs
+++ b/Govor.API/Hubs/ChatsHub.cs
@@ -1,11 +1,11 @@
using Govor.API.Common.SignalR.Helpers;
using Govor.API.Hubs.Infrastructure;
using Govor.Application.Exceptions.VerifyFriendship;
-using Govor.Application.Interfaces.Messages;
-using Govor.Application.Interfaces.Messages.Parameters;
+using Govor.Application.Messages;
+using Govor.Application.Messages.Parameters;
using Govor.Contracts.Requests.SignalR;
using Govor.Contracts.Responses.SignalR;
-using Govor.Core.Models.Messages;
+using Govor.Domain.Models.Messages;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;
@@ -15,20 +15,24 @@ namespace Govor.API.Hubs;
public class ChatsHub : Hub
{
private readonly ILogger _logger;
- private readonly IMessageCommandService _commandService;
+ private readonly IMessageSendingService _messageSendingService;
+ private readonly IMessageEditingService _messageEditingService;
+ private readonly IMessageRemovingService _messageRemovingService;
private readonly IHubUserAccessor _userAccessor;
private readonly IChatNotificationService _notifier;
private readonly IConnectionManager _connectionManager;
- public ChatsHub(
- ILogger logger,
- IMessageCommandService commandService,
+
+ public ChatsHub(ILogger logger,
+ IMessageSendingService messageSendingService,
+ IMessageEditingService messageEditingService,
IHubUserAccessor userAccessor,
IChatNotificationService notifier,
IConnectionManager connectionManager)
{
_logger = logger;
- _commandService = commandService;
+ _messageSendingService = messageSendingService;
+ _messageEditingService = messageEditingService;
_userAccessor = userAccessor;
_notifier = notifier;
_connectionManager = connectionManager;
@@ -69,7 +73,7 @@ public class ChatsHub : Hub
ValidateMessageRequest(request);
var sendParams = MapToSendMessage(request, userId);
- var result = await _commandService.SendMessageAsync(sendParams);
+ var result = await _messageSendingService.SendMessageAsync(sendParams);
if (!result.IsSuccess)
throw new InvalidOperationException(result.Exception.Message ?? "Failed to send message");
@@ -87,7 +91,7 @@ public class ChatsHub : Hub
{
return await SafeExecute(async (userId) =>
{
- var result = await _commandService.DeleteMessageAsync(new DeleteMessage(userId, request.MessageId));
+ var result = await _messageRemovingService.DeleteMessageAsync(new DeleteMessage(userId, request.MessageId));
if (!result.IsSuccess || result.OriginalMessage == null)
throw new InvalidOperationException("Message deletion failed");
@@ -112,7 +116,7 @@ public class ChatsHub : Hub
return await SafeExecute(async (userId) =>
{
var editParams = new EditMessage(userId, request.MessageId, request.NewEncryptedContent, DateTime.UtcNow);
- var result = await _commandService.EditMessageAsync(editParams);
+ var result = await _messageEditingService.EditMessageAsync(editParams);
if (!result.IsSuccess || result.OriginalMessage == null)
throw new InvalidOperationException("Edit message error");
diff --git a/Govor.API/Hubs/FriendsHub.cs b/Govor.API/Hubs/FriendsHub.cs
index 87b1a36..9871926 100644
--- a/Govor.API/Hubs/FriendsHub.cs
+++ b/Govor.API/Hubs/FriendsHub.cs
@@ -1,7 +1,7 @@
using AutoMapper;
using Govor.API.Common.SignalR.Helpers;
using Govor.Application.Exceptions.FriendsService;
-using Govor.Application.Interfaces.Friends;
+using Govor.Application.Friends;
using Govor.Contracts.DTOs;
using Govor.Contracts.Responses.SignalR;
using Microsoft.AspNetCore.SignalR;
@@ -76,7 +76,12 @@ public class FriendsHub : Hub
try
{
var userId = _userAccessor.GetUserId(Context);
- var friendship = await _friendRequestService.SendAsync(userId, targetUserId);
+ var result = await _friendRequestService.SendAsync(userId, targetUserId);
+
+ if(result.IsFailure)
+ return HubResult