diff --git a/server/src/auth/auth.service.spec.ts b/server/src/auth/auth.service.spec.ts index 8dd3acf8..9cd1bf79 100644 --- a/server/src/auth/auth.service.spec.ts +++ b/server/src/auth/auth.service.spec.ts @@ -199,13 +199,18 @@ describe('AuthService', () => { email: 'test@example.com', provider: ProviderType.APPLE, }; - const existUser = { email: user.email, userId: 1 } as UserModel; + const existUser = { + email: user.email, + userId: 1, + nickname: 'test', + } as UserModel; jest .spyOn(authService, 'authenticateWithEmailAndProvider') .mockResolvedValue(existUser); jest.spyOn(authService, 'loginUser').mockReturnValue({ accessToken: 'access_token', refreshToken: 'refresh_token', + nickname: 'test', }); const result = await authService.loginWithEmailAndProvider(user); @@ -252,6 +257,7 @@ describe('AuthService', () => { jest.spyOn(authService, 'loginUser').mockReturnValue({ accessToken: 'access_token', refreshToken: 'refresh_token', + nickname: 'NewUser', }); const result = await authService.registerUser(user); diff --git a/server/src/auth/auth.service.ts b/server/src/auth/auth.service.ts index 3746de9d..2fa8b7ac 100644 --- a/server/src/auth/auth.service.ts +++ b/server/src/auth/auth.service.ts @@ -130,11 +130,15 @@ export class AuthService { * @returns {{accessToken: string, refreshToken: string}} */ - loginUser(user: UserModel): { accessToken: string; refreshToken: string } { + loginUser(user: UserModel): { + accessToken: string; + refreshToken: string; + nickname: string; + } { const accessToken = this.signToken(user, 'access'); const refreshToken = this.signToken(user, 'refresh'); - return { accessToken, refreshToken }; + return { accessToken, refreshToken, nickname: user.nickname }; } /** diff --git a/server/src/shared-checklists/shared-checklists.gateway.ts b/server/src/shared-checklists/shared-checklists.gateway.ts index 07b4ef1d..b64363f3 100644 --- a/server/src/shared-checklists/shared-checklists.gateway.ts +++ b/server/src/shared-checklists/shared-checklists.gateway.ts @@ -186,9 +186,7 @@ export class SharedChecklistsGateway const historyArray = history.map((item) => JSON.parse(item)); const flattenedArray = historyArray.flat(); - if (history.length > 0) { - this.sendToClient(client, 'history', flattenedArray); - } + this.sendToClient(client, 'history', flattenedArray); } /**