diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-11 08:04:01 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-11 08:04:01 +0900 |
commit | bacf83a32083c5a4c4a45c061288081423bbf18a (patch) | |
tree | f5a73e2b989428ca3f3466b6e4a4cc744e24f4b7 /src/content/usecases | |
parent | e76ca380f733b515c31297a285d8bea44e074a1b (diff) |
Make settings as a clean architecture
Diffstat (limited to 'src/content/usecases')
-rw-r--r-- | src/content/usecases/SettingUseCase.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/content/usecases/SettingUseCase.ts b/src/content/usecases/SettingUseCase.ts new file mode 100644 index 0000000..765cb45 --- /dev/null +++ b/src/content/usecases/SettingUseCase.ts @@ -0,0 +1,24 @@ +import SettingRepository, { SettingRepositoryImpl } + from '../repositories/SettingRepository'; +import SettingClient, { SettingClientImpl } from '../client/SettingClient'; +import Settings from '../../shared/Settings'; + +export default class SettingUseCase { + private repository: SettingRepository; + + private client: SettingClient; + + constructor({ + repository = new SettingRepositoryImpl(), + client = new SettingClientImpl(), + } = {}) { + this.repository = repository; + this.client = client; + } + + async reload(): Promise<Settings> { + let settings = await this.client.load(); + this.repository.set(settings); + return settings; + } +} |