diff --git a/.env.example b/.env.example index 21bbb20..3f30153 100644 --- a/.env.example +++ b/.env.example @@ -4,7 +4,6 @@ DB_PORT=53305 DB_USERNAME=root DB_PASSWORD=WsJWXfwFx0bq6DE2kmB6 DB_DATABASE=nano_camera_miniapp -DB_SYNCHRONIZE=false DB_LOGGING=true DB_MIGRATIONS_RUN=true diff --git a/src/config/database.config.ts b/src/config/database.config.ts index 078bd25..0cdf2c5 100644 --- a/src/config/database.config.ts +++ b/src/config/database.config.ts @@ -15,7 +15,7 @@ export const databaseConfig = ( database: configService.get('DB_DATABASE', 'nano_camera_miniapp'), entities: [__dirname + '/../**/*.entity{.ts,.js}'], migrations: [__dirname + '/../migrations/*{.ts,.js}'], - synchronize: configService.get('DB_SYNCHRONIZE', false), // 生产环境建议设为false + synchronize: false, logging: configService.get( 'DB_LOGGING', process.env.NODE_ENV === 'development', diff --git a/src/entities/ad-watch.entity.ts b/src/entities/ad-watch.entity.ts index 54d9420..9b1f8ed 100644 --- a/src/entities/ad-watch.entity.ts +++ b/src/entities/ad-watch.entity.ts @@ -51,6 +51,7 @@ export class AdWatchEntity { @Column({ type: 'enum', enum: PlatformType, + enumName: 'PlatformType', }) platform: PlatformType; diff --git a/src/entities/extension-data.entity.ts b/src/entities/extension-data.entity.ts index c33201a..a6c3811 100644 --- a/src/entities/extension-data.entity.ts +++ b/src/entities/extension-data.entity.ts @@ -29,6 +29,7 @@ export class ExtensionDataEntity { @Column({ type: 'enum', enum: PlatformType, + enumName: 'PlatformType', }) platform: PlatformType; diff --git a/src/entities/platform-user.entity.ts b/src/entities/platform-user.entity.ts index eeb3929..a3e3a93 100644 --- a/src/entities/platform-user.entity.ts +++ b/src/entities/platform-user.entity.ts @@ -49,6 +49,7 @@ export class PlatformUserEntity { @Column({ type: 'enum', enum: PlatformType, + enumName: 'PlatformType', }) platform: PlatformType; @@ -65,7 +66,7 @@ export class PlatformUserEntity { accessToken: string; /** 刷新令牌 - 用于刷新过期的访问令牌,维持长期授权状态 */ - @Column({ length: 500, nullable: true }) + @Column({ type: 'varchar', length: 500, nullable: true }) refreshToken: string | null; /** 令牌过期时间 - 访问令牌的过期时间戳,用于判断是否需要刷新令牌 */ diff --git a/src/entities/template-execution.entity.ts b/src/entities/template-execution.entity.ts index ffdd5c5..a294ecf 100644 --- a/src/entities/template-execution.entity.ts +++ b/src/entities/template-execution.entity.ts @@ -59,7 +59,7 @@ export class TemplateExecutionEntity { userId: string; /** 执行平台 - 任务发起的平台来源 */ - @Column({ type: 'enum', enum: PlatformType }) + @Column({ type: 'enum', enum: PlatformType, enumName: 'PlatformType', }) platform: PlatformType; /** 执行类型 - 标识生成内容的类型(图片或视频) */ diff --git a/src/entities/user-credit.entity.ts b/src/entities/user-credit.entity.ts index cd2acce..a8abe5b 100644 --- a/src/entities/user-credit.entity.ts +++ b/src/entities/user-credit.entity.ts @@ -53,6 +53,7 @@ export class UserCreditEntity { @Column({ type: 'enum', enum: PlatformType, + enumName: 'PlatformType', }) platform: PlatformType; @@ -60,6 +61,7 @@ export class UserCreditEntity { @Column({ type: 'enum', enum: CreditType, + enumName: 'CreditType', }) type: CreditType; @@ -67,6 +69,7 @@ export class UserCreditEntity { @Column({ type: 'enum', enum: CreditSource, + enumName: 'CreditSource', }) source: CreditSource; diff --git a/src/entities/user-subscription.entity.ts b/src/entities/user-subscription.entity.ts index a57a4e0..80d12a7 100644 --- a/src/entities/user-subscription.entity.ts +++ b/src/entities/user-subscription.entity.ts @@ -52,6 +52,7 @@ export class UserSubscriptionEntity { @Column({ type: 'enum', enum: PlatformType, + enumName: 'platform_type', }) platform: PlatformType; diff --git a/src/platform/dto/platform-login.dto.ts b/src/platform/dto/platform-login.dto.ts index f9e2ff2..6946e15 100644 --- a/src/platform/dto/platform-login.dto.ts +++ b/src/platform/dto/platform-login.dto.ts @@ -6,6 +6,7 @@ export class PlatformLoginDto { @ApiProperty({ description: '平台类型', enum: PlatformType, + enumName: 'PlatformType', example: PlatformType.WECHAT, }) @IsEnum(PlatformType)