From e9f9fa5487fa0d60da3851b52a8eaca6b528b94c Mon Sep 17 00:00:00 2001 From: Coalery Date: Thu, 30 Jan 2025 02:33:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9C=A0=EC=A0=80=20id=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__test__/fixtures/domain/group.ts | 2 +- src/__test__/fixtures/view/user.ts | 1 - src/app/domain/group/GroupLogFactory.spec.ts | 2 +- src/app/domain/group/model/GroupLog.ts | 6 +++--- src/app/infra/logger/GroupLogger.spec.ts | 2 +- src/core/auth/AuthGuard.spec.ts | 8 ++++---- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/__test__/fixtures/domain/group.ts b/src/__test__/fixtures/domain/group.ts index f3b8726..880adb8 100644 --- a/src/__test__/fixtures/domain/group.ts +++ b/src/__test__/fixtures/domain/group.ts @@ -26,7 +26,7 @@ export function generateGroupLog( ): GroupLog { return new GroupLog({ id: faker.string.uuid(), - userId: faker.string.uuid(), + userId: faker.number.int(), groupId: faker.string.uuid(), message: faker.lorem.sentence(), createdAt: faker.date.anytime(), diff --git a/src/__test__/fixtures/view/user.ts b/src/__test__/fixtures/view/user.ts index a3d713d..dac635c 100644 --- a/src/__test__/fixtures/view/user.ts +++ b/src/__test__/fixtures/view/user.ts @@ -11,7 +11,6 @@ export function generateUserView(params?: Partial): UserView { return { id: faker.number.int(), name: faker.lorem.word(), - password: faker.lorem.word(), profile: { name: faker.person.fullName(), college: faker.lorem.word(), diff --git a/src/app/domain/group/GroupLogFactory.spec.ts b/src/app/domain/group/GroupLogFactory.spec.ts index e76680c..747668c 100644 --- a/src/app/domain/group/GroupLogFactory.spec.ts +++ b/src/app/domain/group/GroupLogFactory.spec.ts @@ -8,7 +8,7 @@ describe('GroupLogFactory', () => { let groupLogFactory: GroupLogFactory; const logId = 'group-log-id'; - const userId = 'user-id'; + const userId = 100; const groupId = 'group-id'; const message = 'some-message-for-group-activity'; diff --git a/src/app/domain/group/model/GroupLog.ts b/src/app/domain/group/model/GroupLog.ts index bcb196d..99ff3d0 100644 --- a/src/app/domain/group/model/GroupLog.ts +++ b/src/app/domain/group/model/GroupLog.ts @@ -3,7 +3,7 @@ import { AggregateRoot } from '@nestjs/cqrs'; export type GroupLogConstructorParams = { id: string; groupId: string; - userId: string; + userId: number; message: string; createdAt: Date; }; @@ -11,7 +11,7 @@ export type GroupLogConstructorParams = { export class GroupLog extends AggregateRoot { private _id: string; private _groupId: string; - private _userId: string; + private _userId: number; private _message: string; private _createdAt: Date; @@ -32,7 +32,7 @@ export class GroupLog extends AggregateRoot { return this._groupId; } - get userId(): string { + get userId(): number { return this._userId; } diff --git a/src/app/infra/logger/GroupLogger.spec.ts b/src/app/infra/logger/GroupLogger.spec.ts index 1622558..0ba10bb 100644 --- a/src/app/infra/logger/GroupLogger.spec.ts +++ b/src/app/infra/logger/GroupLogger.spec.ts @@ -50,7 +50,7 @@ describe('GroupLogger', () => { const message = 'message'; beforeEach(() => { - requester = { userId: 'userId', role: UserRole.USER }; + requester = { userId: 100, role: UserRole.USER }; clsService.get = jest.fn().mockReturnValue(requester); groupLogRepository.nextId = jest.fn().mockReturnValue(newLogId); diff --git a/src/core/auth/AuthGuard.spec.ts b/src/core/auth/AuthGuard.spec.ts index 51e46d5..e3e1141 100644 --- a/src/core/auth/AuthGuard.spec.ts +++ b/src/core/auth/AuthGuard.spec.ts @@ -118,7 +118,7 @@ describe('AuthGuard', () => { authMetadata, context.getHandler(), ); - laravelAuthnAdapter.authenticate.mockResolvedValue('1'); + laravelAuthnAdapter.authenticate.mockResolvedValue(100); entityManager.getConnection().execute = jest.fn().mockResolvedValue([]); await expect(authGuard.canActivate(context)).rejects.toThrow( @@ -135,7 +135,7 @@ describe('AuthGuard', () => { authMetadata, context.getHandler(), ); - laravelAuthnAdapter.authenticate.mockResolvedValue('1'); + laravelAuthnAdapter.authenticate.mockResolvedValue(100); entityManager.getConnection().execute = jest .fn() .mockResolvedValue([{ id: '1', manager: false }]); @@ -148,7 +148,7 @@ describe('AuthGuard', () => { test('요청 객체에 요청자 정보를 저장해야 한다', async () => { const context = createExecutionContext({ khlug_session: 'session' }); const authMetadata: AuthMetadata = { roles: [UserRole.USER] }; - const userId = '1'; + const userId = 100; Reflect.defineMetadata( AUTH_DECORATOR_METADATA_KEY, @@ -174,7 +174,7 @@ describe('AuthGuard', () => { test('CLS에 요청자 정보를 저장해야 한다', async () => { const context = createExecutionContext({ khlug_session: 'session' }); const authMetadata: AuthMetadata = { roles: [UserRole.USER] }; - const userId = '1'; + const userId = 100; Reflect.defineMetadata( AUTH_DECORATOR_METADATA_KEY,