feat: 初始化DevOps平台后端
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { z } from 'zod';
|
||||
import { DeployEnvironment } from './deploy-run.types';
|
||||
|
||||
const optionalTrimmedString = (maxLength: number) =>
|
||||
z
|
||||
.string()
|
||||
.trim()
|
||||
.max(maxLength)
|
||||
.optional()
|
||||
.or(z.literal('').transform(() => undefined));
|
||||
|
||||
/**
|
||||
* 创建发布单的运行时校验规则;真实密钥和第三方参数不允许从前端传入。
|
||||
*/
|
||||
export const createDeployRunSchema = z.object({
|
||||
projectKey: z.string().trim().min(1).max(80),
|
||||
environment: z.enum(['test', 'production']),
|
||||
ref: z.string().trim().min(1).max(200),
|
||||
operator: z.string().trim().min(1).max(120),
|
||||
remark: optionalTrimmedString(500),
|
||||
idempotencyKey: optionalTrimmedString(260),
|
||||
});
|
||||
|
||||
export class CreateDeployRunDto {
|
||||
@ApiProperty({ example: 'access-manage' })
|
||||
projectKey!: string;
|
||||
|
||||
@ApiProperty({ enum: ['test', 'production'], example: 'test' })
|
||||
environment!: DeployEnvironment;
|
||||
|
||||
@ApiProperty({ example: 'develop' })
|
||||
ref!: string;
|
||||
|
||||
@ApiProperty({ example: 'operator@example.com' })
|
||||
operator!: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Manual test deploy before release.' })
|
||||
remark?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 'access-manage:test:develop:2026-06-11T10:00:00Z',
|
||||
})
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user