Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
refactor(dto): replace nativeEnum with enum (#318)
Sakuradbc3440fadd2
diff --git a/project/backend/apps/aitoearn-channel/src/core/platforms/pinterest/dto/pinterest.dto.ts b/project/backend/apps/aitoearn-channel/src/core/platforms/pinterest/dto/pinterest.dto.tsindex 1a29fff4..82ffd513 100644--- a/project/backend/apps/aitoearn-channel/src/core/platforms/pinterest/dto/pinterest.dto.ts+++ b/project/backend/apps/aitoearn-channel/src/core/platforms/pinterest/dto/pinterest.dto.ts@@ -3,8 +3,8 @@ import { z } from 'zod'import { Country, Currency, SourceType } from '../../../../libs/pinterest/common'const CreateAccountBodySchema = z.object({- country: z.nativeEnum(Country).optional().describe('国家'),- currency: z.nativeEnum(Currency).optional().describe('货币'),+ country: z.enum(Country).optional().describe('国家'),+ currency: z.enum(Currency).optional().describe('货币'),name: z.string().optional().describe('名称'),owner_user_id: z.string().optional().describe('所属用户'),})@@ -17,7 +17,7 @@ const CreateBoardBodySchema = z.object({export class CreateBoardBodyDto extends createZodDto(CreateBoardBodySchema) {}const MediaSourceSchema = z.object({- source_type: z.nativeEnum(SourceType).describe('媒体类型'),+ source_type: z.enum(SourceType).describe('媒体类型'),cover_image_url: z.string().optional().describe('封面地址'),url: z.string().optional().describe('图片或者视频地址'),})diff --git a/project/backend/apps/aitoearn-channel/src/core/platforms/tiktok/dto/tiktok.dto.ts b/project/backend/apps/aitoearn-channel/src/core/platforms/tiktok/dto/tiktok.dto.tsindex 903a2788..e7167be3 100644--- a/project/backend/apps/aitoearn-channel/src/core/platforms/tiktok/dto/tiktok.dto.ts+++ b/project/backend/apps/aitoearn-channel/src/core/platforms/tiktok/dto/tiktok.dto.ts@@ -12,7 +12,7 @@ import { TiktokPostMode, TiktokPrivacyLevel, TiktokSourceType } from '../../../.const PostInfoSchema = z.object({title: z.string().optional(),description: z.string().optional(),- privacy_level: z.nativeEnum(TiktokPrivacyLevel),+ privacy_level: z.enum(TiktokPrivacyLevel),disable_comment: z.boolean().optional(),disable_duet: z.boolean().optional(),disable_stitch: z.boolean().optional(),@@ -85,7 +85,7 @@ const VideoPublishSchema = AccountIdSchema.extend({export class VideoPublishDto extends createZodDto(VideoPublishSchema) {}const PhotoPublishSchema = AccountIdSchema.extend({- postMode: z.nativeEnum(TiktokPostMode),+ postMode: z.enum(TiktokPostMode),postInfo: PostInfoSchema,sourceInfo: PhotoSourceInfoSchema,})diff --git a/project/backend/apps/aitoearn-server/src/channel/dto/publish-response.vo.ts b/project/backend/apps/aitoearn-server/src/channel/dto/publish-response.vo.tsindex f404c718..bac73de8 100644--- a/project/backend/apps/aitoearn-server/src/channel/dto/publish-response.vo.ts+++ b/project/backend/apps/aitoearn-server/src/channel/dto/publish-response.vo.ts@@ -19,7 +19,7 @@ export const PublishRecordItemVoSchema = z.object({publishTime: z.date().describe('发布时间'),status: z.enum(PublishStatus).describe('发布状态'),errorMsg: z.string().optional().describe('错误信息'),- publishingChannel: z.nativeEnum(PublishingChannel).optional().describe('发布渠道'),+ publishingChannel: z.enum(PublishingChannel).optional().describe('发布渠道'),workLink: z.string().optional().describe('作品链接'),})export class PublishRecordItemVo extends createZodDto(PublishRecordItemVoSchema) {}diff --git a/project/backend/libs/mongodb/src/repositories/materialGroup.repository.ts b/project/backend/libs/mongodb/src/repositories/materialGroup.repository.tsindex 3696c19b..eb82d354 100644--- a/project/backend/libs/mongodb/src/repositories/materialGroup.repository.ts+++ b/project/backend/libs/mongodb/src/repositories/materialGroup.repository.ts@@ -94,8 +94,9 @@ export class MaterialGroupRepository extends BaseRepository<MaterialGroup> {// 获取列表async getList(inFilter: {userId?: string- title?: stringuserType?: UserType+ title?: string+ type?: MaterialType}, pageInfo: {pageNo: numberpageSize: number@@ -104,6 +105,7 @@ export class MaterialGroupRepository extends BaseRepository<MaterialGroup> {const filter: RootFilterQuery<MaterialGroup> = {...(inFilter.userId && { userId: inFilter.userId }),...(inFilter.userType && { userType: inFilter.userType }),+ ...(inFilter.type && { type: inFilter.type }),...(inFilter.title && { title: { $regex: inFilter.title, $options: 'i' } }),}diff --git a/project/backend/libs/mongodb/src/schemas/publishing-task.schema.ts b/project/backend/libs/mongodb/src/schemas/publishing-task.schema.tsindex c02e8756..4882761b 100644--- a/project/backend/libs/mongodb/src/schemas/publishing-task.schema.ts+++ b/project/backend/libs/mongodb/src/schemas/publishing-task.schema.ts@@ -1,6 +1,6 @@import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'import { AccountType } from '@yikart/common'-import { PublishingTaskType, PublishStatus } from '..'+import { PublishingTaskType, PublishStatus } from '../enums'import { PublishingTaskMeta } from './publishing-task-meta.schema'import { WithTimestampSchema } from './timestamp.schema'diff --git a/project/backend/libs/mongodb/src/schemas/user.schema.ts b/project/backend/libs/mongodb/src/schemas/user.schema.tsindex 20f66f13..838e644f 100644--- a/project/backend/libs/mongodb/src/schemas/user.schema.ts+++ b/project/backend/libs/mongodb/src/schemas/user.schema.ts@@ -210,31 +210,7 @@ export class User extends WithTimestampSchema {required: true,default: 0,})- income: number // Income (cents)-- @Prop({- required: true,- default: 0,- })- totalIncome: number-- @Prop({- required: true,- default: 0,- })- incomeUSD: number // Income (USD cents)-- @Prop({- required: true,- default: 0,- })- totalIncomeUSD: number // Total Income (USD cents)-- @Prop({- required: true,- default: 0,- })- usedStorage: number // Used Storage (Bytes)+ usedStorage: number // 已用存储(Bytes)@Prop({type: UserStorage,