mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复初始化 SystemConfig 数据
This commit is contained in:
@@ -54,13 +54,14 @@ export default class SystemService {
|
||||
}
|
||||
|
||||
private async updateAuthDb(payload: SystemInfo): Promise<SystemInfo> {
|
||||
await SystemModel.upsert({ ...payload });
|
||||
const doc = await this.getDb({ type: payload.type });
|
||||
const { id, ...others } = payload;
|
||||
await SystemModel.update(others, { where: { id } });
|
||||
const doc = await this.getDb({ id });
|
||||
return doc;
|
||||
}
|
||||
|
||||
public async getDb(query: any): Promise<SystemInfo> {
|
||||
const doc = await SystemModel.findOne({ where: { ...query } });
|
||||
const doc = await SystemModel.findOne({ where: query });
|
||||
if (!doc) {
|
||||
throw new Error(`System ${JSON.stringify(query)} not found`);
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ export default class UserService {
|
||||
}
|
||||
|
||||
private async updateAuthDb(payload: SystemInfo): Promise<any> {
|
||||
let doc = await SystemModel.findOne({ type: payload.type });
|
||||
let doc = await SystemModel.findOne({ where: { type: payload.type } });
|
||||
if (doc) {
|
||||
const updateResult = await SystemModel.update(payload, {
|
||||
where: { id: doc.id },
|
||||
|
||||
Reference in New Issue
Block a user