| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794 |
- import { z } from '@hono/zod-openapi';
- import { OrderStatus, WorkStatus } from '@d8d/allin-enums';
- import { DisabledPersonSchema } from '@d8d/allin-disability-module/schemas';
- // 资产类型枚举 - 从实体移到schema,供前端使用
- export enum AssetType {
- TAX = 'tax',
- SALARY = 'salary',
- JOB_RESULT = 'job_result',
- CONTRACT_SIGN = 'contract_sign',
- DISABILITY_CERT = 'disability_cert',
- OTHER = 'other',
- SALARY_VIDEO = 'salary_video',
- TAX_VIDEO = 'tax_video',
- CHECKIN_VIDEO = 'checkin_video',
- WORK_VIDEO = 'work_video',
- }
- // 资产文件类型枚举 - 从实体移到schema,供前端使用
- export enum AssetFileType {
- IMAGE = 'image',
- VIDEO = 'video',
- }
- // 视频审核状态枚举
- export enum AssetStatus {
- PENDING = 'pending',
- VERIFIED = 'verified',
- REJECTED = 'rejected'
- }
- // 用工订单实体Schema
- export const EmploymentOrderSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- orderName: z.string().max(50).nullable().optional().openapi({
- description: '订单名称',
- example: '2024年Q1用工订单'
- }),
- platformId: z.number().int().positive().openapi({
- description: '用人平台ID',
- example: 1
- }),
- companyId: z.number().int().positive().openapi({
- description: '用人单位ID',
- example: 1
- }),
- channelId: z.number().int().positive().nullable().optional().openapi({
- description: '渠道ID',
- example: 1
- }),
- expectedStartDate: z.coerce.date().nullable().optional().openapi({
- description: '预计开始日期',
- example: '2024-01-01T00:00:00Z'
- }),
- actualStartDate: z.coerce.date().nullable().optional().openapi({
- description: '实际开始日期',
- example: '2024-01-01T00:00:00Z'
- }),
- actualEndDate: z.coerce.date().nullable().optional().openapi({
- description: '实际结束日期',
- example: '2024-12-31T00:00:00Z'
- }),
- orderStatus: z.nativeEnum(OrderStatus).default(OrderStatus.DRAFT).openapi({
- description: '订单状态:draft-草稿, confirmed-已确认, in_progress-进行中, completed-已完成, cancelled-已取消',
- example: OrderStatus.DRAFT
- }),
- workStatus: z.nativeEnum(WorkStatus).default(WorkStatus.NOT_WORKING).openapi({
- description: '工作状态:not_working-未就业, pre_working-待就业, working-已就业, resigned-已离职',
- example: WorkStatus.NOT_WORKING
- }),
- createTime: z.coerce.date().openapi({
- description: '创建时间',
- example: '2024-01-01T00:00:00Z'
- }),
- updateTime: z.coerce.date().openapi({
- description: '更新时间',
- example: '2024-01-01T00:00:00Z'
- }),
- orderPersons: z.array(z.lazy(() => OrderPersonSchema)).optional().openapi({
- description: '订单关联人员列表',
- example: []
- })
- });
- // 创建用工订单DTO
- export const CreateEmploymentOrderSchema = z.object({
- orderName: z.string().max(50).optional().openapi({
- description: '订单名称',
- example: '2024年Q1用工订单'
- }),
- platformId: z.coerce.number().int().positive().openapi({
- description: '用人平台ID',
- example: 1
- }),
- companyId: z.coerce.number().int().positive().openapi({
- description: '用人单位ID',
- example: 1
- }),
- channelId: z.coerce.number().int().positive().optional().openapi({
- description: '渠道ID',
- example: 1
- }),
- expectedStartDate: z.coerce.date().optional().openapi({
- description: '预计开始日期',
- example: '2024-01-01T00:00:00Z'
- }),
- actualStartDate: z.coerce.date().optional().openapi({
- description: '实际开始日期',
- example: '2024-01-01T00:00:00Z'
- }),
- actualEndDate: z.coerce.date().optional().openapi({
- description: '实际结束日期',
- example: '2024-12-31T00:00:00Z'
- }),
- orderStatus: z.nativeEnum(OrderStatus).default(OrderStatus.DRAFT).optional().openapi({
- description: '订单状态:draft-草稿, confirmed-已确认, in_progress-进行中, completed-已完成, cancelled-已取消',
- example: OrderStatus.DRAFT
- }),
- workStatus: z.nativeEnum(WorkStatus).default(WorkStatus.NOT_WORKING).optional().openapi({
- description: '工作状态:not_working-未就业, pre_working-待就业, working-已就业, resigned-已离职',
- example: WorkStatus.NOT_WORKING
- })
- });
- // 更新用工订单DTO
- export const UpdateEmploymentOrderSchema = z.object({
- id: z.coerce.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- orderName: z.string().max(50).optional().openapi({
- description: '订单名称',
- example: '2024年Q1用工订单'
- }),
- platformId: z.coerce.number().int().positive().optional().openapi({
- description: '用人平台ID',
- example: 1
- }),
- companyId: z.coerce.number().int().positive().optional().openapi({
- description: '用人单位ID',
- example: 1
- }),
- channelId: z.coerce.number().int().positive().optional().openapi({
- description: '渠道ID',
- example: 1
- }),
- expectedStartDate: z.coerce.date().optional().openapi({
- description: '预计开始日期',
- example: '2024-01-01T00:00:00Z'
- }),
- actualStartDate: z.coerce.date().optional().openapi({
- description: '实际开始日期',
- example: '2024-01-01T00:00:00Z'
- }),
- actualEndDate: z.coerce.date().optional().openapi({
- description: '实际结束日期',
- example: '2024-12-31T00:00:00Z'
- }),
- orderStatus: z.nativeEnum(OrderStatus).optional().openapi({
- description: '订单状态:draft-草稿, confirmed-已确认, in_progress-进行中, completed-已完成, cancelled-已取消',
- example: OrderStatus.DRAFT
- }),
- workStatus: z.nativeEnum(WorkStatus).optional().openapi({
- description: '工作状态:not_working-未就业, pre_working-待就业, working-已就业, resigned-已离职',
- example: WorkStatus.NOT_WORKING
- })
- });
- // 订单人员关联实体Schema
- export const OrderPersonSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '关联ID',
- example: 1
- }),
- orderId: z.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.number().int().positive().openapi({
- description: '残疾人ID',
- example: 1
- }),
- joinDate: z.coerce.date().openapi({
- description: '入职日期',
- example: '2024-01-01T00:00:00Z'
- }),
- actualStartDate: z.coerce.date().nullable().optional().openapi({
- description: '实际入职日期',
- example: '2024-01-15T00:00:00Z'
- }),
- leaveDate: z.coerce.date().nullable().optional().openapi({
- description: '离职日期',
- example: '2024-12-31T00:00:00Z'
- }),
- workStatus: z.nativeEnum(WorkStatus).default(WorkStatus.NOT_WORKING).openapi({
- description: '工作状态:not_working-未就业, pre_working-待就业, working-已就业, resigned-已离职',
- example: WorkStatus.NOT_WORKING
- }),
- salaryDetail: z.coerce.number().positive().openapi({
- description: '个人薪资',
- example: 5000.00
- }),
- // 残疾人员的详细信息
- person: DisabledPersonSchema.pick({
- id: true,
- name: true,
- gender: true,
- disabilityType: true,
- phone: true,
- disabilityId: true
- }).partial().nullable().optional().openapi({
- description: '残疾人员详细信息'
- })
- });
- // 创建订单人员关联DTO
- export const CreateOrderPersonSchema = z.object({
- orderId: z.coerce.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.coerce.number().int().positive().openapi({
- description: '残疾人ID',
- example: 1
- }),
- joinDate: z.coerce.date().openapi({
- description: '入职日期',
- example: '2024-01-01T00:00:00Z'
- }),
- leaveDate: z.coerce.date().optional().openapi({
- description: '离职日期',
- example: '2024-12-31T00:00:00Z'
- }),
- workStatus: z.nativeEnum(WorkStatus).default(WorkStatus.NOT_WORKING).optional().openapi({
- description: '工作状态:not_working-未就业, pre_working-待就业, working-已就业, resigned-已离职',
- example: WorkStatus.NOT_WORKING
- }),
- salaryDetail: z.coerce.number().positive().openapi({
- description: '个人薪资',
- example: 5000.00
- })
- });
- // 批量添加人员DTO(不需要orderId,从URL参数获取)
- export const BatchAddPersonItemSchema = z.object({
- personId: z.coerce.number().int().positive().openapi({
- description: '残疾人ID',
- example: 1
- }),
- joinDate: z.coerce.date().openapi({
- description: '入职日期',
- example: '2024-01-01T00:00:00Z'
- }),
- leaveDate: z.coerce.date().optional().openapi({
- description: '离职日期',
- example: '2024-12-31T00:00:00Z'
- }),
- workStatus: z.nativeEnum(WorkStatus).default(WorkStatus.NOT_WORKING).optional().openapi({
- description: '工作状态:not_working-未就业, pre_working-待就业, working-已就业, resigned-已离职',
- example: WorkStatus.NOT_WORKING
- }),
- salaryDetail: z.coerce.number().positive().openapi({
- description: '个人薪资',
- example: 5000.00
- })
- });
- // 订单人员资产实体Schema
- export const OrderPersonAssetSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '关联ID',
- example: 1
- }),
- orderId: z.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.number().int().positive().openapi({
- description: '残疾人ID',
- example: 1
- }),
- assetType: z.nativeEnum(AssetType).openapi({
- description: '资产类型:tax-税务, salary-薪资, job_result-工作成果, contract_sign-合同签署, disability_cert-残疾证明, other-其他, salary_video-工资视频, tax_video-个税视频, checkin_video-打卡视频, work_video-工作视频',
- example: AssetType.SALARY
- }),
- assetFileType: z.nativeEnum(AssetFileType).openapi({
- description: '资产文件类型:image-图片, video-视频',
- example: AssetFileType.IMAGE
- }),
- status: z.nativeEnum(AssetStatus).optional().openapi({
- description: '视频审核状态:pending-待审核, verified-已验证, rejected-已拒绝',
- example: AssetStatus.PENDING
- }),
- fileId: z.number().int().positive().openapi({
- description: '文件ID,引用files表',
- example: 1
- }),
- relatedTime: z.coerce.date().openapi({
- description: '关联时间',
- example: '2024-01-01T00:00:00Z'
- }),
- updateTime: z.coerce.date().openapi({
- description: '更新时间',
- example: '2024-01-01T00:00:00Z'
- })
- });
- // 创建订单人员资产DTO
- export const CreateOrderPersonAssetSchema = z.object({
- orderId: z.coerce.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.coerce.number().int().positive().openapi({
- description: '残疾人ID',
- example: 1
- }),
- assetType: z.nativeEnum(AssetType).openapi({
- description: '资产类型:tax-税务, salary-薪资, job_result-工作成果, contract_sign-合同签署, disability_cert-残疾证明, other-其他, salary_video-工资视频, tax_video-个税视频, checkin_video-打卡视频, work_video-工作视频',
- example: AssetType.SALARY
- }),
- assetFileType: z.nativeEnum(AssetFileType).openapi({
- description: '资产文件类型:image-图片, video-视频',
- example: AssetFileType.IMAGE
- }),
- fileId: z.coerce.number().int().positive().openapi({
- description: '文件ID,引用files表',
- example: 1
- }),
- relatedTime: z.coerce.date().optional().openapi({
- description: '关联时间',
- example: '2024-01-01T00:00:00Z'
- })
- });
- // 分页查询参数Schema
- export const PaginationQuerySchema = z.object({
- skip: z.coerce.number().int().min(0).default(0).optional().openapi({
- description: '跳过记录数',
- example: 0
- }),
- take: z.coerce.number().int().min(1).max(100).default(10).optional().openapi({
- description: '获取记录数',
- example: 10
- })
- });
- // 删除订单DTO
- export const DeleteOrderSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- })
- });
- // 删除订单人员DTO
- export const DeleteOrderPersonSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '关联ID',
- example: 1
- })
- });
- // 删除订单人员资产DTO
- export const DeleteOrderPersonAssetSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '关联ID',
- example: 1
- })
- });
- // 类型定义
- export type EmploymentOrder = z.infer<typeof EmploymentOrderSchema>;
- export type CreateEmploymentOrderDto = z.infer<typeof CreateEmploymentOrderSchema>;
- export type UpdateEmploymentOrderDto = z.infer<typeof UpdateEmploymentOrderSchema>;
- export type OrderPerson = z.infer<typeof OrderPersonSchema>;
- export type CreateOrderPersonDto = z.infer<typeof CreateOrderPersonSchema>;
- export type OrderPersonAsset = z.infer<typeof OrderPersonAssetSchema>;
- export type CreateOrderPersonAssetDto = z.infer<typeof CreateOrderPersonAssetSchema>;
- export type PaginationQuery = z.infer<typeof PaginationQuerySchema>;
- export type DeleteOrderDto = z.infer<typeof DeleteOrderSchema>;
- export type DeleteOrderPersonDto = z.infer<typeof DeleteOrderPersonSchema>;
- export type DeleteOrderPersonAssetDto = z.infer<typeof DeleteOrderPersonAssetSchema>;
- export type UpdatePersonWorkStatusDto = z.infer<typeof UpdatePersonWorkStatusSchema>;
- // 查询订单参数Schema
- export const QueryOrderSchema = z.object({
- orderName: z.string().optional().openapi({
- description: '订单名称',
- example: '2024年Q1用工订单'
- }),
- platformId: z.coerce.number().int().positive().optional().openapi({
- description: '用人平台ID',
- example: 1
- }),
- companyId: z.coerce.number().int().positive().optional().openapi({
- description: '用人单位ID',
- example: 1
- }),
- channelId: z.coerce.number().int().positive().optional().openapi({
- description: '渠道ID',
- example: 1
- }),
- orderStatus: z.nativeEnum(OrderStatus).optional().openapi({
- description: '订单状态',
- example: OrderStatus.DRAFT
- }),
- startDate: z.string().optional().openapi({
- description: '开始日期(YYYY-MM-DD格式)',
- example: '2024-01-01'
- }),
- endDate: z.string().optional().openapi({
- description: '结束日期(YYYY-MM-DD格式)',
- example: '2024-12-31'
- }),
- page: z.coerce.number().int().min(1).default(1).optional().openapi({
- description: '页码',
- example: 1
- }),
- limit: z.coerce.number().int().min(1).max(100).default(10).optional().openapi({
- description: '每页数量',
- example: 10
- })
- });
- // 查询订单人员资产参数Schema
- export const QueryOrderPersonAssetSchema = z.object({
- orderId: z.coerce.number().int().positive().optional().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.coerce.number().int().positive().optional().openapi({
- description: '人员ID',
- example: 1
- }),
- assetType: z.nativeEnum(AssetType).optional().openapi({
- description: '资产类型:tax-税务, salary-薪资, job_result-工作成果, contract_sign-合同签署, disability_cert-残疾证明, other-其他, salary_video-工资视频, tax_video-个税视频, checkin_video-打卡视频, work_video-工作视频',
- example: AssetType.SALARY
- }),
- assetFileType: z.nativeEnum(AssetFileType).optional().openapi({
- description: '资产文件类型',
- example: AssetFileType.IMAGE
- }),
- page: z.coerce.number().int().min(1).default(1).optional().openapi({
- description: '页码',
- example: 1
- }),
- limit: z.coerce.number().int().min(1).max(100).default(10).optional().openapi({
- description: '每页数量',
- example: 10
- })
- });
- // 为兼容性添加别名导出
- export const CreateOrderSchema = CreateEmploymentOrderSchema;
- export const UpdateOrderSchema = UpdateEmploymentOrderSchema;
- export const BatchAddPersonsSchema = z.object({
- persons: z.array(BatchAddPersonItemSchema).openapi({
- description: '人员列表',
- example: [{ personId: 1, joinDate: '2024-01-01T00:00:00Z', salaryDetail: 5000 }]
- })
- });
- // 更新订单人员工作状态DTO
- export const UpdatePersonWorkStatusSchema = z.object({
- orderId: z.coerce.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.coerce.number().int().positive().openapi({
- description: '人员ID',
- example: 1
- }),
- workStatus: z.nativeEnum(WorkStatus).openapi({
- description: '工作状态:not_working-未就业, pre_working-待就业, working-已就业, resigned-已离职',
- example: WorkStatus.WORKING
- })
- });
- // 打卡数据统计响应Schema
- export const CheckinStatisticsResponseSchema = z.object({
- companyId: z.number().int().positive().openapi({
- description: '企业ID',
- example: 1
- }),
- checkinVideoCount: z.number().int().min(0).openapi({
- description: '打卡视频数量',
- example: 10
- }),
- totalVideos: z.number().int().min(0).openapi({
- description: '总视频数量',
- example: 25
- })
- });
- // 视频统计项Schema
- export const VideoStatItemSchema = z.object({
- assetType: z.nativeEnum(AssetType).openapi({
- description: '视频类型',
- example: AssetType.CHECKIN_VIDEO
- }),
- count: z.number().int().min(0).openapi({
- description: '该类型视频数量',
- example: 5
- }),
- percentage: z.number().min(0).max(100).openapi({
- description: '占比百分比',
- example: 20.0
- })
- });
- // 视频分类统计响应Schema
- export const VideoStatisticsResponseSchema = z.object({
- companyId: z.number().int().positive().openapi({
- description: '企业ID',
- example: 1
- }),
- stats: z.array(VideoStatItemSchema).openapi({
- description: '视频分类统计列表'
- }),
- total: z.number().int().min(0).openapi({
- description: '视频总数',
- example: 25
- })
- });
- // 企业订单查询参数Schema
- export const CompanyOrdersQuerySchema = z.object({
- companyId: z.coerce.number().int().positive().optional().openapi({
- description: '企业ID(从认证用户获取,可覆盖)',
- example: 1
- }),
- orderName: z.string().optional().openapi({
- description: '订单名称过滤',
- example: '2024年Q1'
- }),
- orderStatus: z.nativeEnum(OrderStatus).optional().openapi({
- description: '订单状态过滤',
- example: OrderStatus.CONFIRMED
- }),
- startDate: z.string().optional().openapi({
- description: '开始日期(YYYY-MM-DD格式)',
- example: '2024-01-01'
- }),
- endDate: z.string().optional().openapi({
- description: '结束日期(YYYY-MM-DD格式)',
- example: '2024-12-31'
- }),
- page: z.coerce.number().int().min(1).default(1).optional().openapi({
- description: '页码',
- example: 1
- }),
- limit: z.coerce.number().int().min(1).max(100).default(10).optional().openapi({
- description: '每页数量',
- example: 10
- }),
- sortBy: z.enum(['createTime', 'updateTime', 'orderName']).default('createTime').optional().openapi({
- description: '排序字段',
- example: 'createTime'
- }),
- sortOrder: z.enum(['ASC', 'DESC']).default('DESC').optional().openapi({
- description: '排序方向',
- example: 'DESC'
- })
- });
- // 企业维度视频查询参数Schema
- export const CompanyVideosQuerySchema = z.object({
- companyId: z.coerce.number().int().positive().optional().openapi({
- description: '企业ID(从认证用户获取,可覆盖)',
- example: 1
- }),
- assetType: z.nativeEnum(AssetType).optional().openapi({
- description: '视频类型过滤',
- example: AssetType.CHECKIN_VIDEO
- }),
- page: z.coerce.number().int().min(1).default(1).optional().openapi({
- description: '页码',
- example: 1
- }),
- pageSize: z.coerce.number().int().min(1).max(100).default(10).optional().openapi({
- description: '每页数量',
- example: 10
- }),
- sortBy: z.enum(['relatedTime', 'createTime', 'updateTime']).default('relatedTime').optional().openapi({
- description: '排序字段:relatedTime-关联时间, createTime-创建时间, updateTime-更新时间',
- example: 'relatedTime'
- }),
- sortOrder: z.enum(['ASC', 'DESC']).default('DESC').optional().openapi({
- description: '排序方向',
- example: 'DESC'
- })
- });
- // 简化的文件schema,用于视频查询响应
- const SimpleFileSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '文件ID',
- example: 1
- }),
- name: z.string().max(255).openapi({
- description: '文件名称',
- example: '打卡视频.mp4'
- }),
- type: z.string().max(50).nullable().openapi({
- description: '文件类型',
- example: 'video/mp4'
- }),
- size: z.number().int().positive().nullable().openapi({
- description: '文件大小,单位字节',
- example: 102400
- }),
- path: z.string().max(512).openapi({
- description: '文件存储路径',
- example: '/uploads/videos/2024/checkin-video.mp4'
- }),
- fullUrl: z.string().optional().openapi({
- description: '完整文件访问URL',
- example: 'https://minio.example.com/d8dai/uploads/videos/2024/checkin-video.mp4'
- }),
- description: z.string().nullable().openapi({
- description: '文件描述',
- example: '员工打卡视频记录'
- }),
- uploadTime: z.coerce.date().openapi({
- description: '上传时间',
- example: '2024-01-15T10:30:00Z'
- })
- });
- // 企业维度视频响应Schema
- export const CompanyVideoResponseSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '资产ID',
- example: 1
- }),
- orderId: z.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.number().int().positive().openapi({
- description: '人员ID',
- example: 1
- }),
- assetType: z.nativeEnum(AssetType).openapi({
- description: '视频类型',
- example: AssetType.CHECKIN_VIDEO
- }),
- assetFileType: z.nativeEnum(AssetFileType).openapi({
- description: '资产文件类型',
- example: AssetFileType.VIDEO
- }),
- fileId: z.number().int().positive().openapi({
- description: '文件ID',
- example: 1
- }),
- file: SimpleFileSchema.optional().openapi({
- description: '文件详情'
- }),
- relatedTime: z.coerce.date().openapi({
- description: '关联时间',
- example: '2024-01-15T10:30:00Z'
- }),
- createTime: z.coerce.date().openapi({
- description: '创建时间',
- example: '2024-01-15T10:30:00Z'
- }),
- updateTime: z.coerce.date().openapi({
- description: '更新时间',
- example: '2024-01-15T10:30:00Z'
- })
- });
- // 企业维度视频列表响应Schema
- export const CompanyVideoListResponseSchema = z.object({
- data: z.array(CompanyVideoResponseSchema).openapi({
- description: '视频列表'
- }),
- total: z.number().int().openapi({
- description: '总记录数',
- example: 100
- })
- });
- // 批量下载范围枚举
- export enum DownloadScope {
- COMPANY = 'company',
- PERSON = 'person'
- }
- // 批量下载请求Schema
- export const BatchDownloadRequestSchema = z.object({
- downloadScope: z.nativeEnum(DownloadScope).openapi({
- description: '下载范围:company-企业维度, person-个人维度',
- example: DownloadScope.COMPANY
- }),
- companyId: z.coerce.number().int().positive().optional().openapi({
- description: '企业ID(下载范围为company时必需,从认证用户获取可覆盖)',
- example: 1
- }),
- personId: z.coerce.number().int().positive().optional().openapi({
- description: '人员ID(下载范围为person时必需)',
- example: 1
- }),
- assetTypes: z.array(z.nativeEnum(AssetType)).optional().openapi({
- description: '视频类型过滤数组',
- example: [AssetType.CHECKIN_VIDEO, AssetType.WORK_VIDEO]
- }),
- fileIds: z.array(z.coerce.number().int().positive()).optional().openapi({
- description: '文件ID列表(指定具体文件下载)',
- example: [1, 2, 3]
- })
- });
- // 批量下载文件项Schema
- export const BatchDownloadFileItemSchema = z.object({
- id: z.number().int().positive().openapi({
- description: '文件ID',
- example: 1
- }),
- name: z.string().openapi({
- description: '文件名称',
- example: '打卡视频.mp4'
- }),
- size: z.number().int().positive().nullable().openapi({
- description: '文件大小,单位字节',
- example: 102400
- }),
- url: z.string().openapi({
- description: '文件访问URL(预签名URL)',
- example: 'https://minio.example.com/d8dai/uploads/videos/2024/checkin-video.mp4?X-Amz-Algorithm=...'
- }),
- assetType: z.nativeEnum(AssetType).openapi({
- description: '视频类型',
- example: AssetType.CHECKIN_VIDEO
- }),
- orderId: z.number().int().positive().openapi({
- description: '订单ID',
- example: 1
- }),
- personId: z.number().int().positive().openapi({
- description: '人员ID',
- example: 1
- }),
- relatedTime: z.coerce.date().openapi({
- description: '关联时间',
- example: '2024-01-15T10:30:00Z'
- })
- });
- // 批量下载响应Schema
- export const BatchDownloadResponseSchema = z.object({
- success: z.boolean().openapi({
- description: '是否成功',
- example: true
- }),
- message: z.string().openapi({
- description: '操作结果消息',
- example: '批量下载成功,共生成3个文件URL'
- }),
- files: z.array(BatchDownloadFileItemSchema).openapi({
- description: '文件URL列表'
- }),
- totalFiles: z.number().int().openapi({
- description: '文件总数',
- example: 3
- })
- });
- // 更新视频审核状态请求Schema
- export const UpdateAssetStatusSchema = z.object({
- status: z.nativeEnum(AssetStatus).openapi({
- description: '视频审核状态:pending-待审核, verified-已验证, rejected-已拒绝',
- example: AssetStatus.VERIFIED
- })
- });
- // 类型定义
- export type CheckinStatisticsResponse = z.infer<typeof CheckinStatisticsResponseSchema>;
- export type VideoStatItem = z.infer<typeof VideoStatItemSchema>;
- export type VideoStatisticsResponse = z.infer<typeof VideoStatisticsResponseSchema>;
- export type CompanyOrdersQuery = z.infer<typeof CompanyOrdersQuerySchema>;
- export type CompanyVideosQuery = z.infer<typeof CompanyVideosQuerySchema>;
- export type CompanyVideoResponse = z.infer<typeof CompanyVideoResponseSchema>;
- export type CompanyVideoListResponse = z.infer<typeof CompanyVideoListResponseSchema>;
- export type BatchDownloadRequest = z.infer<typeof BatchDownloadRequestSchema>;
- export type BatchDownloadFileItem = z.infer<typeof BatchDownloadFileItemSchema>;
- export type BatchDownloadResponse = z.infer<typeof BatchDownloadResponseSchema>;
- export type UpdateAssetStatus = z.infer<typeof UpdateAssetStatusSchema>;
- export { OrderStatus, WorkStatus } from '@d8d/allin-enums';
|