修复下载单文件订阅

This commit is contained in:
whyour
2024-06-06 22:40:51 +08:00
parent 1e749f3731
commit c3908e956f
9 changed files with 46 additions and 25 deletions
+9 -6
View File
@@ -24,7 +24,7 @@ import {
import { NotificationInfo } from '../data/notify';
import {
AuthDataType,
AuthInfo,
SystemInfo,
SystemInstance,
SystemModel,
SystemModelInfo,
@@ -47,18 +47,21 @@ export default class SystemService {
public async getSystemConfig() {
const doc = await this.getDb({ type: AuthDataType.systemConfig });
return doc || ({} as SystemInstance);
return doc;
}
private async updateAuthDb(payload: AuthInfo): Promise<SystemInstance> {
private async updateAuthDb(payload: SystemInfo): Promise<SystemInfo> {
await SystemModel.upsert({ ...payload });
const doc = await this.getDb({ type: payload.type });
return doc;
}
public async getDb(query: any): Promise<SystemInstance> {
const doc: any = await SystemModel.findOne({ where: { ...query } });
return doc && doc.get({ plain: true });
public async getDb(query: any): Promise<SystemInfo> {
const doc = await SystemModel.findOne({ where: { ...query } });
if (!doc) {
throw new Error(`${JSON.stringify(query)} not found`);
}
return doc.get({ plain: true });
}
public async updateNotificationMode(notificationInfo: NotificationInfo) {