diff --git a/backend/src/album/dto/create-album.dto.ts b/backend/src/album/dto/create-album.dto.ts index 83a8d47..a8fc239 100644 --- a/backend/src/album/dto/create-album.dto.ts +++ b/backend/src/album/dto/create-album.dto.ts @@ -1,5 +1,13 @@ export class CreateAlbumDto { + @IsString() + @IsNotEmpty() title: string; + + @IsString() + @IsNotEmpty() artist: string; + + @IsString() + @IsNotEmpty() genre: string; } diff --git a/backend/src/album/dto/update-album.dto.ts b/backend/src/album/dto/update-album.dto.ts index ac795d7..61911d5 100644 --- a/backend/src/album/dto/update-album.dto.ts +++ b/backend/src/album/dto/update-album.dto.ts @@ -1,6 +1,20 @@ export class UpdateAlbumDto { + @Column() + @IsNumber() id: number; + + @IsString() + @IsNotEmpty() title: string; + + @IsString() + @IsNotEmpty() artist: string; + + @IsString() + @IsNotEmpty() + + @IsString() + @IsNotEmpty() genre: string; } diff --git a/backend/src/song/dto/create-song.dto.ts b/backend/src/song/dto/create-song.dto.ts index 93a2357..68b1fb5 100644 --- a/backend/src/song/dto/create-song.dto.ts +++ b/backend/src/song/dto/create-song.dto.ts @@ -1,6 +1,21 @@ +import { Entity, Column, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; +import { IsNotEmpty, IsNumber, IsString } from 'class-validator'; + export class CreateSongDto { + @Column({ unique: true }) + @IsString() + @IsNotEmpty() title: string; + + @Column() + @IsNumber() duration: number; + + @Column() + @IsNumber() trackNumber: number; + + @Column() + @IsNumber() albumId: number; } diff --git a/backend/src/song/dto/update-song.dto.ts b/backend/src/song/dto/update-song.dto.ts index deaf54d..d4f5ae6 100644 --- a/backend/src/song/dto/update-song.dto.ts +++ b/backend/src/song/dto/update-song.dto.ts @@ -1,7 +1,22 @@ export class UpdateSongDto { + @Column() + @IsNumber() id: number; + + @Column({ unique: true }) + @IsString() + @IsNotEmpty() title: string; + + @Column() + @IsNumber() duration: number; + + @Column() + @IsNumber() trackNumber: number; + + @Column() + @IsNumber() albumId: number; }