初始化游戏小组管理系统后端项目
- 基于 NestJS + TypeScript + MySQL + Redis 架构 - 完整的模块化设计(认证、用户、小组、游戏、预约等) - JWT 认证和 RBAC 权限控制系统 - Docker 容器化部署支持 - 添加 CLAUDE.md 项目开发指南 - 配置 .gitignore 忽略文件 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
69
src/entities/group.entity.ts
Normal file
69
src/entities/group.entity.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
OneToMany,
|
||||
} from 'typeorm';
|
||||
import { User } from './user.entity';
|
||||
import { GroupMember } from './group-member.entity';
|
||||
import { Appointment } from './appointment.entity';
|
||||
|
||||
@Entity('groups')
|
||||
export class Group {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ length: 100 })
|
||||
name: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
description: string;
|
||||
|
||||
@Column({ type: 'varchar', nullable: true, length: 255 })
|
||||
avatar: string;
|
||||
|
||||
@Column()
|
||||
ownerId: string;
|
||||
|
||||
@ManyToOne(() => User)
|
||||
@JoinColumn({ name: 'ownerId' })
|
||||
owner: User;
|
||||
|
||||
@Column({ default: 'normal', length: 20, comment: '类型: normal/guild' })
|
||||
type: string;
|
||||
|
||||
@Column({ nullable: true, comment: '父组ID,用于子组' })
|
||||
parentId: string;
|
||||
|
||||
@ManyToOne(() => Group, { nullable: true })
|
||||
@JoinColumn({ name: 'parentId' })
|
||||
parent: Group;
|
||||
|
||||
@Column({ type: 'text', nullable: true, comment: '公示信息' })
|
||||
announcement: string;
|
||||
|
||||
@Column({ default: 50, comment: '最大成员数' })
|
||||
maxMembers: number;
|
||||
|
||||
@Column({ default: 1, comment: '当前成员数' })
|
||||
currentMembers: number;
|
||||
|
||||
@Column({ default: true })
|
||||
isActive: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
|
||||
@OneToMany(() => GroupMember, (member) => member.group)
|
||||
members: GroupMember[];
|
||||
|
||||
@OneToMany(() => Appointment, (appointment) => appointment.group)
|
||||
appointments: Appointment[];
|
||||
}
|
||||
Reference in New Issue
Block a user