QLAPI 支持操作环境变量和系统通知

This commit is contained in:
whyour
2025-01-11 01:59:46 +08:00
parent 4667af4ebe
commit 647ed3b66c
18 changed files with 2032 additions and 81 deletions
+6 -6
View File
@@ -62,7 +62,7 @@ export default class EnvService {
return await this.getDb({ id: payload.id });
}
public async remove(ids: string[]) {
public async remove(ids: number[]) {
await EnvModel.destroy({ where: { id: ids } });
await this.set_envs();
}
@@ -150,7 +150,7 @@ export default class EnvService {
['position', 'DESC'],
['createdAt', 'ASC'],
]);
return result as any;
return result;
} catch (error) {
throw error;
}
@@ -161,7 +161,7 @@ export default class EnvService {
where: { ...query },
order: [...sort],
});
return docs;
return docs.map((x) => x.get({ plain: true }));
}
public async getDb(query: FindOptions<Env>['where']): Promise<Env> {
@@ -172,7 +172,7 @@ export default class EnvService {
return doc.get({ plain: true });
}
public async disabled(ids: string[]) {
public async disabled(ids: number[]) {
await EnvModel.update(
{ status: EnvStatus.disabled },
{ where: { id: ids } },
@@ -180,12 +180,12 @@ export default class EnvService {
await this.set_envs();
}
public async enabled(ids: string[]) {
public async enabled(ids: number[]) {
await EnvModel.update({ status: EnvStatus.normal }, { where: { id: ids } });
await this.set_envs();
}
public async updateNames({ ids, name }: { ids: string[]; name: string }) {
public async updateNames({ ids, name }: { ids: number[]; name: string }) {
await EnvModel.update({ name }, { where: { id: ids } });
await this.set_envs();
}