mirror of https://github.com/doccano/doccano.git
pythonannotation-tooldatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learning
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
492 B
16 lines
492 B
import { RoleItem } from '@/domain/models/role/role'
|
|
import ApiService from '@/services/api.service'
|
|
|
|
function toModel(item: { [key: string]: any }): RoleItem {
|
|
return new RoleItem(item.id, item.name)
|
|
}
|
|
|
|
export class APIRoleRepository {
|
|
constructor(private readonly request = ApiService) {}
|
|
|
|
async list(): Promise<RoleItem[]> {
|
|
const url = `/roles`
|
|
const response = await this.request.get(url)
|
|
return response.data.map((item: { [key: string]: any }) => toModel(item))
|
|
}
|
|
}
|