summary refs log tree commit diff
path: root/src/database/entities/Stream.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/entities/Stream.ts')
-rw-r--r--src/database/entities/Stream.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/database/entities/Stream.ts b/src/database/entities/Stream.ts
new file mode 100644

index 00000000..bf2f3a62 --- /dev/null +++ b/src/database/entities/Stream.ts
@@ -0,0 +1,32 @@ +import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; +import { BaseClass } from "./BaseClass"; +import { User } from "./User"; +import { Channel } from "./Channel"; + +@Entity({ + name: "streams", +}) +export class Stream extends BaseClass { + @Column() + @RelationId((stream: Stream) => stream.owner) + owner_id: string; + + @JoinColumn({ name: "owner_id" }) + @ManyToOne(() => User, { + onDelete: "CASCADE", + }) + owner: User; + + @Column() + @RelationId((stream: Stream) => stream.channel) + channel_id: string; + + @JoinColumn({ name: "channel_id" }) + @ManyToOne(() => Channel, { + onDelete: "CASCADE", + }) + channel: Channel; + + @Column() + endpoint: string; +}