52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { ApiProperty } from '@midwayjs/swagger';
|
|
import { Rule, RuleType } from '@midwayjs/validate';
|
|
/**
|
|
* 产品站点SKU信息DTO
|
|
*/
|
|
export class ProductSiteSkuDTO {
|
|
@ApiProperty({ description: '产品ID', example: 1 })
|
|
@Rule(RuleType.number().required())
|
|
productId: number;
|
|
|
|
@ApiProperty({ description: '站点SKU',nullable:true, example: 'SKU-001' })
|
|
siteSku?: string;
|
|
}
|
|
|
|
/**
|
|
* 同步单个产品到站点的请求DTO
|
|
*/
|
|
export class SyncProductToSiteDTO extends ProductSiteSkuDTO {
|
|
@ApiProperty({ description: '站点ID', example: 1 })
|
|
@Rule(RuleType.number().required())
|
|
siteId: number;
|
|
}
|
|
|
|
/**
|
|
* 同步到站点的结果DTO
|
|
*/
|
|
export class SyncProductToSiteResultDTO {
|
|
@ApiProperty({ description: '同步状态', example: true })
|
|
success: boolean;
|
|
|
|
@ApiProperty({ description: '远程产品ID', example: '123', required: false })
|
|
remoteId?: string;
|
|
|
|
@ApiProperty({ description: '错误信息', required: false })
|
|
error?: string;
|
|
}
|
|
|
|
|
|
/**
|
|
* 批量同步产品到站点的请求DTO
|
|
*/
|
|
export class BatchSyncProductToSiteDTO {
|
|
@ApiProperty({ description: '站点ID', example: 1 })
|
|
@Rule(RuleType.number().required())
|
|
siteId: number;
|
|
|
|
@ApiProperty({ description: '产品站点SKU列表', type: [ProductSiteSkuDTO] })
|
|
@Rule(RuleType.array().items(RuleType.object()).required().min(1))
|
|
data: ProductSiteSkuDTO[];
|
|
}
|
|
|