Skip to content

Commit

Permalink
fix: 유저 id 타입 변경에 따른 타입 에러 수정 (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coalery authored Jan 29, 2025
2 parents b8f1723 + e9f9fa5 commit 6ebf72c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/__test__/fixtures/domain/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 0 additions & 1 deletion src/__test__/fixtures/view/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export function generateUserView(params?: Partial<UserView>): UserView {
return {
id: faker.number.int(),
name: faker.lorem.word(),
password: faker.lorem.word(),
profile: {
name: faker.person.fullName(),
college: faker.lorem.word(),
Expand Down
2 changes: 1 addition & 1 deletion src/app/domain/group/GroupLogFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
6 changes: 3 additions & 3 deletions src/app/domain/group/model/GroupLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { AggregateRoot } from '@nestjs/cqrs';
export type GroupLogConstructorParams = {
id: string;
groupId: string;
userId: string;
userId: number;
message: string;
createdAt: Date;
};

export class GroupLog extends AggregateRoot {
private _id: string;
private _groupId: string;
private _userId: string;
private _userId: number;
private _message: string;
private _createdAt: Date;

Expand All @@ -32,7 +32,7 @@ export class GroupLog extends AggregateRoot {
return this._groupId;
}

get userId(): string {
get userId(): number {
return this._userId;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/infra/logger/GroupLogger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/core/auth/AuthGuard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 }]);
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 6ebf72c

Please sign in to comment.