Dev Main by v3.4 测试数据删除 #10

Merged
jacy merged 91 commits from dev into main 2026-07-28 17:19:22 +08:00
Showing only changes of commit 78973e3fbf - Show all commits
@@ -184,16 +184,22 @@ export class SystemConfigService implements OnModuleInit {
async importFromProcessEnv(): Promise<{ imported: number }> {
let imported = 0;
const overlay: Record<string, string> = {};
for (const field of SYSTEM_CONFIG_FIELDS) {
const envVal = process.env[field.key];
if (envVal === undefined || envVal === '') continue;
const normalized = this.normalizeByMeta(field, envVal);
const existing = await this.prisma.systemConfig.findUnique({ where: { configKey: field.key } });
if (existing) continue;
await this.prisma.systemConfig.create({
data: { configKey: field.key, value: this.normalizeByMeta(field, envVal) },
if (existing?.value?.trim()) continue;
await this.prisma.systemConfig.upsert({
where: { configKey: field.key },
create: { configKey: field.key, value: normalized },
update: { value: normalized },
});
overlay[field.key] = normalized;
imported += 1;
}
if (imported) applyEnvOverlay(overlay);
await this.onModuleInit();
return { imported };
}
@@ -208,12 +214,15 @@ export class SystemConfigService implements OnModuleInit {
private async seedMissingFromProcessEnv() {
for (const field of SYSTEM_CONFIG_FIELDS) {
const existing = await this.prisma.systemConfig.findUnique({ where: { configKey: field.key } });
if (existing) continue;
const envVal = process.env[field.key];
if (envVal === undefined || envVal === '') continue;
await this.prisma.systemConfig.create({
data: { configKey: field.key, value: this.normalizeByMeta(field, envVal) },
const existing = await this.prisma.systemConfig.findUnique({ where: { configKey: field.key } });
if (existing?.value?.trim()) continue;
const value = this.normalizeByMeta(field, envVal);
await this.prisma.systemConfig.upsert({
where: { configKey: field.key },
create: { configKey: field.key, value },
update: { value },
});
}
}