Browse Source

Add option service

pull/1251/head
Hironsan 3 years ago
parent
commit
11f49f4eb9
1 changed files with 30 additions and 0 deletions
  1. 30
      frontend/services/application/option.service.ts

30
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)
}
}
Loading…
Cancel
Save