2021-04-22 22:54:08 +02:00
|
|
|
import { IUnleashConfig } from '../types/option';
|
|
|
|
import { IUnleashStores } from '../types/stores';
|
|
|
|
import { Logger } from '../logger';
|
2021-08-12 15:04:37 +02:00
|
|
|
import { ISettingStore } from '../types/stores/settings-store';
|
2021-04-22 22:54:08 +02:00
|
|
|
|
|
|
|
export default class SettingService {
|
|
|
|
private logger: Logger;
|
|
|
|
|
2021-08-12 15:04:37 +02:00
|
|
|
private settingStore: ISettingStore;
|
2021-04-22 22:54:08 +02:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
{ settingStore }: Pick<IUnleashStores, 'settingStore'>,
|
|
|
|
{ getLogger }: Pick<IUnleashConfig, 'getLogger'>,
|
|
|
|
) {
|
|
|
|
this.logger = getLogger('services/setting-service.ts');
|
|
|
|
this.settingStore = settingStore;
|
|
|
|
}
|
|
|
|
|
2021-10-29 10:25:42 +02:00
|
|
|
async get<T>(id: string): Promise<T> {
|
2021-04-22 22:54:08 +02:00
|
|
|
return this.settingStore.get(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
async insert(id: string, value: object): Promise<void> {
|
|
|
|
return this.settingStore.insert(id, value);
|
|
|
|
}
|
2021-08-12 15:04:37 +02:00
|
|
|
|
|
|
|
async delete(id: string): Promise<void> {
|
|
|
|
return this.settingStore.delete(id);
|
|
|
|
}
|
2021-04-22 22:54:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = SettingService;
|