mirror of
https://github.com/immich-app/immich.git
synced 2026-02-14 12:58:17 +03:00
* faces * add openapi descriptions * remove dto descriptions * gen openapi * dtos * fix dtos * fix more * fix build * more * complete dtos * descriptions on rebase * gen rebase * revert correct integer type conversion * gen after revert * revert correct nullables * regen after revert * actually incorrect adding default here * revert correct number type conversion * regen after revert * revert nullable usage * regen fully * readd some comments * one more * one more * use enum * add missing * add missing controllers * add missing dtos * complete it * more * describe global key and slug * add remaining body and param descriptions * lint and format * cleanup * response and schema descriptions * test patch according to suggestion * revert added api response objects * revert added api body objects * revert added api param object * revert added api query objects * revert reorganized http code objects * revert reorganize ApiOkResponse objects * revert added api response objects (2) * revert added api tag object * revert added api schema objects * migrate missing asset.dto.ts * regenerate openapi builds * delete generated mustache files * remove descriptions from properties that are schemas * lint * revert nullable type changes * revert int/num type changes * remove explicit default * readd comment * lint * pr fixes * last bits and pieces * lint and format * chore: remove rejected patches * fix: deleting asset from asset-viewer on search results (#25596) * fix: escape handling in search asset viewer (#25621) * fix: correctly show owner in album options modal (#25618) * fix: validation issues * fix: validation issues --------- Co-authored-by: Jason Rasmussen <jason@rasm.me> Co-authored-by: Min Idzelis <min123@gmail.com> Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Co-authored-by: Paul Makles <me@insrt.uk>
91 lines
3.7 KiB
TypeScript
91 lines
3.7 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Exif } from 'src/database';
|
|
|
|
export class ExifResponseDto {
|
|
@ApiPropertyOptional({ description: 'Camera make' })
|
|
make?: string | null = null;
|
|
@ApiPropertyOptional({ description: 'Camera model' })
|
|
model?: string | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'Image width in pixels' })
|
|
exifImageWidth?: number | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'Image height in pixels' })
|
|
exifImageHeight?: number | null = null;
|
|
|
|
@ApiProperty({ type: 'integer', format: 'int64', description: 'File size in bytes' })
|
|
fileSizeInByte?: number | null = null;
|
|
@ApiPropertyOptional({ description: 'Image orientation' })
|
|
orientation?: string | null = null;
|
|
@ApiPropertyOptional({ description: 'Original date/time', format: 'date-time' })
|
|
dateTimeOriginal?: Date | null = null;
|
|
@ApiPropertyOptional({ description: 'Modification date/time', format: 'date-time' })
|
|
modifyDate?: Date | null = null;
|
|
@ApiPropertyOptional({ description: 'Time zone' })
|
|
timeZone?: string | null = null;
|
|
@ApiPropertyOptional({ description: 'Lens model' })
|
|
lensModel?: string | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'F-number (aperture)' })
|
|
fNumber?: number | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'Focal length in mm' })
|
|
focalLength?: number | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'ISO sensitivity' })
|
|
iso?: number | null = null;
|
|
@ApiPropertyOptional({ description: 'Exposure time' })
|
|
exposureTime?: string | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'GPS latitude' })
|
|
latitude?: number | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'GPS longitude' })
|
|
longitude?: number | null = null;
|
|
@ApiPropertyOptional({ description: 'City name' })
|
|
city?: string | null = null;
|
|
@ApiPropertyOptional({ description: 'State/province name' })
|
|
state?: string | null = null;
|
|
@ApiPropertyOptional({ description: 'Country name' })
|
|
country?: string | null = null;
|
|
@ApiPropertyOptional({ description: 'Image description' })
|
|
description?: string | null = null;
|
|
@ApiPropertyOptional({ description: 'Projection type' })
|
|
projectionType?: string | null = null;
|
|
@ApiPropertyOptional({ type: 'number', description: 'Rating' })
|
|
rating?: number | null = null;
|
|
}
|
|
|
|
export function mapExif(entity: Exif): ExifResponseDto {
|
|
return {
|
|
make: entity.make,
|
|
model: entity.model,
|
|
exifImageWidth: entity.exifImageWidth,
|
|
exifImageHeight: entity.exifImageHeight,
|
|
fileSizeInByte: entity.fileSizeInByte ? Number.parseInt(entity.fileSizeInByte.toString()) : null,
|
|
orientation: entity.orientation,
|
|
dateTimeOriginal: entity.dateTimeOriginal,
|
|
modifyDate: entity.modifyDate,
|
|
timeZone: entity.timeZone,
|
|
lensModel: entity.lensModel,
|
|
fNumber: entity.fNumber,
|
|
focalLength: entity.focalLength,
|
|
iso: entity.iso,
|
|
exposureTime: entity.exposureTime,
|
|
latitude: entity.latitude,
|
|
longitude: entity.longitude,
|
|
city: entity.city,
|
|
state: entity.state,
|
|
country: entity.country,
|
|
description: entity.description,
|
|
projectionType: entity.projectionType,
|
|
rating: entity.rating,
|
|
};
|
|
}
|
|
|
|
export function mapSanitizedExif(entity: Exif): ExifResponseDto {
|
|
return {
|
|
fileSizeInByte: entity.fileSizeInByte ? Number.parseInt(entity.fileSizeInByte.toString()) : null,
|
|
orientation: entity.orientation,
|
|
dateTimeOriginal: entity.dateTimeOriginal,
|
|
timeZone: entity.timeZone,
|
|
projectionType: entity.projectionType,
|
|
exifImageWidth: entity.exifImageWidth,
|
|
exifImageHeight: entity.exifImageHeight,
|
|
rating: entity.rating,
|
|
};
|
|
}
|