1import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
2import { ObjectType, Field, Int, InputType } from 'type-graphql'
3import { registerEnumType } from "type-graphql";
4
5
6enum FilmRatings{
7PG13 = "PG-13",
8 NC17 = "NC-17",
9 R = "R",
10 G = "G",
11 PG = "PG"
12}
13
14
15registerEnumType(FilmRatings, {
16 name: "rating",
17 description: "The film rating",
18});
19
20@ObjectType()
21@InputType()
22@Entity()
23export class Film {
24 @Field(() => Int)
25 @PrimaryGeneratedColumn()
26 film_id: number;
27
28 @Field(()=>String)
29 @Column({ type: "text" })
30 title: string;
31
32 @Field(() => Int)
33 @Column({ type: "integer" })
34 release_year: number;
35
36 @Field(() => Int)
37 @Column({ type: "smallint" })
38 language_id: number;
39
40 @Field(() => Int)
41 @Column({ type: "smallint" })
42 rental_duration: number;
43
44 @Field(() => Int)
45 @Column({ type: "numeric" })
46 rental_rate: number;
47
48 @Field(() => Int)
49 @Column({ type: "smallint" })
50 length: number;
51
52 @Field(() => Int)
53 @Column({ type: "numeric" })
54 replacement_cost: number;
55
56 @Field(()=>FilmRatings)
57 @Column({ type: "enum",enumName: "rating" })
58 rating: FilmRatings
59
60 @Field(() => String)
61 @Column({ type: "timestamp without time zone" })
62 last_update: Date;
63
64 @Field(() => [String])
65 @Column({ type: "text", array: true })
66 special_features: string[];
67
68 @Field(()=>String)
69 @Column({ type: "text" })
70 fulltext: string;
71
72}
73
74