feat(guild-model): complete guild/channel/dm entities
This commit is contained in:
@@ -5,12 +5,18 @@ export class Channel {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column()
|
||||
@Column({ type: 'char', length: 36 })
|
||||
guildId!: string;
|
||||
|
||||
@Column()
|
||||
@Column({ type: 'varchar', length: 120 })
|
||||
name!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 16, default: 'text' })
|
||||
kind!: 'text' | 'announcement';
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
isPrivate!: boolean;
|
||||
|
||||
@Index()
|
||||
@Column({ default: 0 })
|
||||
lastSeq!: number;
|
||||
|
||||
16
Fabric.Backend.Guild/src/entities/dm-conversation.entity.ts
Normal file
16
Fabric.Backend.Guild/src/entities/dm-conversation.entity.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity('dm_conversations')
|
||||
export class DmConversation {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 64, unique: true })
|
||||
pairKey!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 255, nullable: true })
|
||||
topic!: string | null;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date;
|
||||
}
|
||||
19
Fabric.Backend.Guild/src/entities/dm-participant.entity.ts
Normal file
19
Fabric.Backend.Guild/src/entities/dm-participant.entity.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity('dm_participants')
|
||||
export class DmParticipant {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column({ type: 'char', length: 36 })
|
||||
conversationId!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 64 })
|
||||
userId!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 16, default: 'member' })
|
||||
role!: 'member';
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date;
|
||||
}
|
||||
@@ -5,9 +5,15 @@ export class Guild {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column()
|
||||
@Column({ type: 'varchar', length: 120 })
|
||||
name!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 120, unique: true })
|
||||
slug!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 64, nullable: true })
|
||||
ownerUserId!: string | null;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date;
|
||||
}
|
||||
|
||||
@@ -2,13 +2,21 @@ import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn } from
|
||||
|
||||
@Entity('messages')
|
||||
@Index(['channelId', 'seq'], { unique: true })
|
||||
@Index(['conversationId', 'seq'], { unique: true })
|
||||
export class Message {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Index()
|
||||
@Column()
|
||||
channelId!: string;
|
||||
@Column({ type: 'char', length: 36, nullable: true })
|
||||
channelId!: string | null;
|
||||
|
||||
@Index()
|
||||
@Column({ type: 'char', length: 36, nullable: true })
|
||||
conversationId!: string | null;
|
||||
|
||||
@Column({ type: 'varchar', length: 64 })
|
||||
authorUserId!: string;
|
||||
|
||||
@Column()
|
||||
seq!: number;
|
||||
|
||||
Reference in New Issue
Block a user