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

120 lines
2.0 KiB
TypeScript
Raw Normal View History

import {Column, EmbeddableEntity, Embedded, Entity, ManyToOne, PrimaryGeneratedColumn} from "typeorm";
2016-12-28 03:55:51 +08:00
import {DirectoryDTO} from "../../../../common/entities/DirectoryDTO";
import {
CameraMetadata,
ImageSize,
PhotoDTO,
PhotoMetadata,
PositionMetaData
2016-12-28 03:55:51 +08:00
} from "../../../../common/entities/PhotoDTO";
import {DirectoryEntity} from "./DirectoryEntity";
2016-12-28 03:55:51 +08:00
2017-02-05 23:19:35 +08:00
@Entity()
2016-12-28 03:55:51 +08:00
export class PhotoEntity implements PhotoDTO {
@PrimaryGeneratedColumn()
id: number;
2016-12-28 03:55:51 +08:00
@Column("string")
name: string;
2016-12-28 03:55:51 +08:00
@ManyToOne(type => DirectoryEntity, directory => directory.photos)
directory: DirectoryDTO;
2016-12-28 03:55:51 +08:00
@Embedded(type => PhotoMetadataEntity)
metadata: PhotoMetadataEntity;
2016-12-28 03:55:51 +08:00
readyThumbnails: Array<number> = [];
2016-12-28 03:55:51 +08:00
readyIcon: boolean = false;
2016-12-28 03:55:51 +08:00
}
2017-02-05 23:19:35 +08:00
@EmbeddableEntity()
2016-12-28 03:55:51 +08:00
export class PhotoMetadataEntity implements PhotoMetadata {
@Column("string")
keywords: Array<string>;
2016-12-28 03:55:51 +08:00
@Column("string")
cameraData: CameraMetadata;
2016-12-28 03:55:51 +08:00
@Column("string")
positionData: PositionMetaData;
2016-12-28 03:55:51 +08:00
@Column("string")
size: ImageSize;
2016-12-28 03:55:51 +08:00
@Column("number")
creationDate: number;
@Column("number")
fileSize: number;
2016-12-28 03:55:51 +08:00
}
/*
@EmbeddableTable()
export class CameraMetadataEntity implements CameraMetadata {
@Column("string")
ISO: number;
@Column("string")
model: string;
@Column("string")
maker: string;
@Column("int")
fStop: number;
@Column("int")
exposure: number;
@Column("int")
focalLength: number;
@Column("string")
lens: string;
}
2017-02-05 23:19:35 +08:00
/*
2016-12-28 03:55:51 +08:00
@EmbeddableTable()
export class PositionMetaDataEntity implements PositionMetaData {
@Embedded(type => GPSMetadataEntity)
GPSData: GPSMetadataEntity;
@Column("string")
country: string;
@Column("string")
state: string;
@Column("string")
city: string;
}
@EmbeddableTable()
export class GPSMetadataEntity implements GPSMetadata {
@Column("string")
latitude: string;
@Column("string")
longitude: string;
@Column("string")
altitude: string;
}
@EmbeddableTable()
export class ImageSizeEntity implements ImageSize {
@Column("int")
width: number;
@Column("int")
height: number;
}*/