feat: 搭建 NestJS 后端基础设施与 Prisma 数据模型

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nixevol
2026-06-28 15:35:47 +08:00
co-authored by Cursor
parent 3e9ab08881
commit 9629597b1d
23 changed files with 8051 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsInt, IsOptional, Max, Min } from 'class-validator';
export class PaginationDto {
@ApiPropertyOptional({ description: '页码,从 1 开始', default: 1 })
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
page = 1;
@ApiPropertyOptional({ description: '每页条数', default: 10 })
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
@Max(200)
pageSize = 10;
get skip(): number {
return (this.page - 1) * this.pageSize;
}
get take(): number {
return this.pageSize;
}
}