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.

19 lines
543 B

  1. import { AnnotationRepository } from '@/domain/models/tasks/annotationRepository'
  2. import { Relation } from '@/domain/models/tasks/relation'
  3. export class APIRelationRepository extends AnnotationRepository<Relation> {
  4. labelName = 'relations'
  5. toModel(item: { [key: string]: any }): Relation {
  6. return new Relation(item.id, item.from_id, item.to_id, item.type)
  7. }
  8. toPayload(item: Relation): { [key: string]: any } {
  9. return {
  10. id: item.id,
  11. from_id: item.fromId,
  12. to_id: item.toId,
  13. type: item.type
  14. }
  15. }
  16. }