summary refs log tree commit diff
path: root/src/database/entities/Stream.ts
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-06-11 22:16:07 +0200
committerRory& <root@rory.gay>2026-06-12 17:58:18 +0200
commitc77d00e243f7cf104b8b0f8b26f339849dbd040f (patch)
tree457a1aac1da052b3be56812a90c8ca50e6b3df51 /src/database/entities/Stream.ts
parentMove database to toplevel (diff)
downloadserver-ts-c77d00e243f7cf104b8b0f8b26f339849dbd040f.tar.xz
Move entities to database
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; +}