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.
 
 
 
 
 
 

49 lines
1023 B

import "reflect-metadata"
import { Expose, Type } from 'class-transformer'
export class ExampleItem {
id: number;
text: string;
meta: object;
@Expose({ name: 'annotation_approver' })
annotationApprover: boolean | null;
@Expose({ name: 'comment_count' })
commentCount: number;
@Expose({ name: 'filename' })
fileUrl: string;
@Expose({ name: 'is_confirmed' })
isConfirmed: boolean;
@Expose({ name: 'upload_name' })
filename: string;
get url() {
const l = this.fileUrl.indexOf('media/')
const r = this.fileUrl.indexOf('media/', l + 1)
return this.fileUrl.slice(0, l) + this.fileUrl.slice(r)
}
toObject(): Object {
return {
id: this.id,
text: this.text,
meta: this.meta,
annotation_approver: this.annotationApprover,
comment_count: this.commentCount
}
}
}
export class ExampleItemList {
count: number;
next: string | null;
prev: string | null;
@Type(() => ExampleItem)
@Expose({ name: 'results' })
items: ExampleItem[];
}