初始化游戏小组管理系统后端项目
- 基于 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:
189
src/modules/appointments/dto/appointment.dto.ts
Normal file
189
src/modules/appointments/dto/appointment.dto.ts
Normal file
@@ -0,0 +1,189 @@
|
||||
import {
|
||||
IsString,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsNumber,
|
||||
Min,
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsArray,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { AppointmentStatus } from '../../../common/enums';
|
||||
|
||||
export class CreateAppointmentDto {
|
||||
@ApiProperty({ description: '小组ID' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '小组ID不能为空' })
|
||||
groupId: string;
|
||||
|
||||
@ApiProperty({ description: '游戏ID' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '游戏ID不能为空' })
|
||||
gameId: string;
|
||||
|
||||
@ApiProperty({ description: '预约标题' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '预约标题不能为空' })
|
||||
title: string;
|
||||
|
||||
@ApiProperty({ description: '预约描述', required: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
description?: string;
|
||||
|
||||
@ApiProperty({ description: '预约开始时间' })
|
||||
@IsDateString()
|
||||
startTime: Date;
|
||||
|
||||
@ApiProperty({ description: '预约结束时间', required: false })
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
endTime?: Date;
|
||||
|
||||
@ApiProperty({ description: '最大参与人数', example: 5 })
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
@Type(() => Number)
|
||||
maxParticipants: number;
|
||||
}
|
||||
|
||||
export class UpdateAppointmentDto {
|
||||
@ApiProperty({ description: '预约标题', required: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
title?: string;
|
||||
|
||||
@ApiProperty({ description: '预约描述', required: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
description?: string;
|
||||
|
||||
@ApiProperty({ description: '预约开始时间', required: false })
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
startTime?: Date;
|
||||
|
||||
@ApiProperty({ description: '预约结束时间', required: false })
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
endTime?: Date;
|
||||
|
||||
@ApiProperty({ description: '最大参与人数', required: false })
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
maxParticipants?: number;
|
||||
|
||||
@ApiProperty({ description: '状态', enum: AppointmentStatus, required: false })
|
||||
@IsEnum(AppointmentStatus)
|
||||
@IsOptional()
|
||||
status?: AppointmentStatus;
|
||||
}
|
||||
|
||||
export class JoinAppointmentDto {
|
||||
@ApiProperty({ description: '预约ID' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '预约ID不能为空' })
|
||||
appointmentId: string;
|
||||
}
|
||||
|
||||
export class QueryAppointmentsDto {
|
||||
@ApiProperty({ description: '小组ID', required: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
groupId?: string;
|
||||
|
||||
@ApiProperty({ description: '游戏ID', required: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
gameId?: string;
|
||||
|
||||
@ApiProperty({ description: '状态', enum: AppointmentStatus, required: false })
|
||||
@IsEnum(AppointmentStatus)
|
||||
@IsOptional()
|
||||
status?: AppointmentStatus;
|
||||
|
||||
@ApiProperty({ description: '开始时间', required: false })
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
startTime?: Date;
|
||||
|
||||
@ApiProperty({ description: '结束时间', required: false })
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
endTime?: Date;
|
||||
|
||||
@ApiProperty({ description: '页码', example: 1, required: false })
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
page?: number;
|
||||
|
||||
@ApiProperty({ description: '每页数量', example: 10, required: false })
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export class PollOptionDto {
|
||||
@ApiProperty({ description: '选项时间' })
|
||||
@IsDateString()
|
||||
time: Date;
|
||||
|
||||
@ApiProperty({ description: '选项描述', required: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export class CreatePollDto {
|
||||
@ApiProperty({ description: '小组ID' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '小组ID不能为空' })
|
||||
groupId: string;
|
||||
|
||||
@ApiProperty({ description: '游戏ID' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '游戏ID不能为空' })
|
||||
gameId: string;
|
||||
|
||||
@ApiProperty({ description: '投票标题' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '投票标题不能为空' })
|
||||
title: string;
|
||||
|
||||
@ApiProperty({ description: '投票描述', required: false })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
description?: string;
|
||||
|
||||
@ApiProperty({ description: '投票选项', type: [PollOptionDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => PollOptionDto)
|
||||
options: PollOptionDto[];
|
||||
|
||||
@ApiProperty({ description: '投票截止时间' })
|
||||
@IsDateString()
|
||||
deadline: Date;
|
||||
}
|
||||
|
||||
export class VoteDto {
|
||||
@ApiProperty({ description: '投票ID' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '投票ID不能为空' })
|
||||
pollId: string;
|
||||
|
||||
@ApiProperty({ description: '选项索引' })
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
@Type(() => Number)
|
||||
optionIndex: number;
|
||||
}
|
||||
Reference in New Issue
Block a user