|
@ -1,22 +1,8 @@ |
|
|
import { TagDTO } from './tagData' |
|
|
|
|
|
import { TagRepository } from '~/domain/models/tag/tagRepository' |
|
|
import { TagRepository } from '~/domain/models/tag/tagRepository' |
|
|
|
|
|
|
|
|
export class TagApplicationService { |
|
|
export class TagApplicationService { |
|
|
constructor(private readonly repository: TagRepository) {} |
|
|
constructor(private readonly repository: TagRepository) {} |
|
|
|
|
|
|
|
|
public async list(id: string): Promise<TagDTO[]> { |
|
|
|
|
|
const items = await this.repository.list(id) |
|
|
|
|
|
return items.map((item) => new TagDTO(item)) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async create(projectId: string, text: string): Promise<void> { |
|
|
|
|
|
await this.repository.create(projectId, text) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async delete(projectId: string, id: number): Promise<void> { |
|
|
|
|
|
return await this.repository.delete(projectId, id) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async bulkUpdate(projectId: string | number, tags: string[]): Promise<void> { |
|
|
public async bulkUpdate(projectId: string | number, tags: string[]): Promise<void> { |
|
|
const currentTags = await this.repository.list(projectId) |
|
|
const currentTags = await this.repository.list(projectId) |
|
|
const currentTagNames = currentTags.map((tag) => tag.text) |
|
|
const currentTagNames = currentTags.map((tag) => tag.text) |
|
|