Files
Fabric.Backend.Guild/src/entities/channel.entity.ts
hzhang b1f7467161 feat(guild): add 'dm' x-type (private 1:1, always-wake)
channel enum + X_TYPES + realtime XType gain 'dm'. dm channels are
forced private (never public) and non-unique (no dedup; create()
always makes a fresh one). computeWakeup: dm wakes every non-author
participant unconditionally (no rotation / no wake_mapping). The
message.created realtime payload now carries xType so the plugin can
treat dm specially.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 09:18:19 +01:00

46 lines
1.2 KiB
TypeScript

import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
@Entity('channels')
@Index(['guildId', 'createdAt'])
export class Channel {
@PrimaryGeneratedColumn('uuid')
id!: string;
@Index()
@Column({ type: 'char', length: 36 })
guildId!: string;
@Column({ type: 'varchar', length: 120 })
name!: string;
@Column({
name: 'x_type',
type: 'enum',
enum: ['general', 'work', 'report', 'discuss', 'triage', 'custom', 'dm'],
})
xType!: 'general' | 'work' | 'report' | 'discuss' | 'triage' | 'custom' | 'dm';
@Column({ type: 'varchar', length: 16, default: 'text' })
kind!: 'text' | 'announcement';
@Column({ type: 'boolean', default: false })
isPrivate!: boolean;
// public channels are visible to every guild member (including those who
// join after the channel was created); default off (unchecked)
@Column({ type: 'boolean', default: false })
isPublic!: boolean;
// closed (e.g. discussion-complete): history readable, new posts rejected
@Column({ type: 'boolean', default: false })
closed!: boolean;
@Index()
@Column({ default: 0 })
lastSeq!: number;
@CreateDateColumn()
@Index()
createdAt!: Date;
}