mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
79 lines
1.8 KiB
TypeScript
79 lines
1.8 KiB
TypeScript
import {Column, Entity, ChildEntity, Unique} from 'typeorm';
|
|
import {CameraMetadata, GPSMetadata, PhotoDTO, PhotoMetadata, PositionMetaData} from '../../../../common/entities/PhotoDTO';
|
|
import {OrientationTypes} from 'ts-exif-parser';
|
|
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
|
|
|
|
export class CameraMetadataEntity implements CameraMetadata {
|
|
|
|
@Column('int', {nullable: true})
|
|
ISO: number;
|
|
|
|
@Column('text', {nullable: true})
|
|
model: string;
|
|
|
|
@Column('text', {nullable: true})
|
|
maker: string;
|
|
|
|
@Column('int', {nullable: true})
|
|
fStop: number;
|
|
|
|
@Column('int', {nullable: true})
|
|
exposure: number;
|
|
|
|
@Column('int', {nullable: true})
|
|
focalLength: number;
|
|
|
|
@Column('text', {nullable: true})
|
|
lens: string;
|
|
}
|
|
|
|
|
|
export class GPSMetadataEntity implements GPSMetadata {
|
|
|
|
@Column('int', {nullable: true})
|
|
latitude: number;
|
|
@Column('int', {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;
|
|
}
|