mirror of https://github.com/doccano/doccano.git
Browse Source
lavori in corso sull'aggancio alle api di insermento, modifica e cancellazione delle relazioni
pull/1384/head
lavori in corso sull'aggancio alle api di insermento, modifica e cancellazione delle relazioni
pull/1384/head
9 changed files with 89 additions and 49 deletions
Split View
Diff Options
-
6.gitignore
-
2frontend/components/tasks/sequenceLabeling/EntityItem.vue
-
8frontend/components/tasks/sequenceLabeling/EntityItemBox.vue
-
14frontend/domain/models/links/link.ts
-
8frontend/domain/models/links/linkRepository.ts
-
27frontend/pages/projects/_id/sequence-labeling/index.vue
-
53frontend/repositories/links/apiLinkRepository.ts
-
12frontend/services/application/tasks/sequenceLabeling/sequenceLabelingApplicationService.ts
-
8frontend/store/auth.js
@ -1,9 +1,9 @@ |
|||
import { LinkItem } from '~/domain/models/links/link' |
|||
import {LinkItem} from '~/domain/models/links/link' |
|||
|
|||
export interface LinkRepository { |
|||
create(projectId: string, link: LinkItem): Promise<LinkItem> |
|||
create(projectId: string, link: LinkItem): Promise<LinkItem> |
|||
|
|||
update(projectId: string, link: LinkItem): Promise<LinkItem> |
|||
update(projectId: string, linkId: number, linkType: number): Promise<LinkItem> |
|||
|
|||
bulkDelete(projectId: string, linkIds: number[]): Promise<void> |
|||
bulkDelete(projectId: string, linkIds: number[]): Promise<void> |
|||
} |
@ -1,35 +1,38 @@ |
|||
import ApiService from '@/services/api.service' |
|||
import { LinkRepository } from "~/domain/models/links/linkRepository"; |
|||
import { LinkItem } from "~/domain/models/links/link"; |
|||
import {LinkRepository} from "~/domain/models/links/linkRepository"; |
|||
import {LinkItem} from "~/domain/models/links/link"; |
|||
|
|||
export interface LinkResponse { |
|||
id: number |
|||
annotation_id_1: number |
|||
annotation_id_2: number |
|||
type: number |
|||
id: number |
|||
annotation_id_1: number |
|||
annotation_id_2: number |
|||
type: number, |
|||
user: number, |
|||
timestamp: string |
|||
} |
|||
|
|||
export class ApiLinkRepository implements LinkRepository { |
|||
constructor( |
|||
private readonly request = ApiService |
|||
) {} |
|||
constructor( |
|||
private readonly request = ApiService |
|||
) { |
|||
} |
|||
|
|||
async create(projectId: string, item: LinkItem): Promise<LinkItem> { |
|||
const url = `/projects/${projectId}/annotation_relations` |
|||
const response = await this.request.post(url, item.toObject()) |
|||
const responseItem: LinkResponse = response.data |
|||
return LinkItem.valueOf(responseItem) |
|||
} |
|||
async create(projectId: string, item: LinkItem): Promise<LinkItem> { |
|||
const url = `/projects/${projectId}/annotation_relations` |
|||
const response = await this.request.post(url, item.toObject()) |
|||
const responseItem: LinkResponse = response.data |
|||
return LinkItem.valueOf(responseItem) |
|||
} |
|||
|
|||
async update(projectId: string, item: LinkItem): Promise<LinkItem> { |
|||
const url = `/projects/${projectId}/annotation_relations/${item.id}` |
|||
const response = await this.request.patch(url, item.toObject()) |
|||
const responseItem: LinkResponse = response.data |
|||
return LinkItem.valueOf(responseItem) |
|||
} |
|||
async update(projectId: string, linkId: number, linkType: number): Promise<LinkItem> { |
|||
const url = `/projects/${projectId}/annotation_relations/${linkId}` |
|||
const response = await this.request.patch(url, {type: linkType}) |
|||
const responseItem: LinkResponse = response.data |
|||
return LinkItem.valueOf(responseItem) |
|||
} |
|||
|
|||
async bulkDelete(projectId: string, linkIds: number[]): Promise<void> { |
|||
const url = `/projects/${projectId}/annotation_relations` |
|||
await this.request.delete(url, { ids: linkIds }) |
|||
} |
|||
async bulkDelete(projectId: string, linkIds: number[]): Promise<void> { |
|||
const url = `/projects/${projectId}/annotation_relations` |
|||
await this.request.delete(url, {ids: linkIds}) |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save