2017-10-19 12:08:07 -04:00
|
|
|
import {Column, Entity, ManyToOne, PrimaryGeneratedColumn} from "typeorm";
|
2016-12-27 20:55:51 +01:00
|
|
|
import {
|
2018-01-20 20:36:38 -05:00
|
|
|
CameraMetadata,
|
|
|
|
GPSMetadata,
|
|
|
|
ImageSize,
|
|
|
|
PhotoDTO,
|
|
|
|
PhotoMetadata,
|
2017-07-09 22:00:42 +02:00
|
|
|
PositionMetaData
|
2016-12-27 20:55:51 +01:00
|
|
|
} from "../../../../common/entities/PhotoDTO";
|
2016-12-28 12:30:26 +01:00
|
|
|
import {DirectoryEntity} from "./DirectoryEntity";
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class CameraMetadataEntity implements CameraMetadata {
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("text", {nullable: true})
|
|
|
|
ISO: number;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("text", {nullable: true})
|
|
|
|
model: string;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("text", {nullable: true})
|
|
|
|
maker: string;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("int", {nullable: true})
|
|
|
|
fStop: number;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("int", {nullable: true})
|
|
|
|
exposure: number;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("int", {nullable: true})
|
|
|
|
focalLength: number;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("text", {nullable: true})
|
|
|
|
lens: string;
|
|
|
|
}
|
2016-12-27 20:55:51 +01:00
|
|
|
|
|
|
|
|
2017-12-17 21:34:07 -05:00
|
|
|
@Entity()
|
|
|
|
export class GPSMetadataEntity implements GPSMetadata {
|
|
|
|
|
|
|
|
@Column("int", {nullable: true})
|
|
|
|
latitude: number;
|
|
|
|
@Column("int", {nullable: true})
|
|
|
|
longitude: number;
|
|
|
|
@Column("int", {nullable: true})
|
|
|
|
altitude: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class ImageSizeEntity implements ImageSize {
|
|
|
|
|
|
|
|
@Column("int")
|
|
|
|
width: number;
|
|
|
|
|
|
|
|
@Column("int")
|
|
|
|
height: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Entity()
|
|
|
|
export class PositionMetaDataEntity implements PositionMetaData {
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column(type => GPSMetadataEntity)
|
|
|
|
GPSData: GPSMetadataEntity;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("text", {nullable: true})
|
|
|
|
country: string;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("text", {nullable: true})
|
|
|
|
state: string;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Column("text", {nullable: true})
|
|
|
|
city: string;
|
|
|
|
}
|
2016-12-27 20:55:51 +01:00
|
|
|
|
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Entity()
|
2017-12-17 21:34:07 -05:00
|
|
|
export class PhotoMetadataEntity implements PhotoMetadata {
|
2017-10-19 12:08:07 -04:00
|
|
|
|
2017-12-17 21:34:07 -05:00
|
|
|
@Column("simple-array")
|
|
|
|
keywords: Array<string>;
|
|
|
|
|
|
|
|
@Column(type => CameraMetadataEntity)
|
|
|
|
cameraData: CameraMetadataEntity;
|
|
|
|
|
|
|
|
@Column(type => PositionMetaDataEntity)
|
|
|
|
positionData: PositionMetaDataEntity;
|
|
|
|
|
|
|
|
@Column(type => ImageSizeEntity)
|
|
|
|
size: ImageSizeEntity;
|
|
|
|
|
|
|
|
@Column("bigint")
|
|
|
|
creationDate: number;
|
|
|
|
|
|
|
|
@Column("int")
|
|
|
|
fileSize: number;
|
2017-10-19 12:08:07 -04:00
|
|
|
}
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-12-17 21:34:07 -05:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
@Entity()
|
2017-12-17 21:34:07 -05:00
|
|
|
export class PhotoEntity implements PhotoDTO {
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-12-17 21:34:07 -05:00
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
id: number;
|
|
|
|
|
|
|
|
@Column("text")
|
|
|
|
name: string;
|
|
|
|
|
|
|
|
@ManyToOne(type => DirectoryEntity, directory => directory.photos, {onDelete: "CASCADE"})
|
|
|
|
directory: DirectoryEntity;
|
|
|
|
|
|
|
|
@Column(type => PhotoMetadataEntity)
|
|
|
|
metadata: PhotoMetadataEntity;
|
|
|
|
|
|
|
|
readyThumbnails: Array<number> = [];
|
|
|
|
|
|
|
|
readyIcon: boolean = false;
|
2016-12-27 20:55:51 +01:00
|
|
|
|
2017-10-19 12:08:07 -04:00
|
|
|
}
|