diff --git a/src/modules/user/entities/user.entity.ts b/src/modules/user/entities/user.entity.ts index 86d721c..da53c6d 100644 --- a/src/modules/user/entities/user.entity.ts +++ b/src/modules/user/entities/user.entity.ts @@ -3,7 +3,7 @@ import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; @Entity() export class User { @PrimaryGeneratedColumn() - id: number; + id: string; @Column() email: string; diff --git a/src/modules/user/user.repository.ts b/src/modules/user/user.repository.ts index 5acb6c4..a6c91bb 100644 --- a/src/modules/user/user.repository.ts +++ b/src/modules/user/user.repository.ts @@ -4,16 +4,20 @@ import { DynamoDBDocument, QueryCommandOutput, GetCommandOutput, UpdateCommandOu import * as bcrypt from 'bcrypt'; import { DatabaseError } from 'src/core/errors/database-error'; import { UserType } from 'src/types/userType'; +import { User } from './entities/user.entity'; interface UserInfo { id?: string; email: string; password: string; - [key: string]: string; + PK?: string; + SK?: string; } interface UserTest { [key: string]: string; + PK?: string; + SK?: string; } @Injectable() @@ -88,7 +92,7 @@ export class UserRepository { } } - async update(id: string, userInfo: Partial): Promise { + async update(id: string, userInfo: Partial): Promise { let updateExpression = 'set'; const ExpressionAttributeNames: { [key: string]: string } = {}; const ExpressionAttributeValues: { [key: string]: unknown } = {}; @@ -112,7 +116,7 @@ export class UserRepository { ReturnValues: 'ALL_NEW', // return updated all data }); - return result.Attributes as UserInfo | null; + return result.Attributes as User | null; } catch (e) { throw new DatabaseError(); } diff --git a/src/modules/user/user.service.ts b/src/modules/user/user.service.ts index a004571..27d7354 100644 --- a/src/modules/user/user.service.ts +++ b/src/modules/user/user.service.ts @@ -61,10 +61,11 @@ export class UserService { userInfo['nickname'] = nickName; } - const item = await this.usersRepository.create({ ...userInfo, userType }); + const item = await this.usersRepository.create(userInfo); const responseItem = { id: item.PK, + userType: userType, // Add this line ...item, }; delete responseItem.PK; @@ -119,7 +120,7 @@ async update(id: string, userInfo: UpdateUserInfoRequestDto): Promise