diff options
author | AlTech98 <altech123159@gmail.com> | 2021-09-16 21:33:36 +0200 |
---|---|---|
committer | AlTech98 <altech123159@gmail.com> | 2021-09-16 21:33:36 +0200 |
commit | 4f87fd742f25a25782afb20131200bcff81b50f7 (patch) | |
tree | 9588f6319e6b21eb4415e796a690a57b6e7ecb50 /util/src/entities | |
parent | Dummy sticker-packs routes (diff) | |
download | server-4f87fd742f25a25782afb20131200bcff81b50f7.tar.xz |
Implemented DMs and group DMs
Diffstat (limited to 'util/src/entities')
-rw-r--r-- | util/src/entities/Channel.ts | 15 | ||||
-rw-r--r-- | util/src/entities/Recipient.ts | 3 | ||||
-rw-r--r-- | util/src/entities/User.ts | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index fc954f63..6eac19ca 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -1,7 +1,6 @@ -import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, RelationId } from "typeorm"; +import { Column, Entity, JoinColumn, ManyToOne, OneToMany, RelationId } from "typeorm"; import { BaseClass } from "./BaseClass"; import { Guild } from "./Guild"; -import { Message } from "./Message"; import { User } from "./User"; import { HTTPError } from "lambert-server"; import { emitEvent, getPermission, Snowflake } from "../util"; @@ -31,6 +30,9 @@ export class Channel extends BaseClass { @Column({ nullable: true }) name?: string; + @Column({ nullable: true }) + icon?: string; + @Column({ type: "simple-enum", enum: ChannelType }) type: ChannelType; @@ -38,13 +40,8 @@ export class Channel extends BaseClass { recipients?: Recipient[]; @Column({ nullable: true }) - @RelationId((channel: Channel) => channel.last_message) last_message_id: string; - @JoinColumn({ name: "last_message_id" }) - @ManyToOne(() => Message) - last_message?: Message; - @Column({ nullable: true }) @RelationId((channel: Channel) => channel.guild) guild_id?: string; @@ -162,6 +159,10 @@ export class Channel extends BaseClass { return channel; } + + isDm() { + return this.type === ChannelType.DM || this.type === ChannelType.GROUP_DM + } } export interface ChannelPermissionOverwrite { diff --git a/util/src/entities/Recipient.ts b/util/src/entities/Recipient.ts index 2a27b29f..bb280588 100644 --- a/util/src/entities/Recipient.ts +++ b/util/src/entities/Recipient.ts @@ -19,5 +19,8 @@ export class Recipient extends BaseClass { @ManyToOne(() => require("./User").User) user: import("./User").User; + @Column({ default: false }) + closed: boolean; + // TODO: settings/mute/nick/added at/encryption keys/read_state } diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index 736704f8..cef88777 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -124,7 +124,7 @@ export class User extends BaseClass { flags: string; // UserFlags @Column() - public_flags: string; + public_flags: number; @JoinColumn({ name: "relationship_ids" }) @OneToMany(() => Relationship, (relationship: Relationship) => relationship.from) |