-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMovie.ts
62 lines (52 loc) · 1006 Bytes
/
Movie.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import {
Column,
CreateDateColumn,
Entity,
Index,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
export enum MovieStatus {
WillReleased = 'WILL_RELEASE',
Released = 'RELEASED',
Inactive = 'INACTIVE',
}
@Entity()
export class Movie {
@PrimaryGeneratedColumn()
public id: number;
@Index({ unique: true })
@Column({
length: 100,
})
public name: string;
@Column({
length: 255,
})
public description: string;
@Column('enum', {
enum: ['WILL_RELEASE', 'RELEASED', 'INACTIVE'],
})
public status: string;
@Column({
name: 'release_date',
type: 'date',
})
public releaseDate: Date;
@Column({
length: 100,
name: 'author_name',
})
public authorName: string;
@CreateDateColumn({
name: 'created_at',
})
public createdAt: Date;
@UpdateDateColumn({
name: 'updated_at',
})
public updatedAt: Date;
public isReleased(): boolean {
return this.status.toUpperCase() === MovieStatus.Released;
}
}