1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/model/sql/enitites/VideoEntity.ts
2019-02-15 15:49:05 -05:00

27 lines
639 B
TypeScript

import {ChildEntity, Column} from 'typeorm';
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
import {VideoDTO, VideoMetadata} from '../../../../common/entities/VideoDTO';
export class VideoMetadataEntity extends MediaMetadataEntity implements VideoMetadata {
@Column('int')
bitRate: number;
@Column('bigint', {
unsigned: true, nullable: true, transformer: {
from: v => parseInt(v, 10) || null,
to: v => v
}
})
duration: number;
}
@ChildEntity()
export class VideoEntity extends MediaEntity implements VideoDTO {
@Column(type => VideoMetadataEntity)
metadata: VideoMetadataEntity;
}