MCPcopy
hub / github.com/jesec/flood / set

Method set

server/services/settingService.ts:58–78  ·  view source on GitHub ↗
(changedSettings: Partial<FloodSettings>)

Source from the content-addressed store, hash-verified

56 }
57
58 async set(changedSettings: Partial<FloodSettings>): Promise<Partial<FloodSettings>> {
59 const savedSettings: typeof changedSettings = {};
60
61 if (changedSettings) {
62 await Promise.all(
63 Object.keys(changedSettings).map(async (key) => {
64 const property = key as keyof FloodSettings;
65 const value = changedSettings[property];
66
67 await this.db.updateAsync<SettingRecord>({id: property}, {$set: {data: value}}, {upsert: true});
68
69 Object.assign(savedSettings, {
70 [property]: value,
71 });
72 }),
73 );
74 }
75
76 this.emit('SETTINGS_CHANGE', savedSettings);
77 return savedSettings;
78 }
79}
80
81export default SettingService;

Callers 8

getFunction · 0.80
css.mjsFile · 0.80
index.test.tsFile · 0.80
apiRoutesFunction · 0.80
torrents.test.tsFile · 0.80
auth.test.tsFile · 0.80
client.test.tsFile · 0.80

Calls 1

emitMethod · 0.80

Tested by

no test coverage detected