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

39 lines
1019 B
TypeScript
Raw Normal View History

import { BaseModel } from '../base.model';
import { File } from './file';
2018-09-04 11:33:28 +02:00
import { User } from '../users/user';
/**
* Representation of MediaFile. Has the nested property "File"
* @ignore
*/
export class Mediafile extends BaseModel {
protected _collectionString: string;
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();
this._collectionString = 'mediafiles/mediafile';
2018-09-04 11:33:28 +02:00
if (input) {
this.deserialize(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-09-04 11:33:28 +02:00
public getUploader(): User {
return this.DS.get<User>('users/user', this.uploader_id);
}
}
2018-08-24 13:05:03 +02:00
BaseModel.registerCollectionElement('amediafiles/mediafile', Mediafile);