Files
plates-server/src/challenges/dto/join-by-share-code.dto.ts
richarjiang 93b4fcf553 feat(challenges): 添加用户自定义挑战功能及分享机制
实现完整的自定义挑战系统,支持用户创建、分享和管理个人挑战:

- 数据库扩展:添加 source、creator_id、share_code、is_public、max_participants、challenge_state 字段
- 分享机制:自动生成6位唯一分享码,支持公开和私密模式
- API接口:创建挑战、通过分享码加入、获取创建列表、更新归档挑战、重新生成分享码
- 权限控制:创建者专属编辑权限,频率限制防滥用(每日5个)
- 业务逻辑:人数限制检查、挑战状态流转、参与者统计
- 文档完善:使用文档和部署指南,包含API示例和回滚方案

兼容现有系统挑战,使用相同的打卡、排行榜和勋章系统
2025-11-25 19:07:09 +08:00

16 lines
441 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNotEmpty, Length, Matches } from 'class-validator';
export class JoinByShareCodeDto {
@ApiProperty({
description: '分享码6-12位字符',
example: 'A3K9P2',
minLength: 6,
maxLength: 12
})
@IsString()
@IsNotEmpty()
@Length(6, 12)
@Matches(/^[A-Z0-9]+$/, { message: '分享码只能包含大写字母和数字' })
shareCode: string;
}