Files
telegram-management-system/backend-nestjs/src/database/entities/message.entity.ts
你的用户名 237c7802e5
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit: Telegram Management System
Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 15:37:50 +08:00

74 lines
2.0 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
Index,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { TgAccount } from './tg-account.entity';
import { Group } from './group.entity';
@Entity('message')
@Index(['senderId', 'createdAt'])
@Index(['groupId', 'createdAt'])
export class Message {
@ApiProperty({ description: '消息ID' })
@PrimaryGeneratedColumn()
id: number;
@ApiProperty({ description: '发送者ID' })
@Column({ nullable: true, comment: '发送者ID' })
senderId: number;
@ApiProperty({ description: '群组ID' })
@Column({ nullable: true, comment: '群组ID' })
groupId: number;
@ApiProperty({ description: '消息内容' })
@Column({ type: 'text', comment: '消息内容' })
content: string;
@ApiProperty({ description: '消息类型' })
@Column({ default: 1, comment: '消息类型: 1文本 2图片 3视频 4文件' })
type: number;
@ApiProperty({ description: 'Telegram消息ID' })
@Column({ nullable: true, comment: 'Telegram消息ID' })
telegramMessageId: string;
@ApiProperty({ description: '回复消息ID' })
@Column({ nullable: true, comment: '回复消息ID' })
replyToMessageId: number;
@ApiProperty({ description: '媒体文件信息' })
@Column({ type: 'json', nullable: true, comment: '媒体文件信息' })
media: any;
@ApiProperty({ description: '状态' })
@Column({ default: 1, comment: '状态: 1正常 2删除' })
status: number;
@ApiProperty({ description: '发送时间' })
@Column({ type: 'datetime', nullable: true, comment: '发送时间' })
sentAt: Date;
@ManyToOne(() => TgAccount)
@JoinColumn({ name: 'senderId' })
sender: TgAccount;
@ManyToOne(() => Group)
@JoinColumn({ name: 'groupId' })
group: Group;
@ApiProperty({ description: '创建时间' })
@CreateDateColumn()
createdAt: Date;
@ApiProperty({ description: '更新时间' })
@UpdateDateColumn()
updatedAt: Date;
}