-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.entity.ts
More file actions
64 lines (46 loc) · 1.53 KB
/
app.entity.ts
File metadata and controls
64 lines (46 loc) · 1.53 KB
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
63
64
import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, Unique } from "typeorm";
import { AppStatus } from "@domain/common/enum/appStatus";
import { Link, AppReviewHistory, Rating, Tag, User } from "@domain/entities";
import { BaseSoftDelete } from "../base";
@Entity()
export class App extends BaseSoftDelete {
@Column()
public name: string;
@Column()
public ownerId: string;
@Column({
type: "enum",
enum: AppStatus,
default: AppStatus.PENDING,
})
public status: AppStatus;
@Column({ default: false })
public isAutoPublished: boolean;
@Column({ nullable: true })
public installLink: string;
@Column({ nullable: true })
public headline: string;
@Column({ nullable: true })
public description: string;
@Column({ nullable: true })
public prefix: string;
@Column({ nullable: true })
public featuredImage: string;
@Column({ nullable: true })
public supportUrl: string;
@Column({ nullable: true })
public remark: string;
@ManyToMany(() => Tag, (tag) => tag.apps)
@JoinTable()
public tags: Tag[];
@ManyToMany(() => Link, (link) => link.apps)
@JoinTable()
public socialLinks: Link[];
@OneToMany(() => AppReviewHistory, (review) => review.app)
reviewHistories: AppReviewHistory[];
@OneToMany(() => Rating, (rating) => rating.app)
ratings: Rating[];
@ManyToOne(() => User, (user) => user.apps, { onDelete: "CASCADE" })
@JoinColumn({ name: "ownerId" })
owner: User;
}