OpenSlides/client/src/app/shared/models/mediafiles/mediafile.ts

40 lines
1000 B
TypeScript
Raw Normal View History

import { File } from './file';
import { ProjectableBaseModel } from '../base/projectable-base-model';
/**
* Representation of MediaFile. Has the nested property "File"
* @ignore
*/
export class Mediafile extends ProjectableBaseModel {
2018-08-29 13:21:25 +02:00
public id: number;
public title: string;
public mediafile: File;
public media_url_prefix: string;
public uploader_id: number;
public filesize: string;
public hidden: boolean;
public timestamp: string;
2018-09-04 11:33:28 +02:00
public constructor(input?: any) {
super('mediafiles/mediafile', input);
}
2018-09-04 11:33:28 +02:00
public deserialize(input: any): void {
Object.assign(this, input);
2018-09-04 11:33:28 +02:00
this.mediafile = new File(input.mediafile);
}
2018-12-10 17:54:48 +01:00
/**
* Determine the downloadURL
*
* @returns the download URL for the specific file as string
*/
public getDownloadUrl(): string {
return `${this.media_url_prefix}${this.mediafile.name}`;
}
public getTitle(): string {
return this.title;
}
}