From 85362ec4bf89605240aa3909bca29332c41822b6 Mon Sep 17 00:00:00 2001 From: suhye0n Date: Fri, 15 Nov 2024 15:53:12 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20pass=EC=97=90=EC=84=9C=20name=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20titleId=20=ED=95=84=EC=88=98?= =?UTF-8?q?=EA=B0=92=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dtos/passes.dto.ts | 12 ++---------- src/interfaces/passes.interface.ts | 3 +-- src/models/passes.model.ts | 10 ++-------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/dtos/passes.dto.ts b/src/dtos/passes.dto.ts index 4b90d9d..5f4f90c 100644 --- a/src/dtos/passes.dto.ts +++ b/src/dtos/passes.dto.ts @@ -2,13 +2,9 @@ import { IsString, IsInt, IsNotEmpty, IsOptional, IsEnum } from 'class-validator import { PassType } from '@interfaces/passes.interface'; export class CreatePassDto { - @IsOptional() // TODO: 필수값으로 변경 + @IsNotEmpty() @IsInt() - public titleId?: number; - - @IsOptional() - @IsString() - public name?: string; // TODO: 삭제 + public titleId: number; @IsNotEmpty() @IsString() @@ -32,10 +28,6 @@ export class UpdatePassDto { @IsInt() public titleId?: number; - @IsOptional() - @IsString() - public name?: string; // TODO: 삭제 - @IsOptional() @IsString() public barcode?: string; diff --git a/src/interfaces/passes.interface.ts b/src/interfaces/passes.interface.ts index 818e0da..33c2beb 100644 --- a/src/interfaces/passes.interface.ts +++ b/src/interfaces/passes.interface.ts @@ -8,8 +8,7 @@ export enum PassType { export interface Pass { id?: number; userId: number; - titleId?: number; // TODO: 필수값으로 변경 - name?: string; // TODO: 삭제 + titleId: number; barcode: string; memo?: string; tagId?: number; diff --git a/src/models/passes.model.ts b/src/models/passes.model.ts index 586b32f..d0f44f6 100644 --- a/src/models/passes.model.ts +++ b/src/models/passes.model.ts @@ -6,8 +6,7 @@ export type PassCreationAttributes = Optional implements Pass { public id: number; public userId: number; - public titleId?: number; // TODO: 필수값으로 변경 - public name?: string; // TODO: 삭제 + public titleId: number; public barcode: string; public memo?: string; public tagId?: number; @@ -37,7 +36,7 @@ export default function (sequelize: Sequelize): typeof PassModel { }, titleId: { type: DataTypes.INTEGER, - allowNull: true, // TODO: 필수값으로 변경 + allowNull: false, references: { model: 'titles', key: 'id', @@ -45,11 +44,6 @@ export default function (sequelize: Sequelize): typeof PassModel { onDelete: 'CASCADE', onUpdate: 'CASCADE', }, - name: { - // TODO: 삭제 - allowNull: true, - type: DataTypes.STRING(45), - }, barcode: { allowNull: false, type: DataTypes.TEXT,