From 11f49f4eb984122e4e4dc971319cce3a47f6c336 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 12 Mar 2021 07:31:54 +0900 Subject: [PATCH] Add option service --- .../services/application/option.service.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 frontend/services/application/option.service.ts diff --git a/frontend/services/application/option.service.ts b/frontend/services/application/option.service.ts new file mode 100644 index 00000000..5bc284ca --- /dev/null +++ b/frontend/services/application/option.service.ts @@ -0,0 +1,30 @@ +import { OptionItem } from '@/models/option' +import { OptionRepository } from '@/repositories/option/interface' + +export class OptionDTO { + page: number + q?: string + isChecked?: string + + constructor(item: OptionItem) { + this.page = item.page + this.q = item.q + this.isChecked = item.isChecked + } +} + +export class OptionApplicationService { + constructor( + private readonly repository: OptionRepository + ) {} + + public findOption(projectId: string): OptionDTO { + const item = this.repository.findById(projectId) + return new OptionDTO(item) + } + + public save(projectId: string, option: OptionDTO) { + const item = new OptionItem(option.page, option.q, option.isChecked) + this.repository.save(projectId, item) + } +}