summary refs log tree commit diff
path: root/util/src/entities/Channel.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-26 20:48:09 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-26 20:48:09 +0200
commit18deb1e4b0ea5b709a854966166077faa537ebef (patch)
treecf1d0516b47f368666a31f2428ca694c807e395b /util/src/entities/Channel.ts
parent:bug: fix unit tests (diff)
downloadserver-18deb1e4b0ea5b709a854966166077faa537ebef.tar.xz
:sparkles: use RelationId
Diffstat (limited to '')
-rw-r--r--util/src/entities/Channel.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts

index 5845607a..d26f1054 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts
@@ -1,4 +1,4 @@ -import { Column, Entity, JoinColumn, ManyToMany, ManyToOne } from "typeorm"; +import { Column, Entity, JoinColumn, ManyToMany, ManyToOne, RelationId } from "typeorm"; import { BaseClass } from "./BaseClass"; import { Guild } from "./Guild"; import { Message } from "./Message"; @@ -25,35 +25,35 @@ export class Channel extends BaseClass { @Column({ type: "simple-enum", enum: ChannelType }) type: ChannelType; - @Column("simple-array") + @RelationId((channel: Channel) => channel.recipients) recipient_ids: string[]; @JoinColumn({ name: "recipient_ids" }) @ManyToMany(() => User, (user: User) => user.id) recipients?: User[]; - @Column() + @RelationId((channel: Channel) => channel.last_message) last_message_id: string; @JoinColumn({ name: "last_message_id" }) @ManyToOne(() => Message, (message: Message) => message.id) last_message?: Message; - @Column() + @RelationId((channel: Channel) => channel.guild) guild_id?: string; @JoinColumn({ name: "guild_id" }) @ManyToOne(() => Guild, (guild: Guild) => guild.id) guild: Guild; - @Column() + @RelationId((channel: Channel) => channel.parent) parent_id: string; @JoinColumn({ name: "parent_id" }) @ManyToOne(() => Channel, (channel: Channel) => channel.id) parent?: Channel; - @Column() + @RelationId((channel: Channel) => channel.owner) owner_id: string; @JoinColumn({ name: "owner_id" })