diff --git a/nestjs-BE/server/src/auth/auth.controller.ts b/nestjs-BE/server/src/auth/auth.controller.ts index e512675e..d995fa96 100644 --- a/nestjs-BE/server/src/auth/auth.controller.ts +++ b/nestjs-BE/server/src/auth/auth.controller.ts @@ -45,7 +45,7 @@ export class AuthController { const userData = { email: kakaoUserAccount.email }; const user = await this.usersService.getOrCreateUser(userData); const profileData = { - user_id: user.uuid, + userUuid: user.uuid, image: this.configService.get('BASE_IMAGE_URL'), nickname: '익명의 사용자', }; diff --git a/nestjs-BE/server/src/auth/auth.service.spec.ts b/nestjs-BE/server/src/auth/auth.service.spec.ts index ae307318..1455c03a 100644 --- a/nestjs-BE/server/src/auth/auth.service.spec.ts +++ b/nestjs-BE/server/src/auth/auth.service.spec.ts @@ -58,7 +58,7 @@ describe('AuthService', () => { jest.spyOn(jwtService, 'verify').mockReturnValue({}); jest.spyOn(jwtService, 'signAsync').mockResolvedValue('access token'); jest.spyOn(refreshTokensService, 'findRefreshToken').mockResolvedValue({ - user_id: 'user uuid', + userUuid: 'user uuid', } as RefreshToken); const token = service.renewAccessToken('refresh token'); diff --git a/nestjs-BE/server/src/auth/refresh-tokens.service.spec.ts b/nestjs-BE/server/src/auth/refresh-tokens.service.spec.ts index a5ae3277..ed3acd19 100644 --- a/nestjs-BE/server/src/auth/refresh-tokens.service.spec.ts +++ b/nestjs-BE/server/src/auth/refresh-tokens.service.spec.ts @@ -54,8 +54,8 @@ describe('RefreshTokensService', () => { const testToken = { id: 0, token: 'Token', - expiry_date: service.getExpiryDate(), - user_id: 'UserId', + expiryDate: service.getExpiryDate(), + userUuid: 'UserId', }; jest.spyOn(prisma.refreshToken, 'findUnique').mockResolvedValue(testToken); @@ -76,8 +76,8 @@ describe('RefreshTokensService', () => { const testToken = { id: 0, token: 'Token', - expiry_date: service.getExpiryDate(), - user_id: 'userId', + expiryDate: service.getExpiryDate(), + userUuid: 'userId', }; jest.spyOn(prisma.refreshToken, 'create').mockResolvedValue(testToken); @@ -105,8 +105,8 @@ describe('RefreshTokensService', () => { const testToken = { id: 0, token: 'Token', - expiry_date: service.getExpiryDate(), - user_id: 'userId', + expiryDate: service.getExpiryDate(), + userUuid: 'userId', }; jest.spyOn(prisma.refreshToken, 'delete').mockResolvedValue(testToken); diff --git a/nestjs-BE/server/src/auth/refresh-tokens.service.ts b/nestjs-BE/server/src/auth/refresh-tokens.service.ts index 69bc7e7c..33295ac5 100644 --- a/nestjs-BE/server/src/auth/refresh-tokens.service.ts +++ b/nestjs-BE/server/src/auth/refresh-tokens.service.ts @@ -18,8 +18,8 @@ export class RefreshTokensService { return this.prisma.refreshToken.create({ data: { token: this.createToken(), - expiry_date: this.getExpiryDate(), - user_id: userUuid, + expiryDate: this.getExpiryDate(), + userUuid, }, }); } diff --git a/nestjs-BE/server/src/invite-codes/invite-codes.controller.ts b/nestjs-BE/server/src/invite-codes/invite-codes.controller.ts index 85ba6d14..97059be9 100644 --- a/nestjs-BE/server/src/invite-codes/invite-codes.controller.ts +++ b/nestjs-BE/server/src/invite-codes/invite-codes.controller.ts @@ -44,7 +44,7 @@ export class InviteCodesController { return { statusCode: 201, message: 'Created', - data: { invite_code: inviteCode.invite_code }, + data: { invite_code: inviteCode.inviteCode }, }; } @@ -66,11 +66,11 @@ export class InviteCodesController { const inviteCodeData = await this.inviteCodesService.findInviteCode(inviteCode); if (!inviteCodeData) throw new NotFoundException(); - if (this.inviteCodesService.checkExpiry(inviteCodeData.expiry_date)) { + if (this.inviteCodesService.checkExpiry(inviteCodeData.expiryDate)) { this.inviteCodesService.deleteInviteCode(inviteCode); throw new HttpException('Invite code has expired.', HttpStatus.GONE); } - const space = await this.spacesService.findSpace(inviteCodeData.space_uuid); + const space = await this.spacesService.findSpace(inviteCodeData.spaceUuid); return { statusCode: 200, message: 'Success', data: space }; } } diff --git a/nestjs-BE/server/src/invite-codes/invite-codes.service.ts b/nestjs-BE/server/src/invite-codes/invite-codes.service.ts index cdd296bf..8c56b0b7 100644 --- a/nestjs-BE/server/src/invite-codes/invite-codes.service.ts +++ b/nestjs-BE/server/src/invite-codes/invite-codes.service.ts @@ -11,9 +11,9 @@ import generateUuid from '../utils/uuid'; export class InviteCodesService { constructor(protected prisma: PrismaService) {} - async findInviteCode(inviteCode: string): Promise { + async findInviteCode(inviteCode: string): Promise { return this.prisma.inviteCode.findUnique({ - where: { invite_code: inviteCode }, + where: { inviteCode: inviteCode }, }); } @@ -21,18 +21,18 @@ export class InviteCodesService { return this.prisma.inviteCode.create({ data: { uuid: generateUuid(), - invite_code: await this.generateUniqueInviteCode(INVITE_CODE_LENGTH), - space_uuid: spaceUuid, - expiry_date: this.calculateExpiryDate(), + inviteCode: await this.generateUniqueInviteCode(INVITE_CODE_LENGTH), + spaceUuid: spaceUuid, + expiryDate: this.calculateExpiryDate(), }, }); } - async deleteInviteCode(inviteCode: string): Promise { + async deleteInviteCode(inviteCode: string): Promise { try { return await this.prisma.inviteCode.delete({ where: { - invite_code: inviteCode, + inviteCode: inviteCode, }, }); } catch (err) { @@ -70,7 +70,7 @@ export class InviteCodesService { private async generateUniqueInviteCode(length: number): Promise { let inviteCode: string; - let inviteCodeData: InviteCode; + let inviteCodeData: InviteCode | null; do { inviteCode = this.generateShortInviteCode(length); diff --git a/nestjs-BE/server/src/profiles/dto/create-profile.dto.ts b/nestjs-BE/server/src/profiles/dto/create-profile.dto.ts index 9599e029..80f02831 100644 --- a/nestjs-BE/server/src/profiles/dto/create-profile.dto.ts +++ b/nestjs-BE/server/src/profiles/dto/create-profile.dto.ts @@ -3,7 +3,7 @@ import { MaxLength } from 'class-validator'; import { MAX_NAME_LENGTH } from '../../config/magic-number'; export class CreateProfileDto { - user_id: string; + userUuid: string; @ApiProperty({ example: 'profile-image.png', diff --git a/nestjs-BE/server/src/profiles/profiles.controller.spec.ts b/nestjs-BE/server/src/profiles/profiles.controller.spec.ts index edcce612..d6d98613 100644 --- a/nestjs-BE/server/src/profiles/profiles.controller.spec.ts +++ b/nestjs-BE/server/src/profiles/profiles.controller.spec.ts @@ -31,7 +31,7 @@ describe('ProfilesController', () => { const requestMock = { user: { uuid: 'user test uuid' } } as RequestWithUser; const testProfile = { uuid: 'profile test uuid', - user_id: requestMock.user.uuid, + userUuid: requestMock.user.uuid, image: 'www.test.com/image', nickname: 'test nickname', }; @@ -67,7 +67,7 @@ describe('ProfilesController', () => { const testImageUrl = 'www.test.com/image'; const testProfile = { uuid: 'profile test uuid', - user_id: requestMock.user.uuid, + userUuid: requestMock.user.uuid, image: 'www.test.com/image', nickname: 'test nickname', }; diff --git a/nestjs-BE/server/src/profiles/profiles.service.spec.ts b/nestjs-BE/server/src/profiles/profiles.service.spec.ts index 8afc4e06..ae0f8b2c 100644 --- a/nestjs-BE/server/src/profiles/profiles.service.spec.ts +++ b/nestjs-BE/server/src/profiles/profiles.service.spec.ts @@ -34,7 +34,7 @@ describe('ProfilesService', () => { const userId = generateUuid(); const testProfile = { uuid: generateUuid(), - user_id: userId, + userUuid: userId, image: 'www.test.com/image', nickname: 'test nickname', }; @@ -62,7 +62,7 @@ describe('ProfilesService', () => { const testProfiles = profileUuids.map((uuid, index) => { return { uuid, - user_id: generateUuid(), + userUuid: generateUuid(), image: 'www.test.com/image', nickname: `nickname${index}`, }; @@ -85,7 +85,7 @@ describe('ProfilesService', () => { it('getOrCreateProfile', async () => { const data = { - user_id: generateUuid(), + userUuid: generateUuid(), image: 'www.test.com/image', nickname: 'test nickname', }; @@ -103,7 +103,7 @@ describe('ProfilesService', () => { nickname: 'test nickname', }; const uuid = generateUuid(); - const testProfile = { uuid: generateUuid(), user_id: uuid, ...data }; + const testProfile = { uuid: generateUuid(), userUuid: uuid, ...data }; jest.spyOn(prisma.profile, 'update').mockResolvedValue(testProfile); const profile = profilesService.updateProfile(uuid, data); diff --git a/nestjs-BE/server/src/profiles/profiles.service.ts b/nestjs-BE/server/src/profiles/profiles.service.ts index 7a9eb676..a61a5905 100644 --- a/nestjs-BE/server/src/profiles/profiles.service.ts +++ b/nestjs-BE/server/src/profiles/profiles.service.ts @@ -25,11 +25,11 @@ export class ProfilesService { async getOrCreateProfile(data: CreateProfileDto): Promise { return this.prisma.profile.upsert({ - where: { userUuid: data.user_id }, + where: { userUuid: data.userUuid }, update: {}, create: { uuid: generateUuid(), - userUuid: data.user_id, + userUuid: data.userUuid, image: data.image, nickname: data.nickname, },