Files
gamegroup/src/entities/appointment.entity.ts
UGREEN USER b25aa5b143 初始化游戏小组管理系统后端项目
- 基于 NestJS + TypeScript + MySQL + Redis 架构
- 完整的模块化设计(认证、用户、小组、游戏、预约等)
- JWT 认证和 RBAC 权限控制系统
- Docker 容器化部署支持
- 添加 CLAUDE.md 项目开发指南
- 配置 .gitignore 忽略文件

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 10:42:06 +08:00

82 lines
1.8 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
OneToMany,
} from 'typeorm';
import { AppointmentStatus } from '../common/enums';
import { Group } from './group.entity';
import { Game } from './game.entity';
import { User } from './user.entity';
import { AppointmentParticipant } from './appointment-participant.entity';
@Entity('appointments')
export class Appointment {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
groupId: string;
@ManyToOne(() => Group, (group) => group.appointments, {
onDelete: 'CASCADE',
})
@JoinColumn({ name: 'groupId' })
group: Group;
@Column()
gameId: string;
@ManyToOne(() => Game, (game) => game.appointments)
@JoinColumn({ name: 'gameId' })
game: Game;
@Column()
initiatorId: string;
@ManyToOne(() => User, (user) => user.appointments)
@JoinColumn({ name: 'initiatorId' })
initiator: User;
@Column({ type: 'varchar', length: 200, nullable: true })
title: string;
@Column({ type: 'text', nullable: true })
description: string;
@Column({ type: 'datetime' })
startTime: Date;
@Column({ type: 'datetime', nullable: true })
endTime: Date;
@Column({ comment: '最大参与人数' })
maxParticipants: number;
@Column({ default: 0, comment: '当前参与人数' })
currentParticipants: number;
@Column({
type: 'enum',
enum: AppointmentStatus,
default: AppointmentStatus.OPEN,
})
status: AppointmentStatus;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
@OneToMany(
() => AppointmentParticipant,
(participant) => participant.appointment,
)
participants: AppointmentParticipant[];
}