Skip to content

Commit

Permalink
Feat: pass에서 name 제거 및 titleId 필수값으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
suhye0n committed Nov 15, 2024
1 parent 947bfa6 commit 85362ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
12 changes: 2 additions & 10 deletions src/dtos/passes.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -32,10 +28,6 @@ export class UpdatePassDto {
@IsInt()
public titleId?: number;

@IsOptional()
@IsString()
public name?: string; // TODO: 삭제

@IsOptional()
@IsString()
public barcode?: string;
Expand Down
3 changes: 1 addition & 2 deletions src/interfaces/passes.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 2 additions & 8 deletions src/models/passes.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export type PassCreationAttributes = Optional<Pass, 'id' | 'barcode' | 'memo' |
export class PassModel extends Model<Pass, PassCreationAttributes> 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;
Expand Down Expand Up @@ -37,19 +36,14 @@ export default function (sequelize: Sequelize): typeof PassModel {
},
titleId: {
type: DataTypes.INTEGER,
allowNull: true, // TODO: 필수값으로 변경
allowNull: false,
references: {
model: 'titles',
key: 'id',
},
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
},
name: {
// TODO: 삭제
allowNull: true,
type: DataTypes.STRING(45),
},
barcode: {
allowNull: false,
type: DataTypes.TEXT,
Expand Down

0 comments on commit 85362ec

Please sign in to comment.