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

79 lines
1.8 KiB
TypeScript

import {ChildEntity, Column} from 'typeorm';
import {CameraMetadata, GPSMetadata, PhotoDTO, PhotoMetadata, PositionMetaData} from '../../../../common/entities/PhotoDTO';
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
export class CameraMetadataEntity implements CameraMetadata {
@Column('int', {nullable: true, unsigned: true})
ISO: number;
@Column('text', {nullable: true})
model: string;
@Column('text', {nullable: true})
make: string;
@Column('float', {nullable: true})
fStop: number;
@Column('float', {nullable: true})
exposure: number;
@Column('float', {nullable: true})
focalLength: number;
@Column('text', {nullable: true})
lens: string;
}
export class GPSMetadataEntity implements GPSMetadata {
@Column('float', {nullable: true})
latitude: number;
@Column('float', {nullable: true})
longitude: number;
@Column('int', {nullable: true})
altitude: number;
}
export class PositionMetaDataEntity implements PositionMetaData {
@Column(type => GPSMetadataEntity)
GPSData: GPSMetadataEntity;
@Column('text', {nullable: true})
country: string;
@Column('text', {nullable: true})
state: string;
@Column('text', {nullable: true})
city: string;
}
export class PhotoMetadataEntity extends MediaMetadataEntity implements PhotoMetadata {
/*
@Column('simple-array')
keywords: string[];
@Column(type => CameraMetadataEntity)
cameraData: CameraMetadataEntity;
@Column(type => PositionMetaDataEntity)
positionData: PositionMetaDataEntity;
@Column('tinyint', {default: OrientationTypes.TOP_LEFT})
orientation: OrientationTypes;
*/
}
@ChildEntity()
export class PhotoEntity extends MediaEntity implements PhotoDTO {
@Column(type => PhotoMetadataEntity)
metadata: PhotoMetadataEntity;
}