mirror of
https://github.com/pacnpal/markov-discord.git
synced 2025-12-22 03:41:05 -05:00
Initial rough working draft of v3
This commit is contained in:
17
src/entity/Channel.ts
Normal file
17
src/entity/Channel.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { PrimaryColumn, Entity, ManyToOne, BaseEntity, Column } from 'typeorm';
|
||||
import { Guild } from './Guild';
|
||||
|
||||
@Entity()
|
||||
export class Channel extends BaseEntity {
|
||||
@PrimaryColumn()
|
||||
id: string;
|
||||
|
||||
@Column({
|
||||
default: true,
|
||||
})
|
||||
listen: boolean;
|
||||
|
||||
@ManyToOne(() => Guild, (guild) => guild.channels)
|
||||
guild: Guild;
|
||||
}
|
||||
12
src/entity/Guild.ts
Normal file
12
src/entity/Guild.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { BaseEntity, Entity, OneToMany, PrimaryColumn } from 'typeorm';
|
||||
import { Channel } from './Channel';
|
||||
|
||||
@Entity()
|
||||
export class Guild extends BaseEntity {
|
||||
@PrimaryColumn()
|
||||
id: string;
|
||||
|
||||
@OneToMany(() => Channel, (channel) => channel.guild, { onDelete: 'CASCADE', cascade: true })
|
||||
channels: Channel[];
|
||||
}
|
||||
Reference in New Issue
Block a user