Some checks failed
Music Collection CI Workflow / test (./backend) (push) Failing after 54s
Music Collection CI Workflow / test (./frontend) (push) Failing after 37s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Has been skipped
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Has been skipped
Music Collection CI Workflow / deploy (push) Has been skipped
35 lines
661 B
TypeScript
35 lines
661 B
TypeScript
import {Entity, Column, OneToMany, PrimaryGeneratedColumn, Generated} from 'typeorm';
|
|
import { IsNotEmpty, IsString, IsOptional } from 'class-validator';
|
|
import { Song } from '../song/song.entity';
|
|
import { UUID } from 'crypto';
|
|
|
|
@Entity('album')
|
|
export class Album {
|
|
|
|
@PrimaryGeneratedColumn()
|
|
@Generated("uuid")
|
|
uuid: UUID;
|
|
|
|
@Column({ unique: true })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
title: string;
|
|
|
|
@Column()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
artist: string;
|
|
|
|
@Column()
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
genre: string;
|
|
|
|
@IsOptional()
|
|
@OneToMany(() => Song, (song) => song.album, {
|
|
eager: true,
|
|
onDelete: 'CASCADE',
|
|
})
|
|
songs: Song[];
|
|
}
|