mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: system: add kv delete
This commit is contained in:
1 parent
6042dc7bb1
commit
18c1882842
1 file changed
+7
@@ -56,6 +56,13 @@ class SystemModelService extends Service {
|
||||
return res.value;
|
||||
}
|
||||
|
||||
async del(_id: string, broadcast = true): Promise<boolean> {
|
||||
if (broadcast) this.ctx.broadcast('system/setting', { [_id]: undefined });
|
||||
const result = await this.coll.deleteOne({ _id });
|
||||
delete this.cache[_id];
|
||||
return !!result.deletedCount;
|
||||
}
|
||||
|
||||
async [Service.init]() {
|
||||
for (const setting of SYSTEM_SETTINGS) {
|
||||
if (setting.value) this.cache[setting.key] = setting.value;
|
||||
|
||||
Reference in new issue
Block a user