Implemented DMs and group DMs
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user