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

79 lines
1.8 KiB
TypeScript
Raw Normal View History

import {ChildEntity, Column} from 'typeorm';
import {CameraMetadata, GPSMetadata, PhotoDTO, PhotoMetadata, PositionMetaData} from '../../../../common/entities/PhotoDTO';
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
2017-10-20 00:08:07 +08:00
export class CameraMetadataEntity implements CameraMetadata {
2016-12-28 03:55:51 +08:00
@Column('int', {nullable: true})
2017-10-20 00:08:07 +08:00
ISO: number;
2016-12-28 03:55:51 +08:00
2018-03-31 03:30:30 +08:00
@Column('text', {nullable: true})
2017-10-20 00:08:07 +08:00
model: string;
2016-12-28 03:55:51 +08:00
2018-03-31 03:30:30 +08:00
@Column('text', {nullable: true})
2018-12-18 07:05:12 +08:00
make: string;
2016-12-28 03:55:51 +08:00
@Column('float', {nullable: true})
2017-10-20 00:08:07 +08:00
fStop: number;
2016-12-28 03:55:51 +08:00
@Column('float', {nullable: true})
2017-10-20 00:08:07 +08:00
exposure: number;
2016-12-28 03:55:51 +08:00
@Column('int', {nullable: true, unsigned: true})
2017-10-20 00:08:07 +08:00
focalLength: number;
2016-12-28 03:55:51 +08:00
2018-03-31 03:30:30 +08:00
@Column('text', {nullable: true})
2017-10-20 00:08:07 +08:00
lens: string;
}
2016-12-28 03:55:51 +08:00
export class GPSMetadataEntity implements GPSMetadata {
@Column('float', {nullable: true})
latitude: number;
@Column('float', {nullable: true})
longitude: number;
@Column('float', {nullable: true})
altitude: number;
}
2019-01-12 23:41:45 +08:00
2017-10-20 00:08:07 +08:00
export class PositionMetaDataEntity implements PositionMetaData {
2016-12-28 03:55:51 +08:00
2017-10-20 00:08:07 +08:00
@Column(type => GPSMetadataEntity)
GPSData: GPSMetadataEntity;
2016-12-28 03:55:51 +08:00
2018-03-31 03:30:30 +08:00
@Column('text', {nullable: true})
2017-10-20 00:08:07 +08:00
country: string;
2016-12-28 03:55:51 +08:00
2018-03-31 03:30:30 +08:00
@Column('text', {nullable: true})
2017-10-20 00:08:07 +08:00
state: string;
2016-12-28 03:55:51 +08:00
2018-03-31 03:30:30 +08:00
@Column('text', {nullable: true})
2017-10-20 00:08:07 +08:00
city: string;
}
2016-12-28 03:55:51 +08:00
export class PhotoMetadataEntity extends MediaMetadataEntity implements PhotoMetadata {
2018-12-18 07:05:12 +08:00
/*
@Column('simple-array')
keywords: string[];
2018-12-18 07:05:12 +08:00
@Column(type => CameraMetadataEntity)
cameraData: CameraMetadataEntity;
2018-12-18 07:05:12 +08:00
@Column(type => PositionMetaDataEntity)
positionData: PositionMetaDataEntity;
2018-12-18 07:05:12 +08:00
@Column('tinyint', {default: OrientationTypes.TOP_LEFT})
orientation: OrientationTypes;
*/
2017-10-20 00:08:07 +08:00
}
2016-12-28 03:55:51 +08:00
@ChildEntity()
export class PhotoEntity extends MediaEntity implements PhotoDTO {
@Column(type => PhotoMetadataEntity)
metadata: PhotoMetadataEntity;
2017-10-20 00:08:07 +08:00
}