Browse Source

Add role service

pull/1224/head
Hironsan 3 years ago
parent
commit
f5c48dd2e3
1 changed files with 23 additions and 0 deletions
  1. 23
      frontend/services/application/role.service.ts

23
frontend/services/application/role.service.ts

@ -0,0 +1,23 @@
import { RoleItem } from '@/models/role'
import { RoleItemListRepository } from '@/repositories/role/interface'
export class RoleDTO {
id: number
rolename: string
constructor(item: RoleItem) {
this.id = item.id
this.rolename = item.name
}
}
export class RoleApplicationService {
constructor(
private readonly repository: RoleItemListRepository
) {}
public async list(): Promise<RoleDTO[]> {
const items = await this.repository.list()
return items.map(item => new RoleDTO(item))
}
}
Loading…
Cancel
Save