diff --git a/services/api/.eslintrc.js b/services/api/.eslintrc.js index 8745eef7..d74a152f 100644 --- a/services/api/.eslintrc.js +++ b/services/api/.eslintrc.js @@ -68,6 +68,10 @@ module.exports = { '@casl/ability', ], }, + { + from: [['data', { adapterType: 'test' }]], + allow: ['@faker-js/faker'], + }, { from: ['config'], allow: ['@aws-sdk/client-dynamodb', '@nestjs/config', 'assert'], @@ -121,7 +125,9 @@ module.exports = { }, { type: 'data', - pattern: 'src/data', + pattern: ['src/data/*/*', 'src/data'], + mode: 'folder', + capture: ['kind', 'adapterType'], }, { type: 'config', diff --git a/services/api/.gitignore b/services/api/.gitignore index e330a031..dda14866 100644 --- a/services/api/.gitignore +++ b/services/api/.gitignore @@ -39,3 +39,5 @@ reports/mutation # typedoc /docs + +/coverage \ No newline at end of file diff --git a/services/api/jest.config.js b/services/api/jest.config.js index 6f016386..91bd66b4 100644 --- a/services/api/jest.config.js +++ b/services/api/jest.config.js @@ -19,4 +19,5 @@ module.exports = { '^@entities/(.*)$': ['/src/domain/entities/$1'], '^@usecases/(.*)$': ['/src/domain/usecases/$1'], }, + coverageDirectory: 'coverage', }; diff --git a/services/api/scripts/db/drop.ts b/services/api/scripts/db/drop.ts index fcdc265c..455f25e2 100644 --- a/services/api/scripts/db/drop.ts +++ b/services/api/scripts/db/drop.ts @@ -1,4 +1,4 @@ -import { DynamoDBAdapter } from '@data/adapters/dynamodb.adapter'; +import { DynamoDBAdapter } from '@data/adapters/dynamodb/dynamodb.adapter'; import { RunnableDataModule, runWithContext } from '../runWithContext'; runWithContext({ diff --git a/services/api/scripts/db/init.ts b/services/api/scripts/db/init.ts index 5034ea4b..0c0d6742 100644 --- a/services/api/scripts/db/init.ts +++ b/services/api/scripts/db/init.ts @@ -1,4 +1,4 @@ -import { DynamoDBAdapter } from '@data/adapters/dynamodb.adapter'; +import { DynamoDBAdapter } from '@data/adapters/dynamodb/dynamodb.adapter'; import { RunnableDataModule, runWithContext } from '../runWithContext'; runWithContext({ diff --git a/services/api/src/app/dispatcher/dispatcher.service.spec.ts b/services/api/src/app/dispatcher/dispatcher.service.spec.ts index 87209d5b..4cd8a014 100644 --- a/services/api/src/app/dispatcher/dispatcher.service.spec.ts +++ b/services/api/src/app/dispatcher/dispatcher.service.spec.ts @@ -1,6 +1,6 @@ -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { DispatcherService } from './dispatcher.service'; -import { TestMessagesRepository } from '@fixtures/data/test.messages.repository'; +import { TestMessagesRepository } from '@data/repositories/test/test.messages.repository'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; import { DraftMessage, SentMessage } from '@entities/messages'; import { RoomFactory } from '@fixtures/messages/room.factory'; diff --git a/services/api/src/app/messages/messages.controller.spec.ts b/services/api/src/app/messages/messages.controller.spec.ts index 72a31cda..e7c5c099 100644 --- a/services/api/src/app/messages/messages.controller.spec.ts +++ b/services/api/src/app/messages/messages.controller.spec.ts @@ -11,20 +11,20 @@ import { import { MessageFactory } from '@fixtures/messages/message.factory'; import { UsersRepository } from '@entities/users'; import { MessagesRepository } from '@entities/messages'; -import { TestDataModule } from '@fixtures/data/test.data.module'; -import { TestUsersRepository } from '@fixtures/data/test.users.repository'; -import { TestMessagesRepository } from '@fixtures/data/test.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 { TestRoomsRepository } from '@fixtures/data/test.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 '@fixtures/data/test.memberships.repository'; +import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; import { MembershipsRepository } from '@entities/memberships.repository'; import { MembershipStatus } from '@entities/membership.entity'; import { MessagesModule } from './messages.module'; import { Auth0Client } from '@app/auth/auth0/auth0.client'; import { MockLoggerModule } from '@fixtures/MockLoggerModule'; +import { TestDataModule } from '@fixtures/data/test.data.module'; jest.mock('@app/auth/auth0/auth0.client'); diff --git a/services/api/src/data/adapters/dynamodb.adapter.ts b/services/api/src/data/adapters/dynamodb/dynamodb.adapter.ts similarity index 98% rename from services/api/src/data/adapters/dynamodb.adapter.ts rename to services/api/src/data/adapters/dynamodb/dynamodb.adapter.ts index 3f1670b0..bd675007 100644 --- a/services/api/src/data/adapters/dynamodb.adapter.ts +++ b/services/api/src/data/adapters/dynamodb/dynamodb.adapter.ts @@ -11,7 +11,7 @@ import { DbRoom, DbSchema, DbUser, -} from '@data/adapters/schema'; +} from '@data/adapters/dynamodb/schema'; @Injectable() export class DynamoDBAdapter { diff --git a/services/api/src/data/adapters/schema.ts b/services/api/src/data/adapters/dynamodb/schema.ts similarity index 100% rename from services/api/src/data/adapters/schema.ts rename to services/api/src/data/adapters/dynamodb/schema.ts diff --git a/services/api/src/data/data.module.ts b/services/api/src/data/data.module.ts index 71c3d9a6..2d6f6743 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 { MessagesRepository } from '@entities/messages'; import databaseConfig from '@config/database.config'; -import { DynamoDBMessagesRepository } from './repositories/dynamodb.messages.repository'; +import { DynamoDBMessagesRepository } from './repositories/dynamodb/dynamodb.messages.repository'; import { RoomsRepository } from '@entities/rooms.repository'; import { UsersRepository } from '@entities/users'; -import { DynamoDBUsersRepository } from './repositories/dynamodb.users.repository'; -import { DynamoDBAdapter } from './adapters/dynamodb.adapter'; -import { DynamoDBRoomsRepository } from './repositories/dynamodb.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 { DynamoDBMembershipsRepository } from './repositories/dynamodb.memberships.repository'; +import { DynamoDBMembershipsRepository } from './repositories/dynamodb/dynamodb.memberships.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 eb742717..f23155d3 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,12 +1,12 @@ import { MembershipStatus } from '@entities/membership.entity'; import { CreateMembershipParams } from '@entities/memberships.repository'; -import { TestMembershipsRepository } from '@fixtures/data/test.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'; import { Test, TestingModule } from '@nestjs/testing'; import { DataModule } from '../data.module'; -import { DynamoDBMembershipsRepository } from './dynamodb.memberships.repository'; import { MockLoggerModule } from '@fixtures/MockLoggerModule'; +import { DynamoDBMembershipsRepository } from './dynamodb/dynamodb.memberships.repository'; type TestCase = { name: 'DynamoDBMembershipsRepository' | 'TestMembershipsRepository'; diff --git a/services/api/src/data/repositories/dynamodb.messages.repository.e2e-spec.ts b/services/api/src/data/repositories/dynamodb.messages.repository.e2e-spec.ts index e6af3803..4c8f8a10 100644 --- a/services/api/src/data/repositories/dynamodb.messages.repository.e2e-spec.ts +++ b/services/api/src/data/repositories/dynamodb.messages.repository.e2e-spec.ts @@ -1,6 +1,6 @@ -import { DynamoDBMessagesRepository } from '@data/repositories/dynamodb.messages.repository'; +import { DynamoDBMessagesRepository } from '@data/repositories/dynamodb/dynamodb.messages.repository'; import { DraftMessage } from '@entities/messages'; -import { TestMessagesRepository } from '@fixtures/data/test.messages.repository'; +import { TestMessagesRepository } from '@data/repositories/test/test.messages.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { Test, TestingModule } from '@nestjs/testing'; 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 3b2a16cc..65e950e4 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,7 +1,7 @@ -import { DynamoDBRoomsRepository } from '@data/repositories/dynamodb.rooms.repository'; +import { DynamoDBRoomsRepository } from '@data/repositories/dynamodb/dynamodb.rooms.repository'; import { ContentPolicy, JoinPolicy } from '@entities/room.entity'; import { CreateRoomParams } from '@entities/rooms.repository'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { Test } from '@nestjs/testing'; import { DataModule } from '../data.module'; import { MockLoggerModule } from '@fixtures/MockLoggerModule'; 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 20526b00..b691781f 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 @@ -1,6 +1,6 @@ -import { DynamoDBUsersRepository } from '@data/repositories/dynamodb.users.repository'; +import { DynamoDBUsersRepository } from '@data/repositories/dynamodb/dynamodb.users.repository'; import { userParamsFromAuth } from '@entities/users'; -import { TestUsersRepository } from '@fixtures/data/test.users.repository'; +import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; import { Test, TestingModule } from '@nestjs/testing'; import { DataModule } from '../data.module'; import { MockLoggerModule } from '@fixtures/MockLoggerModule'; diff --git a/services/api/src/data/repositories/dynamodb.memberships.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.memberships.repository.ts similarity index 91% rename from services/api/src/data/repositories/dynamodb.memberships.repository.ts rename to services/api/src/data/repositories/dynamodb/dynamodb.memberships.repository.ts index f8fe9ebd..f76f4c8d 100644 --- a/services/api/src/data/repositories/dynamodb.memberships.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.memberships.repository.ts @@ -5,8 +5,8 @@ import { } from '@entities/memberships.repository'; import { Injectable } from '@nestjs/common'; import { pick } from 'rambda'; -import { DynamoDBAdapter } from '../adapters/dynamodb.adapter'; -import { DbMembership } from '../adapters/schema'; +import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter'; +import { DbMembership } from '../../adapters/dynamodb/schema'; @Injectable() export class DynamoDBMembershipsRepository extends MembershipsRepository { diff --git a/services/api/src/data/repositories/dynamodb.messages.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.messages.repository.ts similarity index 91% rename from services/api/src/data/repositories/dynamodb.messages.repository.ts rename to services/api/src/data/repositories/dynamodb/dynamodb.messages.repository.ts index 02d5fead..c088c041 100644 --- a/services/api/src/data/repositories/dynamodb.messages.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.messages.repository.ts @@ -2,8 +2,8 @@ import { DraftMessage, SentMessage } from '@entities/messages'; import { MessagesRepository } from '@entities/messages'; import { Injectable } from '@nestjs/common'; import { pick } from 'rambda'; -import { DynamoDBAdapter } from '../adapters/dynamodb.adapter'; -import { DbMessage } from '../adapters/schema'; +import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter'; +import { DbMessage } from '../../adapters/dynamodb/schema'; @Injectable() export class DynamoDBMessagesRepository extends MessagesRepository { diff --git a/services/api/src/data/repositories/dynamodb.rooms.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.rooms.repository.ts similarity index 92% rename from services/api/src/data/repositories/dynamodb.rooms.repository.ts rename to services/api/src/data/repositories/dynamodb/dynamodb.rooms.repository.ts index 0e15b72b..37fcc0cc 100644 --- a/services/api/src/data/repositories/dynamodb.rooms.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.rooms.repository.ts @@ -7,8 +7,8 @@ import { } from '@entities/rooms.repository'; import { Injectable, NotFoundException } from '@nestjs/common'; import { pick } from 'rambda'; -import { DynamoDBAdapter } from '../adapters/dynamodb.adapter'; -import { DbRoom } from '../adapters/schema'; +import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter'; +import { DbRoom } from '../../adapters/dynamodb/schema'; @Injectable() export class DynamoDBRoomsRepository extends RoomsRepository { diff --git a/services/api/src/data/repositories/dynamodb.users.repository.ts b/services/api/src/data/repositories/dynamodb/dynamodb.users.repository.ts similarity index 93% rename from services/api/src/data/repositories/dynamodb.users.repository.ts rename to services/api/src/data/repositories/dynamodb/dynamodb.users.repository.ts index a6cb84e4..ef501734 100644 --- a/services/api/src/data/repositories/dynamodb.users.repository.ts +++ b/services/api/src/data/repositories/dynamodb/dynamodb.users.repository.ts @@ -6,8 +6,8 @@ import { } from '@entities/users'; import { Injectable, NotFoundException } from '@nestjs/common'; import { pick } from 'rambda'; -import { DynamoDBAdapter } from '../adapters/dynamodb.adapter'; -import { DbUser } from '../adapters/schema'; +import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter'; +import { DbUser } from '../../adapters/dynamodb/schema'; @Injectable() export class DynamoDBUsersRepository extends UsersRepository { diff --git a/services/api/src/fixtures/data/test.memberships.repository.ts b/services/api/src/data/repositories/test/test.memberships.repository.ts similarity index 100% rename from services/api/src/fixtures/data/test.memberships.repository.ts rename to services/api/src/data/repositories/test/test.memberships.repository.ts diff --git a/services/api/src/fixtures/data/test.messages.repository.ts b/services/api/src/data/repositories/test/test.messages.repository.ts similarity index 100% rename from services/api/src/fixtures/data/test.messages.repository.ts rename to services/api/src/data/repositories/test/test.messages.repository.ts diff --git a/services/api/src/fixtures/data/test.rooms.repository.ts b/services/api/src/data/repositories/test/test.rooms.repository.ts similarity index 100% rename from services/api/src/fixtures/data/test.rooms.repository.ts rename to services/api/src/data/repositories/test/test.rooms.repository.ts diff --git a/services/api/src/fixtures/data/test.users.repository.ts b/services/api/src/data/repositories/test/test.users.repository.ts similarity index 100% rename from services/api/src/fixtures/data/test.users.repository.ts rename to services/api/src/data/repositories/test/test.users.repository.ts 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 0fa5397c..5ef72674 100644 --- a/services/api/src/domain/usecases/memberships/approve-request.spec.ts +++ b/services/api/src/domain/usecases/memberships/approve-request.spec.ts @@ -1,7 +1,7 @@ import { JoinPolicy } from '@entities/room.entity'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestMembershipsRepository } from '@fixtures/data/test.memberships.repository'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { UnauthorizedException } from '@nestjs/common'; @@ -9,7 +9,7 @@ import { AppLogger } from '@app/app.logger'; import { Role } from '@usecases/auth.service'; import mock, { MockProxy } from 'jest-mock-extended/lib/Mock'; import { Dispatcher } from '@entities/messages/message'; -import { TestUsersRepository } from '@fixtures/data/test.users.repository'; +import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; import { MembershipStatus } from '@entities/membership.entity'; import { ApproveRequestUseCase } from './approve-request'; diff --git a/services/api/src/domain/usecases/memberships/invite.spec.ts b/services/api/src/domain/usecases/memberships/invite.spec.ts index 787723d6..261cefa4 100644 --- a/services/api/src/domain/usecases/memberships/invite.spec.ts +++ b/services/api/src/domain/usecases/memberships/invite.spec.ts @@ -1,7 +1,7 @@ import { JoinPolicy } from '@entities/room.entity'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestMembershipsRepository } from '@fixtures/data/test.memberships.repository'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { UnauthorizedException } from '@nestjs/common'; @@ -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 { InviteUseCase } from './invite'; -import { TestUsersRepository } from '@fixtures/data/test.users.repository'; +import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; import { MembershipStatus } from '@entities/membership.entity'; describe('InviteUseCase', () => { diff --git a/services/api/src/domain/usecases/memberships/join.spec.ts b/services/api/src/domain/usecases/memberships/join.spec.ts index 0416dc61..382471af 100644 --- a/services/api/src/domain/usecases/memberships/join.spec.ts +++ b/services/api/src/domain/usecases/memberships/join.spec.ts @@ -1,7 +1,7 @@ import { JoinPolicy } from '@entities/room.entity'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestMembershipsRepository } from '@fixtures/data/test.memberships.repository'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { UnauthorizedException } from '@nestjs/common'; diff --git a/services/api/src/domain/usecases/memberships/leave.spec.ts b/services/api/src/domain/usecases/memberships/leave.spec.ts index 26204bca..9c136dae 100644 --- a/services/api/src/domain/usecases/memberships/leave.spec.ts +++ b/services/api/src/domain/usecases/memberships/leave.spec.ts @@ -1,7 +1,7 @@ import { JoinPolicy } from '@entities/room.entity'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestMembershipsRepository } from '@fixtures/data/test.memberships.repository'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { AppLogger } from '@app/app.logger'; diff --git a/services/api/src/domain/usecases/messages/get-messages.spec.ts b/services/api/src/domain/usecases/messages/get-messages.spec.ts index 39f4abac..f9653521 100644 --- a/services/api/src/domain/usecases/messages/get-messages.spec.ts +++ b/services/api/src/domain/usecases/messages/get-messages.spec.ts @@ -1,6 +1,6 @@ -import { TestMessagesRepository } from '@fixtures/data/test.messages.repository'; +import { TestMessagesRepository } from '@data/repositories/test/test.messages.repository'; import { UserFactory } from '@fixtures/messages/user.factory'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { GetMessagesUseCase } from './get-messages'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; diff --git a/services/api/src/domain/usecases/messages/send.spec.ts b/services/api/src/domain/usecases/messages/send.spec.ts index 57db2ac0..8fdd8b76 100644 --- a/services/api/src/domain/usecases/messages/send.spec.ts +++ b/services/api/src/domain/usecases/messages/send.spec.ts @@ -1,5 +1,5 @@ import { UserFactory } from '@fixtures/messages/user.factory'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { TestAuthService } from '@fixtures/auth/test-auth-service'; import { UnauthorizedException } from '@nestjs/common'; diff --git a/services/api/src/domain/usecases/rooms/about-room.spec.ts b/services/api/src/domain/usecases/rooms/about-room.spec.ts index 1dc5656f..8526a20e 100644 --- a/services/api/src/domain/usecases/rooms/about-room.spec.ts +++ b/services/api/src/domain/usecases/rooms/about-room.spec.ts @@ -1,5 +1,5 @@ import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { UnauthorizedException } from '@nestjs/common'; @@ -8,7 +8,7 @@ import { Role } from '@usecases/auth.service'; import mock, { MockProxy } from 'jest-mock-extended/lib/Mock'; import { Dispatcher } from '@entities/messages/message'; import { AboutRoomUseCase } from './about-room'; -import { TestUsersRepository } from '@fixtures/data/test.users.repository'; +import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; describe('AboutRoomUseCase', () => { let aboutRoom: AboutRoomUseCase; diff --git a/services/api/src/domain/usecases/rooms/change-room-join-policy.spec.ts b/services/api/src/domain/usecases/rooms/change-room-join-policy.spec.ts index b6f83224..f60ca259 100644 --- a/services/api/src/domain/usecases/rooms/change-room-join-policy.spec.ts +++ b/services/api/src/domain/usecases/rooms/change-room-join-policy.spec.ts @@ -1,5 +1,5 @@ import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { mock, MockProxy } from 'jest-mock-extended'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; diff --git a/services/api/src/domain/usecases/rooms/create.spec.ts b/services/api/src/domain/usecases/rooms/create.spec.ts index 61a388b5..06508671 100644 --- a/services/api/src/domain/usecases/rooms/create.spec.ts +++ b/services/api/src/domain/usecases/rooms/create.spec.ts @@ -1,5 +1,5 @@ -import { TestMembershipsRepository } from '@fixtures/data/test.memberships.repository'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; +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'; diff --git a/services/api/src/domain/usecases/rooms/get.spec.ts b/services/api/src/domain/usecases/rooms/get.spec.ts index 888f2bf1..46fb8a21 100644 --- a/services/api/src/domain/usecases/rooms/get.spec.ts +++ b/services/api/src/domain/usecases/rooms/get.spec.ts @@ -1,11 +1,11 @@ import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; import { GetRoomUseCase } from './get'; import { AppLogger } from '@app/app.logger'; import { Role } from '@usecases/auth.service'; -import { TestMembershipsRepository } from '@fixtures/data/test.memberships.repository'; +import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository'; import { MembershipStatus } from '@entities/membership.entity'; describe('GetRoomUseCase', () => { diff --git a/services/api/src/domain/usecases/rooms/rename.spec.ts b/services/api/src/domain/usecases/rooms/rename.spec.ts index 209783f1..497c67e6 100644 --- a/services/api/src/domain/usecases/rooms/rename.spec.ts +++ b/services/api/src/domain/usecases/rooms/rename.spec.ts @@ -1,5 +1,5 @@ import { TestAuthService } from '@fixtures/auth/test-auth-service'; -import { TestRoomsRepository } from '@fixtures/data/test.rooms.repository'; +import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository'; import { RenameRoomUseCase } from './rename'; import { mock, MockProxy } from 'jest-mock-extended'; import { RoomFactory } from '@fixtures/messages/room.factory'; diff --git a/services/api/src/domain/usecases/users/rename.spec.ts b/services/api/src/domain/usecases/users/rename.spec.ts index 3fccbc39..8fbaef78 100644 --- a/services/api/src/domain/usecases/users/rename.spec.ts +++ b/services/api/src/domain/usecases/users/rename.spec.ts @@ -2,7 +2,7 @@ import { RenameUserUseCase } from './rename'; import { mock, MockProxy } from 'jest-mock-extended'; import { RoomFactory } from '@fixtures/messages/room.factory'; import { UserFactory } from '@fixtures/messages/user.factory'; -import { TestUsersRepository } from '@fixtures/data/test.users.repository'; +import { TestUsersRepository } from '@data/repositories/test/test.users.repository'; import { Dispatcher } from '@entities/messages'; describe('RenameUserUseCase', () => { diff --git a/services/api/src/fixtures/data/test.data.module.ts b/services/api/src/fixtures/data/test.data.module.ts index bad40f1b..0a0b09b6 100644 --- a/services/api/src/fixtures/data/test.data.module.ts +++ b/services/api/src/fixtures/data/test.data.module.ts @@ -3,10 +3,10 @@ import { MessagesRepository } from '@entities/messages'; import { RoomsRepository } from '@entities/rooms.repository'; import { UsersRepository } from '@entities/users'; import { Global, Module } from '@nestjs/common'; -import { TestMembershipsRepository } from './test.memberships.repository'; -import { TestMessagesRepository } from './test.messages.repository'; -import { TestRoomsRepository } from './test.rooms.repository'; -import { TestUsersRepository } from './test.users.repository'; +import { TestMembershipsRepository } from '../../data/repositories/test/test.memberships.repository'; +import { TestMessagesRepository } from '../../data/repositories/test/test.messages.repository'; +import { TestRoomsRepository } from '../../data/repositories/test/test.rooms.repository'; +import { TestUsersRepository } from '../../data/repositories/test/test.users.repository'; @Global() @Module({ diff --git a/services/api/src/fixtures/setup-e2e.ts b/services/api/src/fixtures/setup-e2e.ts index 63fb2de3..27886051 100644 --- a/services/api/src/fixtures/setup-e2e.ts +++ b/services/api/src/fixtures/setup-e2e.ts @@ -1,5 +1,5 @@ import 'tsconfig-paths/register'; -import { DynamoDBAdapter } from '@data/adapters/dynamodb.adapter'; +import { DynamoDBAdapter } from '@data/adapters/dynamodb/dynamodb.adapter'; import { DataModule } from '@data/data.module'; import { Test, TestingModule } from '@nestjs/testing'; import { LoggerModule } from '@app/app.logger'; diff --git a/services/api/src/fixtures/teardown-e2e.ts b/services/api/src/fixtures/teardown-e2e.ts index 8ff37cdd..b03709b6 100644 --- a/services/api/src/fixtures/teardown-e2e.ts +++ b/services/api/src/fixtures/teardown-e2e.ts @@ -1,5 +1,5 @@ import 'tsconfig-paths/register'; -import { DynamoDBAdapter } from '@data/adapters/dynamodb.adapter'; +import { DynamoDBAdapter } from '@data/adapters/dynamodb/dynamodb.adapter'; import { DataModule } from '@data/data.module'; import { Test, TestingModule } from '@nestjs/testing'; import { LoggerModule } from '@app/app.logger';