Files
dukang/server/dukang-api/src/modules/ops/dto/activity-poster.dto.ts
T
jacy 3166467518 feat(ops): v4.0.2 活动图模板、合伙人选择持久化与用户管理主图
HQ 上传底图与码栏;合伙人单选写入 partner_account.activity_poster_id,用户管理下次登录仍显示同一张图。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-30 21:36:43 +08:00

79 lines
1.3 KiB
TypeScript

import { Type } from 'class-transformer';
import {
IsIn,
IsInt,
IsNumber,
IsOptional,
IsString,
Max,
MaxLength,
Min,
MinLength,
ValidateIf,
} from 'class-validator';
import { ACTIVITY_POSTER_STATUSES } from '@dukang/shared-types';
import { PaginationQueryDto } from './admin-query.dto';
export class ActivityPosterQueryDto extends PaginationQueryDto {
@IsOptional()
@IsIn([...ACTIVITY_POSTER_STATUSES])
status?: string;
}
export class UpsertActivityPosterDto {
@IsString()
@MinLength(1)
@MaxLength(128)
title!: string;
@IsOptional()
@IsString()
@MaxLength(4000)
copyText?: string;
@IsString()
@MinLength(1)
@MaxLength(512)
imageUrl!: string;
@Type(() => Number)
@IsNumber()
@Min(0)
@Max(100)
qrXPct!: number;
@Type(() => Number)
@IsNumber()
@Min(0)
@Max(100)
qrYPct!: number;
@Type(() => Number)
@IsNumber()
@Min(5)
@Max(50)
qrSizePct!: number;
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(0)
sortOrder?: number;
@IsOptional()
@IsIn([...ACTIVITY_POSTER_STATUSES])
status?: string;
}
export class UpdateActivityPosterStatusDto {
@IsIn([...ACTIVITY_POSTER_STATUSES])
status!: string;
}
export class ActivityPosterSelectionDto {
@IsOptional()
@ValidateIf((_, value) => value != null)
@IsString()
posterId?: string | null;
}