From db61f1d8caf8367c7589a9cae1e1b4666495de1f Mon Sep 17 00:00:00 2001 From: John Brunton <1276413+jbrunton@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:30:25 -0400 Subject: [PATCH 1/2] chore: add .idea file --- .idea/.gitignore | 5 +++++ .idea/chat-demo.iml | 16 ++++++++++++++++ .idea/inspectionProfiles/Project_Default.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 5 files changed, 41 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/chat-demo.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..b58b603f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/chat-demo.iml b/.idea/chat-demo.iml new file mode 100644 index 00000000..9f9a3705 --- /dev/null +++ b/.idea/chat-demo.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..03d9549e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..9622b0d4 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 90ef5f89d76400341aece927d6399d6554033413 Mon Sep 17 00:00:00 2001 From: John Brunton <1276413+jbrunton@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:09:18 -0400 Subject: [PATCH 2/2] refactor: rename domain files --- .../api/src/app/auth/auth0/identify.decorator.ts | 2 +- .../api/src/app/auth/auth0/identify.service.ts | 4 ++-- services/api/src/app/auth/auth0/jwt.strategy.ts | 2 +- services/api/src/app/auth/casl.auth.service.ts | 2 +- .../api/src/app/auth/permissions/roles.spec.ts | 4 ++-- services/api/src/app/auth/permissions/roles.ts | 6 +++--- .../api/src/app/dispatcher/dispatcher.service.ts | 6 +++--- services/api/src/app/messages/command.service.ts | 4 ++-- .../src/app/messages/messages.controller.spec.ts | 12 ++++++------ .../api/src/app/messages/messages.controller.ts | 2 +- .../api/src/app/messages/messages.service.spec.ts | 6 +++--- services/api/src/app/messages/messages.service.ts | 4 ++-- services/api/src/app/rooms/rooms.controller.ts | 2 +- services/api/src/app/users/users.controller.ts | 2 +- services/api/src/app/users/users.service.ts | 14 +++++++------- services/api/src/data/adapters/dynamodb/schema.ts | 4 ++-- services/api/src/data/data.module.ts | 8 ++++---- .../dynamodb.memberships.repository.e2e-spec.ts | 4 ++-- .../dynamodb.rooms.repository.e2e-spec.ts | 4 ++-- .../dynamodb.users.repository.e2e-spec.ts | 2 +- .../dynamodb/dynamodb.memberships.repository.ts | 4 ++-- .../dynamodb/dynamodb.messages.repository.ts | 2 +- .../dynamodb/dynamodb.rooms.repository.ts | 4 ++-- .../dynamodb/dynamodb.users.repository.ts | 4 ++-- .../test/test.memberships.repository.ts | 4 ++-- .../repositories/test/test.messages.repository.ts | 2 +- .../repositories/test/test.rooms.repository.ts | 4 ++-- .../repositories/test/test.users.repository.ts | 4 ++-- services/api/src/domain/entities/auth.ts | 12 ++++++------ .../entities/{command.entity.ts => command.ts} | 0 .../membership.ts} | 0 .../memberships-repository.ts} | 2 +- .../api/src/domain/entities/messages/message.ts | 2 +- ...ssages.repository.ts => messages-repository.ts} | 0 .../entities/{room.entity.ts => rooms/room.ts} | 0 .../rooms-repository.ts} | 2 +- .../entities/users/{system.ts => system-user.ts} | 2 +- .../entities/users/{user.entity.ts => user.ts} | 0 .../{users.repository.ts => users-repository.ts} | 2 +- services/api/src/domain/usecases/auth.service.ts | 4 ++-- .../api/src/domain/usecases/commands/help.spec.ts | 2 +- services/api/src/domain/usecases/commands/help.ts | 2 +- .../api/src/domain/usecases/commands/lorem.spec.ts | 2 +- services/api/src/domain/usecases/commands/lorem.ts | 2 +- .../usecases/commands/parse/command.parser.ts | 4 ++-- .../src/domain/usecases/commands/parse/index.ts | 2 +- .../domain/usecases/commands/parse/parse.spec.ts | 4 ++-- .../parsers/set-room-content-policy-parser.ts | 2 +- .../parse/parsers/set-room-join-policy-parser.ts | 2 +- .../usecases/memberships/approve-request.spec.ts | 4 ++-- .../domain/usecases/memberships/approve-request.ts | 10 +++++----- .../src/domain/usecases/memberships/invite.spec.ts | 4 ++-- .../api/src/domain/usecases/memberships/invite.ts | 10 +++++----- .../src/domain/usecases/memberships/join.spec.ts | 2 +- .../api/src/domain/usecases/memberships/join.ts | 10 +++++----- .../src/domain/usecases/memberships/leave.spec.ts | 4 ++-- .../api/src/domain/usecases/memberships/leave.ts | 8 ++++---- .../src/domain/usecases/messages/get-messages.ts | 6 +++--- .../src/domain/usecases/messages/parse-message.ts | 2 +- services/api/src/domain/usecases/messages/send.ts | 4 ++-- .../api/src/domain/usecases/rooms/about-room.ts | 6 +++--- .../domain/usecases/rooms/configure-room.spec.ts | 2 +- .../src/domain/usecases/rooms/configure-room.ts | 6 +++--- .../api/src/domain/usecases/rooms/create.spec.ts | 2 +- services/api/src/domain/usecases/rooms/create.ts | 10 +++++----- services/api/src/domain/usecases/rooms/get.spec.ts | 2 +- services/api/src/domain/usecases/rooms/get.ts | 10 +++++----- services/api/src/domain/usecases/rooms/rename.ts | 4 ++-- services/api/src/domain/usecases/users/rename.ts | 4 ++-- services/api/src/fixtures/auth/FakeAuth.ts | 4 ++-- services/api/src/fixtures/data/test.data.module.ts | 8 ++++---- services/api/src/fixtures/messages/room.factory.ts | 2 +- services/api/src/fixtures/messages/user.factory.ts | 2 +- 73 files changed, 148 insertions(+), 148 deletions(-) rename services/api/src/domain/entities/{command.entity.ts => command.ts} (100%) rename services/api/src/domain/entities/{membership.entity.ts => memberships/membership.ts} (100%) rename services/api/src/domain/entities/{memberships.repository.ts => memberships/memberships-repository.ts} (83%) rename services/api/src/domain/entities/messages/{messages.repository.ts => messages-repository.ts} (100%) rename services/api/src/domain/entities/{room.entity.ts => rooms/room.ts} (100%) rename services/api/src/domain/entities/{rooms.repository.ts => rooms/rooms-repository.ts} (90%) rename services/api/src/domain/entities/users/{system.ts => system-user.ts} (92%) rename services/api/src/domain/entities/users/{user.entity.ts => user.ts} (100%) rename services/api/src/domain/entities/users/{users.repository.ts => users-repository.ts} (95%) diff --git a/services/api/src/app/auth/auth0/identify.decorator.ts b/services/api/src/app/auth/auth0/identify.decorator.ts index 88fc041c..072e4f68 100644 --- a/services/api/src/app/auth/auth0/identify.decorator.ts +++ b/services/api/src/app/auth/auth0/identify.decorator.ts @@ -1,5 +1,5 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; export const Identify = createParamDecorator( async (_data: unknown, ctx: ExecutionContext): Promise => { diff --git a/services/api/src/app/auth/auth0/identify.service.ts b/services/api/src/app/auth/auth0/identify.service.ts index 3d8271d6..60aa8250 100644 --- a/services/api/src/app/auth/auth0/identify.service.ts +++ b/services/api/src/app/auth/auth0/identify.service.ts @@ -1,4 +1,4 @@ -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { ConsoleLogger, Injectable, @@ -11,7 +11,7 @@ import { Auth0Client } from '../auth0/auth0.client'; import { UsersRepository, userParamsFromAuth, -} from '@entities/users/users.repository'; +} from '@entities/users/users-repository'; const extractAccessToken = ExtractJwt.fromAuthHeaderAsBearerToken(); diff --git a/services/api/src/app/auth/auth0/jwt.strategy.ts b/services/api/src/app/auth/auth0/jwt.strategy.ts index b9edad5d..09ca0d49 100644 --- a/services/api/src/app/auth/auth0/jwt.strategy.ts +++ b/services/api/src/app/auth/auth0/jwt.strategy.ts @@ -4,7 +4,7 @@ import { ExtractJwt, Strategy } from 'passport-jwt'; import { passportJwtSecret } from 'jwks-rsa'; import { config } from './auth0.config'; import { Request } from 'express'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { IdentifyService } from './identify.service'; @Injectable() diff --git a/services/api/src/app/auth/casl.auth.service.ts b/services/api/src/app/auth/casl.auth.service.ts index 5e4d8f58..09f885fa 100644 --- a/services/api/src/app/auth/casl.auth.service.ts +++ b/services/api/src/app/auth/casl.auth.service.ts @@ -1,5 +1,5 @@ import { AuthorizeParams, AuthService } from '@usecases/auth.service'; -import { MembershipsRepository } from '@entities/memberships.repository'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; import { ConsoleLogger, Injectable } from '@nestjs/common'; import { defineRolesForUser } from './permissions/roles'; diff --git a/services/api/src/app/auth/permissions/roles.spec.ts b/services/api/src/app/auth/permissions/roles.spec.ts index d52db0e9..30728ca5 100644 --- a/services/api/src/app/auth/permissions/roles.spec.ts +++ b/services/api/src/app/auth/permissions/roles.spec.ts @@ -1,5 +1,5 @@ -import { Membership, MembershipStatus } from '@entities/membership.entity'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; +import { Membership, MembershipStatus } from '@entities/memberships/membership'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { defineRolesForUser } from './roles'; diff --git a/services/api/src/app/auth/permissions/roles.ts b/services/api/src/app/auth/permissions/roles.ts index 3d31bf53..132735ad 100644 --- a/services/api/src/app/auth/permissions/roles.ts +++ b/services/api/src/app/auth/permissions/roles.ts @@ -3,9 +3,9 @@ import { Membership, MembershipStatus, getRoomsWithStatus, -} from '@entities/membership.entity'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; -import { User } from '@entities/users/user.entity'; +} from '@entities/memberships/membership'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; +import { User } from '@entities/users/user'; import { Role } from '@usecases/auth.service'; export const defineRolesForUser = (user: User, memberships: Membership[]) => { diff --git a/services/api/src/app/dispatcher/dispatcher.service.ts b/services/api/src/app/dispatcher/dispatcher.service.ts index c85fbbfe..6cb6c290 100644 --- a/services/api/src/app/dispatcher/dispatcher.service.ts +++ b/services/api/src/app/dispatcher/dispatcher.service.ts @@ -3,9 +3,9 @@ import { DraftMessage, isPrivate, } from '@entities/messages/message'; -import { MessagesRepository } from '@entities/messages/messages.repository'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { MessagesRepository } from '@entities/messages/messages-repository'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { ConsoleLogger, Injectable } from '@nestjs/common'; import { AuthService, Role } from '@usecases/auth.service'; import { fromEvent, merge, Observable } from 'rxjs'; diff --git a/services/api/src/app/messages/command.service.ts b/services/api/src/app/messages/command.service.ts index 6aa009dc..e977ec6f 100644 --- a/services/api/src/app/messages/command.service.ts +++ b/services/api/src/app/messages/command.service.ts @@ -1,5 +1,5 @@ -import { Command } from '@entities/command.entity'; -import { User } from '@entities/users/user.entity'; +import { Command } from '@entities/command'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; import { HelpCommandUseCase } from '@usecases/commands/help'; import { RenameRoomUseCase } from '@usecases/rooms/rename'; diff --git a/services/api/src/app/messages/messages.controller.spec.ts b/services/api/src/app/messages/messages.controller.spec.ts index d35d34bc..927cdd1d 100644 --- a/services/api/src/app/messages/messages.controller.spec.ts +++ b/services/api/src/app/messages/messages.controller.spec.ts @@ -9,18 +9,18 @@ import { resetFakeAuthUsers, } from '@fixtures/auth/FakeAuth'; import { MessageFactory } from '@fixtures/messages/message.factory'; -import { UsersRepository } from '@entities/users/users.repository'; -import { MessagesRepository } from '@entities/messages/messages.repository'; +import { UsersRepository } from '@entities/users/users-repository'; +import { MessagesRepository } from '@entities/messages/messages-repository'; import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; import { TestMessagesRepository } from '@data/repositories/test/test.messages.repository'; -import { Room } from '@entities/room.entity'; -import { RoomsRepository } from '@entities/rooms.repository'; +import { Room } from '@entities/rooms/room'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { CreateMessageDto } from './dto/messages'; import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; -import { MembershipsRepository } from '@entities/memberships.repository'; -import { MembershipStatus } from '@entities/membership.entity'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; +import { MembershipStatus } from '@entities/memberships/membership'; import { MessagesModule } from './messages.module'; import { Auth0Client } from '@app/auth/auth0/auth0.client'; import { MockLoggerModule } from '@fixtures/MockLoggerModule'; diff --git a/services/api/src/app/messages/messages.controller.ts b/services/api/src/app/messages/messages.controller.ts index 3d2d340a..9263c86a 100644 --- a/services/api/src/app/messages/messages.controller.ts +++ b/services/api/src/app/messages/messages.controller.ts @@ -3,7 +3,7 @@ import { MessagesService } from './messages.service'; import { CreateMessageDto, SentMessageDto } from './dto/messages'; import { Auth } from '@app/auth/auth.decorator'; import { Identify } from '@app/auth/auth0/identify.decorator'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { Dispatcher } from '@entities/messages/message'; import { GetMessagesUseCase } from '@usecases/messages/get-messages'; import { ApiBearerAuth, ApiOperation, ApiResponse } from '@nestjs/swagger'; diff --git a/services/api/src/app/messages/messages.service.spec.ts b/services/api/src/app/messages/messages.service.spec.ts index 202cc1ad..e43373d8 100644 --- a/services/api/src/app/messages/messages.service.spec.ts +++ b/services/api/src/app/messages/messages.service.spec.ts @@ -2,13 +2,13 @@ import { MessagesService } from './messages.service'; import { CreateMessageDto } from './dto/messages'; import { UserFactory } from '@fixtures/messages/user.factory'; import { RoomFactory } from '@fixtures/messages/room.factory'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { mock, MockProxy } from 'jest-mock-extended'; import { SendMessageUseCase } from '@usecases/messages/send'; import { CommandService } from './command.service'; -import { Command } from '@entities/command.entity'; +import { Command } from '@entities/command'; import { UnauthorizedException } from '@nestjs/common'; -import { systemUser } from '@entities/users/system'; +import { systemUser } from '@entities/users/system-user'; describe('MessagesService', () => { let service: MessagesService; diff --git a/services/api/src/app/messages/messages.service.ts b/services/api/src/app/messages/messages.service.ts index c77cab28..6d0b4b80 100644 --- a/services/api/src/app/messages/messages.service.ts +++ b/services/api/src/app/messages/messages.service.ts @@ -3,8 +3,8 @@ import { CreateMessageDto } from './dto/messages'; import { SendMessageUseCase } from '@usecases/messages/send'; import { CommandService } from '@app/messages/command.service'; import { isCommand, parseMessage } from '@usecases/messages/parse-message'; -import { systemUser } from '@entities/users/system'; -import { User } from '@entities/users/user.entity'; +import { systemUser } from '@entities/users/system-user'; +import { User } from '@entities/users/user'; @Injectable() export class MessagesService { diff --git a/services/api/src/app/rooms/rooms.controller.ts b/services/api/src/app/rooms/rooms.controller.ts index ac6415b5..c92d9706 100644 --- a/services/api/src/app/rooms/rooms.controller.ts +++ b/services/api/src/app/rooms/rooms.controller.ts @@ -1,7 +1,7 @@ import { Auth } from '@app/auth/auth.decorator'; import { Identify } from '@app/auth/auth0/identify.decorator'; import { ConsoleLogger, Controller, Get, Param, Post } from '@nestjs/common'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { CreateRoomUseCase } from '@usecases/rooms/create'; import { GetRoomUseCase } from '@usecases/rooms/get'; import { JoinRoomUseCase } from '@usecases/memberships/join'; diff --git a/services/api/src/app/users/users.controller.ts b/services/api/src/app/users/users.controller.ts index 5c68fd02..fa5c26d2 100644 --- a/services/api/src/app/users/users.controller.ts +++ b/services/api/src/app/users/users.controller.ts @@ -1,6 +1,6 @@ import { Auth } from '@app/auth/auth.decorator'; import { Identify } from '@app/auth/auth0/identify.decorator'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { Controller, Get, Param } from '@nestjs/common'; import { UsersService } from './users.service'; diff --git a/services/api/src/app/users/users.service.ts b/services/api/src/app/users/users.service.ts index b6ec46c3..2f0fdcb9 100644 --- a/services/api/src/app/users/users.service.ts +++ b/services/api/src/app/users/users.service.ts @@ -1,10 +1,10 @@ -import { getActiveRooms } from '@entities/membership.entity'; -import { MembershipsRepository } from '@entities/memberships.repository'; -import { Room } from '@entities/room.entity'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { systemUser } from '@entities/users/system'; -import { User } from '@entities/users/user.entity'; -import { UsersRepository } from '@entities/users/users.repository'; +import { getActiveRooms } from '@entities/memberships/membership'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; +import { Room } from '@entities/rooms/room'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { systemUser } from '@entities/users/system-user'; +import { User } from '@entities/users/user'; +import { UsersRepository } from '@entities/users/users-repository'; import { Injectable } from '@nestjs/common'; @Injectable() diff --git a/services/api/src/data/adapters/dynamodb/schema.ts b/services/api/src/data/adapters/dynamodb/schema.ts index 35af9673..9d55bcdd 100644 --- a/services/api/src/data/adapters/dynamodb/schema.ts +++ b/services/api/src/data/adapters/dynamodb/schema.ts @@ -1,5 +1,5 @@ -import { MembershipStatus } from '@entities/membership.entity'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; +import { MembershipStatus } from '@entities/memberships/membership'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; import { Entity } from 'dynamodb-onetable'; export const DbSchema = { diff --git a/services/api/src/data/data.module.ts b/services/api/src/data/data.module.ts index 403318d8..b3119b0f 100644 --- a/services/api/src/data/data.module.ts +++ b/services/api/src/data/data.module.ts @@ -2,14 +2,14 @@ import { Global, Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; import databaseConfig from '@config/database.config'; import { DynamoDBMessagesRepository } from './repositories/dynamodb/dynamodb.messages.repository'; -import { RoomsRepository } from '@entities/rooms.repository'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; import { DynamoDBUsersRepository } from './repositories/dynamodb/dynamodb.users.repository'; import { DynamoDBAdapter } from './adapters/dynamodb/dynamodb.adapter'; import { DynamoDBRoomsRepository } from './repositories/dynamodb/dynamodb.rooms.repository'; -import { MembershipsRepository } from '@entities/memberships.repository'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; import { DynamoDBMembershipsRepository } from './repositories/dynamodb/dynamodb.memberships.repository'; -import { MessagesRepository } from '@entities/messages/messages.repository'; -import { UsersRepository } from '@entities/users/users.repository'; +import { MessagesRepository } from '@entities/messages/messages-repository'; +import { UsersRepository } from '@entities/users/users-repository'; export const DatabaseConfigModule = ConfigModule.forFeature(databaseConfig); diff --git a/services/api/src/data/repositories/dynamodb.memberships.repository.e2e-spec.ts b/services/api/src/data/repositories/dynamodb.memberships.repository.e2e-spec.ts index f23155d3..6f2af079 100644 --- a/services/api/src/data/repositories/dynamodb.memberships.repository.e2e-spec.ts +++ b/services/api/src/data/repositories/dynamodb.memberships.repository.e2e-spec.ts @@ -1,5 +1,5 @@ -import { MembershipStatus } from '@entities/membership.entity'; -import { CreateMembershipParams } from '@entities/memberships.repository'; +import { MembershipStatus } from '@entities/memberships/membership'; +import { CreateMembershipParams } from '@entities/memberships/memberships-repository'; import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; diff --git a/services/api/src/data/repositories/dynamodb.rooms.repository.e2e-spec.ts b/services/api/src/data/repositories/dynamodb.rooms.repository.e2e-spec.ts index 65e950e4..ead3ffca 100644 --- a/services/api/src/data/repositories/dynamodb.rooms.repository.e2e-spec.ts +++ b/services/api/src/data/repositories/dynamodb.rooms.repository.e2e-spec.ts @@ -1,6 +1,6 @@ import { DynamoDBRoomsRepository } from '@data/repositories/dynamodb/dynamodb.rooms.repository'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; -import { CreateRoomParams } from '@entities/rooms.repository'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; +import { CreateRoomParams } from '@entities/rooms/rooms-repository'; import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { Test } from '@nestjs/testing'; import { DataModule } from '../data.module'; diff --git a/services/api/src/data/repositories/dynamodb.users.repository.e2e-spec.ts b/services/api/src/data/repositories/dynamodb.users.repository.e2e-spec.ts index 53d89f05..363539b6 100644 --- a/services/api/src/data/repositories/dynamodb.users.repository.e2e-spec.ts +++ b/services/api/src/data/repositories/dynamodb.users.repository.e2e-spec.ts @@ -5,7 +5,7 @@ import { DataModule } from '../data.module'; import { MockLoggerModule } from '@fixtures/MockLoggerModule'; import { AuthInfoFactory } from '@fixtures/auth/auth-info.factory'; import { omit } from 'remeda'; -import { userParamsFromAuth } from '@entities/users/users.repository'; +import { userParamsFromAuth } from '@entities/users/users-repository'; type TestCase = { name: 'DynamoDBUsersRepository' | 'TestUsersRepository'; diff --git a/services/api/src/data/repositories/dynamodb/dynamodb.memberships.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.memberships.repository.ts index f76f4c8d..a1a351e4 100644 --- a/services/api/src/data/repositories/dynamodb/dynamodb.memberships.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.memberships.repository.ts @@ -1,8 +1,8 @@ -import { Membership } from '@entities/membership.entity'; +import { Membership } from '@entities/memberships/membership'; import { CreateMembershipParams, MembershipsRepository, -} from '@entities/memberships.repository'; +} from '@entities/memberships/memberships-repository'; import { Injectable } from '@nestjs/common'; import { pick } from 'rambda'; import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter'; diff --git a/services/api/src/data/repositories/dynamodb/dynamodb.messages.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.messages.repository.ts index d363d4f9..bf2b2bf2 100644 --- a/services/api/src/data/repositories/dynamodb/dynamodb.messages.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.messages.repository.ts @@ -3,7 +3,7 @@ import { pick } from 'rambda'; import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter'; import { DbMessage } from '../../adapters/dynamodb/schema'; import { DraftMessage, SentMessage } from '@entities/messages/message'; -import { MessagesRepository } from '@entities/messages/messages.repository'; +import { MessagesRepository } from '@entities/messages/messages-repository'; @Injectable() export class DynamoDBMessagesRepository extends MessagesRepository { diff --git a/services/api/src/data/repositories/dynamodb/dynamodb.rooms.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.rooms.repository.ts index 37fcc0cc..db0dc5e9 100644 --- a/services/api/src/data/repositories/dynamodb/dynamodb.rooms.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.rooms.repository.ts @@ -1,10 +1,10 @@ import { subject } from '@casl/ability'; -import { Room } from '@entities/room.entity'; +import { Room } from '@entities/rooms/room'; import { CreateRoomParams, RoomsRepository, UpdateRoomParams, -} from '@entities/rooms.repository'; +} from '@entities/rooms/rooms-repository'; import { Injectable, NotFoundException } from '@nestjs/common'; import { pick } from 'rambda'; import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter'; diff --git a/services/api/src/data/repositories/dynamodb/dynamodb.users.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.users.repository.ts index 193908fb..73f793c8 100644 --- a/services/api/src/data/repositories/dynamodb/dynamodb.users.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.users.repository.ts @@ -6,8 +6,8 @@ import { UsersRepository, SaveUserParams, UpdateUserParams, -} from '@entities/users/users.repository'; -import { User } from '@entities/users/user.entity'; +} from '@entities/users/users-repository'; +import { User } from '@entities/users/user'; @Injectable() export class DynamoDBUsersRepository extends UsersRepository { diff --git a/services/api/src/data/repositories/test/test.memberships.repository.ts b/services/api/src/data/repositories/test/test.memberships.repository.ts index fe9cdae6..a8ae3132 100644 --- a/services/api/src/data/repositories/test/test.memberships.repository.ts +++ b/services/api/src/data/repositories/test/test.memberships.repository.ts @@ -1,8 +1,8 @@ import { CreateMembershipParams, MembershipsRepository, -} from '@entities/memberships.repository'; -import { Membership } from '@entities/membership.entity'; +} from '@entities/memberships/memberships-repository'; +import { Membership } from '@entities/memberships/membership'; export class TestMembershipsRepository extends MembershipsRepository { private memberships: Membership[] = []; diff --git a/services/api/src/data/repositories/test/test.messages.repository.ts b/services/api/src/data/repositories/test/test.messages.repository.ts index 42a65e8a..3fd81646 100644 --- a/services/api/src/data/repositories/test/test.messages.repository.ts +++ b/services/api/src/data/repositories/test/test.messages.repository.ts @@ -1,5 +1,5 @@ import { SentMessage, DraftMessage } from '@entities/messages/message'; -import { MessagesRepository } from '@entities/messages/messages.repository'; +import { MessagesRepository } from '@entities/messages/messages-repository'; import * as R from 'rambda'; export class TestMessagesRepository extends MessagesRepository { diff --git a/services/api/src/data/repositories/test/test.rooms.repository.ts b/services/api/src/data/repositories/test/test.rooms.repository.ts index 3b48198a..9abe5c94 100644 --- a/services/api/src/data/repositories/test/test.rooms.repository.ts +++ b/services/api/src/data/repositories/test/test.rooms.repository.ts @@ -4,8 +4,8 @@ import { CreateRoomParams, RoomsRepository, UpdateRoomParams, -} from '@entities/rooms.repository'; -import { Room } from '@entities/room.entity'; +} from '@entities/rooms/rooms-repository'; +import { Room } from '@entities/rooms/room'; import { faker } from '@faker-js/faker'; import { subject } from '@casl/ability'; diff --git a/services/api/src/data/repositories/test/test.users.repository.ts b/services/api/src/data/repositories/test/test.users.repository.ts index f82bac46..ca3dc05b 100644 --- a/services/api/src/data/repositories/test/test.users.repository.ts +++ b/services/api/src/data/repositories/test/test.users.repository.ts @@ -4,8 +4,8 @@ import { NotFoundException } from '@nestjs/common'; import { UsersRepository, UpdateUserParams, -} from '@entities/users/users.repository'; -import { User } from '@entities/users/user.entity'; +} from '@entities/users/users-repository'; +import { User } from '@entities/users/user'; export class TestUsersRepository extends UsersRepository { private users: User[] = []; diff --git a/services/api/src/domain/entities/auth.ts b/services/api/src/domain/entities/auth.ts index c972ef64..b467d3d2 100644 --- a/services/api/src/domain/entities/auth.ts +++ b/services/api/src/domain/entities/auth.ts @@ -1,12 +1,12 @@ export interface AuthInfo { sub: string; name?: string; - given_name?: string; - family_name?: string; - nickname?: string; + // given_name?: string; + // family_name?: string; + // nickname?: string; picture?: string; - locale?: string; - updated_at?: number | string; + // locale?: string; + // updated_at?: number | string; email?: string; - email_verified?: boolean; + // email_verified?: boolean; } diff --git a/services/api/src/domain/entities/command.entity.ts b/services/api/src/domain/entities/command.ts similarity index 100% rename from services/api/src/domain/entities/command.entity.ts rename to services/api/src/domain/entities/command.ts diff --git a/services/api/src/domain/entities/membership.entity.ts b/services/api/src/domain/entities/memberships/membership.ts similarity index 100% rename from services/api/src/domain/entities/membership.entity.ts rename to services/api/src/domain/entities/memberships/membership.ts diff --git a/services/api/src/domain/entities/memberships.repository.ts b/services/api/src/domain/entities/memberships/memberships-repository.ts similarity index 83% rename from services/api/src/domain/entities/memberships.repository.ts rename to services/api/src/domain/entities/memberships/memberships-repository.ts index 8142ff38..4e056896 100644 --- a/services/api/src/domain/entities/memberships.repository.ts +++ b/services/api/src/domain/entities/memberships/memberships-repository.ts @@ -1,4 +1,4 @@ -import { Membership, MembershipStatus } from './membership.entity'; +import { Membership, MembershipStatus } from './membership'; export type CreateMembershipParams = Pick< Membership, diff --git a/services/api/src/domain/entities/messages/message.ts b/services/api/src/domain/entities/messages/message.ts index 60b1fb82..4cdc50f5 100644 --- a/services/api/src/domain/entities/messages/message.ts +++ b/services/api/src/domain/entities/messages/message.ts @@ -1,5 +1,5 @@ import { Observable } from 'rxjs'; -import { User } from '../users/user.entity'; +import { User } from '../users/user'; export enum UpdatedEntity { Room = 'room', diff --git a/services/api/src/domain/entities/messages/messages.repository.ts b/services/api/src/domain/entities/messages/messages-repository.ts similarity index 100% rename from services/api/src/domain/entities/messages/messages.repository.ts rename to services/api/src/domain/entities/messages/messages-repository.ts diff --git a/services/api/src/domain/entities/room.entity.ts b/services/api/src/domain/entities/rooms/room.ts similarity index 100% rename from services/api/src/domain/entities/room.entity.ts rename to services/api/src/domain/entities/rooms/room.ts diff --git a/services/api/src/domain/entities/rooms.repository.ts b/services/api/src/domain/entities/rooms/rooms-repository.ts similarity index 90% rename from services/api/src/domain/entities/rooms.repository.ts rename to services/api/src/domain/entities/rooms/rooms-repository.ts index 952e6a7a..a062c523 100644 --- a/services/api/src/domain/entities/rooms.repository.ts +++ b/services/api/src/domain/entities/rooms/rooms-repository.ts @@ -1,4 +1,4 @@ -import { Room } from './room.entity'; +import { Room } from './room'; export type CreateRoomParams = Omit; export type UpdateRoomParams = Partial< diff --git a/services/api/src/domain/entities/users/system.ts b/services/api/src/domain/entities/users/system-user.ts similarity index 92% rename from services/api/src/domain/entities/users/system.ts rename to services/api/src/domain/entities/users/system-user.ts index e19834b9..6666af11 100644 --- a/services/api/src/domain/entities/users/system.ts +++ b/services/api/src/domain/entities/users/system-user.ts @@ -1,5 +1,5 @@ import { SentMessage, DraftMessage } from '../messages/message'; -import { User } from './user.entity'; +import { User } from './user'; export const systemUser: User = Object.freeze({ id: 'system', diff --git a/services/api/src/domain/entities/users/user.entity.ts b/services/api/src/domain/entities/users/user.ts similarity index 100% rename from services/api/src/domain/entities/users/user.entity.ts rename to services/api/src/domain/entities/users/user.ts diff --git a/services/api/src/domain/entities/users/users.repository.ts b/services/api/src/domain/entities/users/users-repository.ts similarity index 95% rename from services/api/src/domain/entities/users/users.repository.ts rename to services/api/src/domain/entities/users/users-repository.ts index a8b60ec4..5d63a36f 100644 --- a/services/api/src/domain/entities/users/users.repository.ts +++ b/services/api/src/domain/entities/users/users-repository.ts @@ -1,5 +1,5 @@ import { faker } from '@faker-js/faker'; -import { User } from './user.entity'; +import { User } from './user'; import { AuthInfo } from '@entities/auth'; export type SaveUserParams = AuthInfo & { diff --git a/services/api/src/domain/usecases/auth.service.ts b/services/api/src/domain/usecases/auth.service.ts index dc5a5442..756a5665 100644 --- a/services/api/src/domain/usecases/auth.service.ts +++ b/services/api/src/domain/usecases/auth.service.ts @@ -1,8 +1,8 @@ -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { Logger } from './logger'; import { UnauthorizedException } from '@nestjs/common'; import { isNil, reject } from 'rambda'; -import { Room } from '@entities/room.entity'; +import { Room } from '@entities/rooms/room'; export enum Role { Read = 'read', diff --git a/services/api/src/domain/usecases/commands/help.spec.ts b/services/api/src/domain/usecases/commands/help.spec.ts index 9fb8e55e..d0d25af2 100644 --- a/services/api/src/domain/usecases/commands/help.spec.ts +++ b/services/api/src/domain/usecases/commands/help.spec.ts @@ -1,7 +1,7 @@ import { HelpCommandUseCase } from './help'; import { MockProxy, mock } from 'jest-mock-extended'; import { Dispatcher } from '@entities/messages/message'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { UserFactory } from '@fixtures/messages/user.factory'; import { RoomFactory } from '@fixtures/messages/room.factory'; diff --git a/services/api/src/domain/usecases/commands/help.ts b/services/api/src/domain/usecases/commands/help.ts index 5802a662..e797919e 100644 --- a/services/api/src/domain/usecases/commands/help.ts +++ b/services/api/src/domain/usecases/commands/help.ts @@ -1,5 +1,5 @@ import { Dispatcher } from '@entities/messages/message'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; import { parsers } from './parse/parsers'; diff --git a/services/api/src/domain/usecases/commands/lorem.spec.ts b/services/api/src/domain/usecases/commands/lorem.spec.ts index f416804a..d29398d2 100644 --- a/services/api/src/domain/usecases/commands/lorem.spec.ts +++ b/services/api/src/domain/usecases/commands/lorem.spec.ts @@ -1,7 +1,7 @@ import { LoremCommandUseCase, LoremGenerator, LoremParams } from './lorem'; import { MockProxy, mock } from 'jest-mock-extended'; import { Dispatcher } from '@entities/messages/message'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; diff --git a/services/api/src/domain/usecases/commands/lorem.ts b/services/api/src/domain/usecases/commands/lorem.ts index 8b453a4f..d42f4a5f 100644 --- a/services/api/src/domain/usecases/commands/lorem.ts +++ b/services/api/src/domain/usecases/commands/lorem.ts @@ -1,5 +1,5 @@ import { Dispatcher, DraftMessage } from '@entities/messages/message'; -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; export type LoremType = 'words' | 'paragraphs'; diff --git a/services/api/src/domain/usecases/commands/parse/command.parser.ts b/services/api/src/domain/usecases/commands/parse/command.parser.ts index 4fab2b34..bba2ab8b 100644 --- a/services/api/src/domain/usecases/commands/parse/command.parser.ts +++ b/services/api/src/domain/usecases/commands/parse/command.parser.ts @@ -1,5 +1,5 @@ -import { Command } from '@entities/command.entity'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; +import { Command } from '@entities/command'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; import { BadRequestException } from '@nestjs/common'; import { equals } from 'rambda'; import { z, ZodIssue, ZodType } from 'zod'; diff --git a/services/api/src/domain/usecases/commands/parse/index.ts b/services/api/src/domain/usecases/commands/parse/index.ts index f01f4d02..7836e324 100644 --- a/services/api/src/domain/usecases/commands/parse/index.ts +++ b/services/api/src/domain/usecases/commands/parse/index.ts @@ -1,4 +1,4 @@ -import { Command } from '@entities/command.entity'; +import { Command } from '@entities/command'; import { BadRequestException, Injectable } from '@nestjs/common'; import { parsers } from './parsers'; import { ParsedCommand } from './command.parser'; diff --git a/services/api/src/domain/usecases/commands/parse/parse.spec.ts b/services/api/src/domain/usecases/commands/parse/parse.spec.ts index 55200c9d..e92135f7 100644 --- a/services/api/src/domain/usecases/commands/parse/parse.spec.ts +++ b/services/api/src/domain/usecases/commands/parse/parse.spec.ts @@ -1,8 +1,8 @@ -import { Command } from '@entities/command.entity'; +import { Command } from '@entities/command'; import { BadRequestException } from '@nestjs/common'; import { ParseCommandUseCase } from '.'; import { ParsedCommand } from './command.parser'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; describe('ParseCommandUseCase', () => { let parse: ParseCommandUseCase; diff --git a/services/api/src/domain/usecases/commands/parse/parsers/set-room-content-policy-parser.ts b/services/api/src/domain/usecases/commands/parse/parsers/set-room-content-policy-parser.ts index aec43e5c..53588ffc 100644 --- a/services/api/src/domain/usecases/commands/parse/parsers/set-room-content-policy-parser.ts +++ b/services/api/src/domain/usecases/commands/parse/parsers/set-room-content-policy-parser.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; import { CommandParser, ParsedCommand } from '../command.parser'; -import { ContentPolicy } from '@entities/room.entity'; +import { ContentPolicy } from '@entities/rooms/room'; const schema = z .tuple([ diff --git a/services/api/src/domain/usecases/commands/parse/parsers/set-room-join-policy-parser.ts b/services/api/src/domain/usecases/commands/parse/parsers/set-room-join-policy-parser.ts index 58ed008f..3d48becf 100644 --- a/services/api/src/domain/usecases/commands/parse/parsers/set-room-join-policy-parser.ts +++ b/services/api/src/domain/usecases/commands/parse/parsers/set-room-join-policy-parser.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; import { CommandParser, ParsedCommand } from '../command.parser'; -import { JoinPolicy } from '@entities/room.entity'; +import { JoinPolicy } from '@entities/rooms/room'; const schema = z .tuple([ diff --git a/services/api/src/domain/usecases/memberships/approve-request.spec.ts b/services/api/src/domain/usecases/memberships/approve-request.spec.ts index 5ef72674..427e05b6 100644 --- a/services/api/src/domain/usecases/memberships/approve-request.spec.ts +++ b/services/api/src/domain/usecases/memberships/approve-request.spec.ts @@ -1,4 +1,4 @@ -import { JoinPolicy } from '@entities/room.entity'; +import { JoinPolicy } from '@entities/rooms/room'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; @@ -10,7 +10,7 @@ import { Role } from '@usecases/auth.service'; import mock, { MockProxy } from 'jest-mock-extended/lib/Mock'; import { Dispatcher } from '@entities/messages/message'; import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; -import { MembershipStatus } from '@entities/membership.entity'; +import { MembershipStatus } from '@entities/memberships/membership'; import { ApproveRequestUseCase } from './approve-request'; describe('ApproveRequestUseCase', () => { diff --git a/services/api/src/domain/usecases/memberships/approve-request.ts b/services/api/src/domain/usecases/memberships/approve-request.ts index 54f2e820..8e558089 100644 --- a/services/api/src/domain/usecases/memberships/approve-request.ts +++ b/services/api/src/domain/usecases/memberships/approve-request.ts @@ -1,12 +1,12 @@ import { MembershipStatus, getMembershipStatus, -} from '@entities/membership.entity'; -import { MembershipsRepository } from '@entities/memberships.repository'; +} from '@entities/memberships/membership'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; import { Dispatcher, DraftMessage } from '@entities/messages/message'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; -import { UsersRepository } from '@entities/users/users.repository'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; +import { UsersRepository } from '@entities/users/users-repository'; import { Injectable } from '@nestjs/common'; import { AuthService, Role } from '@usecases/auth.service'; diff --git a/services/api/src/domain/usecases/memberships/invite.spec.ts b/services/api/src/domain/usecases/memberships/invite.spec.ts index 261cefa4..99155419 100644 --- a/services/api/src/domain/usecases/memberships/invite.spec.ts +++ b/services/api/src/domain/usecases/memberships/invite.spec.ts @@ -1,4 +1,4 @@ -import { JoinPolicy } from '@entities/room.entity'; +import { JoinPolicy } from '@entities/rooms/room'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; @@ -11,7 +11,7 @@ import mock, { MockProxy } from 'jest-mock-extended/lib/Mock'; import { Dispatcher } from '@entities/messages/message'; import { InviteUseCase } from './invite'; import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; -import { MembershipStatus } from '@entities/membership.entity'; +import { MembershipStatus } from '@entities/memberships/membership'; describe('InviteUseCase', () => { let invite: InviteUseCase; diff --git a/services/api/src/domain/usecases/memberships/invite.ts b/services/api/src/domain/usecases/memberships/invite.ts index 81fd4414..390c94e7 100644 --- a/services/api/src/domain/usecases/memberships/invite.ts +++ b/services/api/src/domain/usecases/memberships/invite.ts @@ -2,13 +2,13 @@ import { AuthService, Role } from '@usecases/auth.service'; import { MembershipStatus, getMembershipStatus, -} from '@entities/membership.entity'; -import { MembershipsRepository } from '@entities/memberships.repository'; -import { RoomsRepository } from '@entities/rooms.repository'; +} from '@entities/memberships/membership'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; import { Injectable } from '@nestjs/common'; import { Dispatcher, DraftMessage } from '@entities/messages/message'; -import { User } from '@entities/users/user.entity'; -import { UsersRepository } from '@entities/users/users.repository'; +import { User } from '@entities/users/user'; +import { UsersRepository } from '@entities/users/users-repository'; export type InviteParams = { roomId: string; diff --git a/services/api/src/domain/usecases/memberships/join.spec.ts b/services/api/src/domain/usecases/memberships/join.spec.ts index 382471af..b076b7ff 100644 --- a/services/api/src/domain/usecases/memberships/join.spec.ts +++ b/services/api/src/domain/usecases/memberships/join.spec.ts @@ -1,4 +1,4 @@ -import { JoinPolicy } from '@entities/room.entity'; +import { JoinPolicy } from '@entities/rooms/room'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; diff --git a/services/api/src/domain/usecases/memberships/join.ts b/services/api/src/domain/usecases/memberships/join.ts index 9b24ca02..eaadf838 100644 --- a/services/api/src/domain/usecases/memberships/join.ts +++ b/services/api/src/domain/usecases/memberships/join.ts @@ -1,11 +1,11 @@ import { AuthService, Role } from '@usecases/auth.service'; -import { MembershipStatus } from '@entities/membership.entity'; -import { MembershipsRepository } from '@entities/memberships.repository'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { MembershipStatus } from '@entities/memberships/membership'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; import { Dispatcher, DraftMessage } from '@entities/messages/message'; -import { JoinPolicy } from '@entities/room.entity'; +import { JoinPolicy } from '@entities/rooms/room'; @Injectable() export class JoinRoomUseCase { diff --git a/services/api/src/domain/usecases/memberships/leave.spec.ts b/services/api/src/domain/usecases/memberships/leave.spec.ts index 9c136dae..6eb08676 100644 --- a/services/api/src/domain/usecases/memberships/leave.spec.ts +++ b/services/api/src/domain/usecases/memberships/leave.spec.ts @@ -1,4 +1,4 @@ -import { JoinPolicy } from '@entities/room.entity'; +import { JoinPolicy } from '@entities/rooms/room'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; @@ -9,7 +9,7 @@ import { Role } from '@usecases/auth.service'; import mock, { MockProxy } from 'jest-mock-extended/lib/Mock'; import { Dispatcher, UpdatedEntity } from '@entities/messages/message'; import { LeaveRoomUseCase } from './leave'; -import { MembershipStatus } from '@entities/membership.entity'; +import { MembershipStatus } from '@entities/memberships/membership'; describe('LeaveRoomUseCase', () => { let leave: LeaveRoomUseCase; diff --git a/services/api/src/domain/usecases/memberships/leave.ts b/services/api/src/domain/usecases/memberships/leave.ts index f6fd0760..78cc7b43 100644 --- a/services/api/src/domain/usecases/memberships/leave.ts +++ b/services/api/src/domain/usecases/memberships/leave.ts @@ -1,12 +1,12 @@ -import { MembershipStatus } from '@entities/membership.entity'; -import { MembershipsRepository } from '@entities/memberships.repository'; +import { MembershipStatus } from '@entities/memberships/membership'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; import { Dispatcher, DraftMessage, UpdatedEntity, } from '@entities/messages/message'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; export type LeaveRoomParams = { diff --git a/services/api/src/domain/usecases/messages/get-messages.ts b/services/api/src/domain/usecases/messages/get-messages.ts index c139e125..44ed983a 100644 --- a/services/api/src/domain/usecases/messages/get-messages.ts +++ b/services/api/src/domain/usecases/messages/get-messages.ts @@ -1,10 +1,10 @@ import { Role, AuthService } from '@usecases/auth.service'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; import { pipe, reject } from 'rambda'; import { SentMessage, isPrivate } from '@entities/messages/message'; -import { MessagesRepository } from '@entities/messages/messages.repository'; +import { MessagesRepository } from '@entities/messages/messages-repository'; @Injectable() export class GetMessagesUseCase { diff --git a/services/api/src/domain/usecases/messages/parse-message.ts b/services/api/src/domain/usecases/messages/parse-message.ts index 14ed100d..066f6f79 100644 --- a/services/api/src/domain/usecases/messages/parse-message.ts +++ b/services/api/src/domain/usecases/messages/parse-message.ts @@ -1,4 +1,4 @@ -import { Command } from '@entities/command.entity'; +import { Command } from '@entities/command'; import { DraftMessage } from '@entities/messages/message'; export type ParsedMessage = DraftMessage | Command; diff --git a/services/api/src/domain/usecases/messages/send.ts b/services/api/src/domain/usecases/messages/send.ts index 675b7f0a..70464344 100644 --- a/services/api/src/domain/usecases/messages/send.ts +++ b/services/api/src/domain/usecases/messages/send.ts @@ -1,6 +1,6 @@ import { Dispatcher, DraftMessage } from '@entities/messages/message'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; import { Role, AuthService } from '@usecases/auth.service'; diff --git a/services/api/src/domain/usecases/rooms/about-room.ts b/services/api/src/domain/usecases/rooms/about-room.ts index 92d4309d..efb28dfa 100644 --- a/services/api/src/domain/usecases/rooms/about-room.ts +++ b/services/api/src/domain/usecases/rooms/about-room.ts @@ -1,7 +1,7 @@ import { Dispatcher, DraftMessage } from '@entities/messages/message'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; -import { UsersRepository } from '@entities/users/users.repository'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; +import { UsersRepository } from '@entities/users/users-repository'; import { Injectable } from '@nestjs/common'; import { AuthService, Role } from '@usecases/auth.service'; diff --git a/services/api/src/domain/usecases/rooms/configure-room.spec.ts b/services/api/src/domain/usecases/rooms/configure-room.spec.ts index 710e6293..1b0f6094 100644 --- a/services/api/src/domain/usecases/rooms/configure-room.spec.ts +++ b/services/api/src/domain/usecases/rooms/configure-room.spec.ts @@ -8,7 +8,7 @@ import { Dispatcher } from '@entities/messages/message'; import { AppLogger } from '@app/app.logger'; import { Role } from '@usecases/auth.service'; import { ConfigureRoomUseCase } from './configure-room'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; describe('ChangeRoomJoinPolicyUseCase', () => { let changeRoomJoinPolicy: ConfigureRoomUseCase; diff --git a/services/api/src/domain/usecases/rooms/configure-room.ts b/services/api/src/domain/usecases/rooms/configure-room.ts index 2eb4018d..479dae78 100644 --- a/services/api/src/domain/usecases/rooms/configure-room.ts +++ b/services/api/src/domain/usecases/rooms/configure-room.ts @@ -3,9 +3,9 @@ import { DraftMessage, UpdatedEntity, } from '@entities/messages/message'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; import { AuthService, Role } from '@usecases/auth.service'; diff --git a/services/api/src/domain/usecases/rooms/create.spec.ts b/services/api/src/domain/usecases/rooms/create.spec.ts index 06508671..b667cc06 100644 --- a/services/api/src/domain/usecases/rooms/create.spec.ts +++ b/services/api/src/domain/usecases/rooms/create.spec.ts @@ -2,7 +2,7 @@ import { TestMembershipsRepository } from '@data/repositories/test/test.membersh import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { UserFactory } from '@fixtures/messages/user.factory'; import { CreateRoomUseCase } from './create'; -import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; +import { ContentPolicy, JoinPolicy } from '@entities/rooms/room'; describe('CreateRoomUseCase', () => { let create: CreateRoomUseCase; diff --git a/services/api/src/domain/usecases/rooms/create.ts b/services/api/src/domain/usecases/rooms/create.ts index 86f27432..f0f120a3 100644 --- a/services/api/src/domain/usecases/rooms/create.ts +++ b/services/api/src/domain/usecases/rooms/create.ts @@ -1,8 +1,8 @@ -import { MembershipStatus } from '@entities/membership.entity'; -import { MembershipsRepository } from '@entities/memberships.repository'; -import { ContentPolicy, JoinPolicy, Room } from '@entities/room.entity'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { MembershipStatus } from '@entities/memberships/membership'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; +import { ContentPolicy, JoinPolicy, Room } from '@entities/rooms/room'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { faker } from '@faker-js/faker'; import { Injectable } from '@nestjs/common'; diff --git a/services/api/src/domain/usecases/rooms/get.spec.ts b/services/api/src/domain/usecases/rooms/get.spec.ts index 46fb8a21..5de54395 100644 --- a/services/api/src/domain/usecases/rooms/get.spec.ts +++ b/services/api/src/domain/usecases/rooms/get.spec.ts @@ -6,7 +6,7 @@ import { GetRoomUseCase } from './get'; import { AppLogger } from '@app/app.logger'; import { Role } from '@usecases/auth.service'; import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; -import { MembershipStatus } from '@entities/membership.entity'; +import { MembershipStatus } from '@entities/memberships/membership'; describe('GetRoomUseCase', () => { let get: GetRoomUseCase; diff --git a/services/api/src/domain/usecases/rooms/get.ts b/services/api/src/domain/usecases/rooms/get.ts index a8aa7f3d..93770d95 100644 --- a/services/api/src/domain/usecases/rooms/get.ts +++ b/services/api/src/domain/usecases/rooms/get.ts @@ -1,13 +1,13 @@ import { AuthService, Role } from '@usecases/auth.service'; -import { Room } from '@entities/room.entity'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { Room } from '@entities/rooms/room'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; -import { MembershipsRepository } from '@entities/memberships.repository'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; import { MembershipStatus, getMembershipStatus, -} from '@entities/membership.entity'; +} from '@entities/memberships/membership'; export type RoomDetails = { room: Room; diff --git a/services/api/src/domain/usecases/rooms/rename.ts b/services/api/src/domain/usecases/rooms/rename.ts index de9a3b88..d6794987 100644 --- a/services/api/src/domain/usecases/rooms/rename.ts +++ b/services/api/src/domain/usecases/rooms/rename.ts @@ -1,6 +1,6 @@ import { AuthService, Role } from '@usecases/auth.service'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { User } from '@entities/users/user.entity'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { User } from '@entities/users/user'; import { Injectable } from '@nestjs/common'; import { Dispatcher, diff --git a/services/api/src/domain/usecases/users/rename.ts b/services/api/src/domain/usecases/users/rename.ts index 67398f2e..4bad35d4 100644 --- a/services/api/src/domain/usecases/users/rename.ts +++ b/services/api/src/domain/usecases/users/rename.ts @@ -3,8 +3,8 @@ import { DraftMessage, UpdatedEntity, } from '@entities/messages/message'; -import { User } from '@entities/users/user.entity'; -import { UsersRepository } from '@entities/users/users.repository'; +import { User } from '@entities/users/user'; +import { UsersRepository } from '@entities/users/users-repository'; import { Injectable } from '@nestjs/common'; export type RenameUserParams = { diff --git a/services/api/src/fixtures/auth/FakeAuth.ts b/services/api/src/fixtures/auth/FakeAuth.ts index ff95f5d6..7d1e70fd 100644 --- a/services/api/src/fixtures/auth/FakeAuth.ts +++ b/services/api/src/fixtures/auth/FakeAuth.ts @@ -6,8 +6,8 @@ import { } from '@nestjs/common'; import { faker } from '@faker-js/faker'; import { AuthInfoFactory } from '@fixtures/auth/auth-info.factory'; -import { User } from '@entities/users/user.entity'; -import { userParamsFromAuth } from '@entities/users/users.repository'; +import { User } from '@entities/users/user'; +import { userParamsFromAuth } from '@entities/users/users-repository'; import { ExecutionContext } from '@nestjs/common'; import { IdentifyService } from '@app/auth/auth0/identify.service'; import { ModuleRef } from '@nestjs/core'; diff --git a/services/api/src/fixtures/data/test.data.module.ts b/services/api/src/fixtures/data/test.data.module.ts index 512177f7..df78228c 100644 --- a/services/api/src/fixtures/data/test.data.module.ts +++ b/services/api/src/fixtures/data/test.data.module.ts @@ -1,7 +1,7 @@ -import { MembershipsRepository } from '@entities/memberships.repository'; -import { MessagesRepository } from '@entities/messages/messages.repository'; -import { RoomsRepository } from '@entities/rooms.repository'; -import { UsersRepository } from '@entities/users/users.repository'; +import { MembershipsRepository } from '@entities/memberships/memberships-repository'; +import { MessagesRepository } from '@entities/messages/messages-repository'; +import { RoomsRepository } from '@entities/rooms/rooms-repository'; +import { UsersRepository } from '@entities/users/users-repository'; import { Global, Module } from '@nestjs/common'; import { TestMembershipsRepository } from '../../data/repositories/test/test.memberships.repository'; import { TestMessagesRepository } from '../../data/repositories/test/test.messages.repository'; diff --git a/services/api/src/fixtures/messages/room.factory.ts b/services/api/src/fixtures/messages/room.factory.ts index 8096d024..ed51bac9 100644 --- a/services/api/src/fixtures/messages/room.factory.ts +++ b/services/api/src/fixtures/messages/room.factory.ts @@ -1,5 +1,5 @@ import { subject } from '@casl/ability'; -import { ContentPolicy, JoinPolicy, Room } from '@entities/room.entity'; +import { ContentPolicy, JoinPolicy, Room } from '@entities/rooms/room'; import { faker } from '@faker-js/faker'; import { UserFactory } from './user.factory'; diff --git a/services/api/src/fixtures/messages/user.factory.ts b/services/api/src/fixtures/messages/user.factory.ts index bd77ade9..a877a00e 100644 --- a/services/api/src/fixtures/messages/user.factory.ts +++ b/services/api/src/fixtures/messages/user.factory.ts @@ -1,4 +1,4 @@ -import { User } from '@entities/users/user.entity'; +import { User } from '@entities/users/user'; import { faker } from '@faker-js/faker'; export const UserFactory = {