core: system: add kv delete

This commit is contained in:
undefined committed 2026-07-12 18:05:17 +00:00
1 parent 6042dc7bb1
commit 18c1882842
1 file changed
+7
+7
View File
@@ -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;