diff --git a/BE/src/app.module.ts b/BE/src/app.module.ts index 8f659dd..fbbc3fe 100644 --- a/BE/src/app.module.ts +++ b/BE/src/app.module.ts @@ -33,6 +33,7 @@ export class AppModule { userId: "commonUser", password: process.env.COMMON_USER_PASS, nickname: "commonUser", + email: "byeolsoop08@naver.com", })); await this.shapesRepository.createDefaultShapes(commonUser); diff --git a/BE/src/configs/typeorm.config.ts b/BE/src/configs/typeorm.config.ts index 2e59cc3..9412a77 100644 --- a/BE/src/configs/typeorm.config.ts +++ b/BE/src/configs/typeorm.config.ts @@ -9,7 +9,7 @@ export const typeORMConfig: TypeOrmModuleOptions = { password: process.env.DB_PASS, database: process.env.DB_NAME, entities: ["dist/**/*.entity{.ts,.js}"], - synchronize: true, + synchronize: false, timezone: "+09:00", }; @@ -19,7 +19,7 @@ export const typeORMTestConfig: TypeOrmModuleOptions = { port: 3306, username: process.env.DB_USER, password: process.env.DB_PASS, - database: process.env.DB_NAME, + database: process.env.TEST_DB_NAME, entities: ["src/**/*.entity{.ts,.js}"], synchronize: true, timezone: "+09:00", diff --git a/BE/src/diaries/diaries.dto.ts b/BE/src/diaries/diaries.dto.ts index c4701ee..7a86f85 100644 --- a/BE/src/diaries/diaries.dto.ts +++ b/BE/src/diaries/diaries.dto.ts @@ -18,6 +18,9 @@ export class CreateDiaryDto { @IsArray() tags: string[]; + + @IsUUID() + shapeUuid: string; } export class ReadDiaryDto { @@ -35,10 +38,19 @@ export class UpdateDiaryDto { @IsString() content: string; + @IsString() + @Matches(RegExp("^-?d+(.d+)?,-?d+(.d+)?,-?d+(.d+)?$"), { + message: "적절하지 않은 포인트 양식입니다", + }) + point: string; + @IsDate() date: Date; - @IsString() + @IsArray() + tags: string[]; + + @IsUUID() shapeUuid: string; } diff --git a/BE/src/diaries/diaries.entity.ts b/BE/src/diaries/diaries.entity.ts index 9e22ec3..1f54bf3 100644 --- a/BE/src/diaries/diaries.entity.ts +++ b/BE/src/diaries/diaries.entity.ts @@ -44,9 +44,6 @@ export class Diary extends BaseEntity { @Column({ type: "text" }) content: string; - @Column({ length: 7 }) - color: string; - @Column({ type: "float" }) positiveRatio: number; diff --git a/BE/src/diaries/diaries.repository.ts b/BE/src/diaries/diaries.repository.ts index 82c1ca9..5079e30 100644 --- a/BE/src/diaries/diaries.repository.ts +++ b/BE/src/diaries/diaries.repository.ts @@ -21,7 +21,6 @@ export class DiariesRepository { const content = encodedContent; // 미구현 기능을 대체하기 위한 임시 값 - const color = "#FFFFFF"; const positiveRatio = 0.0; const negativeRatio = 100.0; const neutralRatio = 0.0; @@ -34,7 +33,6 @@ export class DiariesRepository { content, point, date, - color, positiveRatio, negativeRatio, neutralRatio, diff --git a/BE/src/main.ts b/BE/src/main.ts index a07842e..ad40d5b 100644 --- a/BE/src/main.ts +++ b/BE/src/main.ts @@ -3,6 +3,7 @@ import { AppModule } from "./app.module"; async function bootstrap() { const app = await NestFactory.create(AppModule); + app.enableCors(); await app.listen(process.env.BE_PORT); } bootstrap(); diff --git a/BE/src/users/users.dto.ts b/BE/src/users/users.dto.ts index 8cbd982..1e346f5 100644 --- a/BE/src/users/users.dto.ts +++ b/BE/src/users/users.dto.ts @@ -1,24 +1,29 @@ -import { IsString, IsNumber, IsEnum, MaxLength } from "class-validator"; -import { premiumStatus } from "src/utils/enum"; +import { IsString, Length, MaxLength, Matches } from "class-validator"; export class CreateUserDto { @IsString() - @MaxLength(20) + @Length(4, 21) userId: string; @IsString() - @MaxLength(20) + @Matches("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$") + email: string; + + @IsString() + @Length(4, 21) password: string; @IsString() - @MaxLength(20) + @MaxLength(21) nickname: string; } export class LoginUserDto { @IsString() + @Length(4, 21) userId: string; @IsString() + @Length(4, 21) password: string; } diff --git a/BE/src/users/users.entity.ts b/BE/src/users/users.entity.ts index dced87c..0cccb11 100644 --- a/BE/src/users/users.entity.ts +++ b/BE/src/users/users.entity.ts @@ -20,6 +20,9 @@ export class User extends BaseEntity { @Column({ length: 20, unique: true }) userId: string; + @Column({ unique: true }) + email: string; + @Column({ length: 60 }) password: string;