fix(server): correctly identify integers
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsArray,
|
||||
@@ -46,17 +46,20 @@ export class UpdateAssetBase {
|
||||
@ValidateGPS()
|
||||
@IsLatitude()
|
||||
@IsNotEmpty()
|
||||
@ApiPropertyOptional({ type: 'number', format: 'double' })
|
||||
latitude?: number;
|
||||
|
||||
@ValidateGPS()
|
||||
@IsLongitude()
|
||||
@IsNotEmpty()
|
||||
@ApiPropertyOptional({ type: 'number', format: 'double' })
|
||||
longitude?: number;
|
||||
|
||||
@Optional()
|
||||
@IsInt()
|
||||
@Max(5)
|
||||
@Min(-1)
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
rating?: number;
|
||||
|
||||
@Optional()
|
||||
@@ -74,6 +77,7 @@ export class AssetBulkUpdateDto extends UpdateAssetBase {
|
||||
@IsNotSiblingOf(['dateTimeOriginal'])
|
||||
@Optional()
|
||||
@IsInt()
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
dateTimeRelative?: number;
|
||||
|
||||
@IsNotSiblingOf(['dateTimeOriginal'])
|
||||
@@ -92,6 +96,7 @@ export class RandomAssetsDto {
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@Type(() => Number)
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
count?: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,37 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Exif } from 'src/database';
|
||||
|
||||
export class ExifResponseDto {
|
||||
make?: string | null = null;
|
||||
model?: string | null = null;
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
exifImageWidth?: number | null = null;
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
exifImageHeight?: number | null = null;
|
||||
|
||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||
@ApiPropertyOptional({ type: 'integer', format: 'int64' })
|
||||
fileSizeInByte?: number | null = null;
|
||||
orientation?: string | null = null;
|
||||
dateTimeOriginal?: Date | null = null;
|
||||
modifyDate?: Date | null = null;
|
||||
timeZone?: string | null = null;
|
||||
lensModel?: string | null = null;
|
||||
@ApiPropertyOptional({ type: 'number', format: 'double' })
|
||||
fNumber?: number | null = null;
|
||||
@ApiPropertyOptional({ type: 'number', format: 'double' })
|
||||
focalLength?: number | null = null;
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
iso?: number | null = null;
|
||||
exposureTime?: string | null = null;
|
||||
@ApiPropertyOptional({ type: 'number', format: 'double' })
|
||||
latitude?: number | null = null;
|
||||
@ApiPropertyOptional({ type: 'number', format: 'double' })
|
||||
longitude?: number | null = null;
|
||||
city?: string | null = null;
|
||||
state?: string | null = null;
|
||||
country?: string | null = null;
|
||||
description?: string | null = null;
|
||||
projectionType?: string | null = null;
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
rating?: number | null = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import { IsLatitude, IsLongitude } from 'class-validator';
|
||||
import { ValidateBoolean, ValidateDate } from 'src/validation';
|
||||
|
||||
export class MapReverseGeocodeDto {
|
||||
@ApiProperty({ format: 'double' })
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
@Type(() => Number)
|
||||
@IsLatitude({ message: ({ property }) => `${property} must be a number between -90 and 90` })
|
||||
lat!: number;
|
||||
|
||||
@ApiProperty({ format: 'double' })
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
@Type(() => Number)
|
||||
@IsLongitude({ message: ({ property }) => `${property} must be a number between -180 and 180` })
|
||||
lon!: number;
|
||||
|
||||
@@ -32,6 +32,7 @@ export class MemorySearchDto {
|
||||
class OnThisDayDto {
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@ApiProperty({ type: 'integer' })
|
||||
year!: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,14 +89,14 @@ export class PersonSearchDto {
|
||||
closestAssetId?: string;
|
||||
|
||||
/** Page number for pagination */
|
||||
@ApiPropertyOptional()
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Type(() => Number)
|
||||
page: number = 1;
|
||||
|
||||
/** Number of items per page */
|
||||
@ApiPropertyOptional()
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(1000)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsInt, IsNotEmpty, IsString, Max, Min } from 'class-validator';
|
||||
import { Place } from 'src/database';
|
||||
@@ -100,6 +100,7 @@ class BaseSearchDto {
|
||||
@IsInt()
|
||||
@Max(5)
|
||||
@Min(-1)
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
rating?: number;
|
||||
}
|
||||
|
||||
@@ -115,6 +116,7 @@ class BaseSearchWithResultsDto extends BaseSearchDto {
|
||||
@Max(1000)
|
||||
@Type(() => Number)
|
||||
@Optional()
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
size?: number;
|
||||
}
|
||||
|
||||
@@ -186,6 +188,7 @@ export class MetadataSearchDto extends RandomSearchDto {
|
||||
@Min(1)
|
||||
@Type(() => Number)
|
||||
@Optional()
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
page?: number;
|
||||
}
|
||||
|
||||
@@ -215,6 +218,7 @@ export class SmartSearchDto extends BaseSearchWithResultsDto {
|
||||
@Min(1)
|
||||
@Type(() => Number)
|
||||
@Optional()
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
page?: number;
|
||||
}
|
||||
|
||||
@@ -235,7 +239,9 @@ export class SearchPeopleDto {
|
||||
|
||||
export class PlacesResponseDto {
|
||||
name!: string;
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
latitude!: number;
|
||||
@ApiProperty({ type: 'number', format: 'double' })
|
||||
longitude!: number;
|
||||
admin1name?: string;
|
||||
admin2name?: string;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Equals, IsInt, IsPositive, IsString } from 'class-validator';
|
||||
import { Session } from 'src/database';
|
||||
import { Optional, ValidateBoolean } from 'src/validation';
|
||||
@@ -9,6 +10,7 @@ export class SessionCreateDto {
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@Optional()
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
duration?: number;
|
||||
|
||||
@IsString()
|
||||
|
||||
@@ -53,6 +53,7 @@ export class DatabaseBackupConfig {
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: 'integer' })
|
||||
keepLastAmount!: number;
|
||||
}
|
||||
|
||||
@@ -451,6 +452,7 @@ class SystemConfigSmtpTransportDto {
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
@Max(65_535)
|
||||
@ApiProperty({ type: 'integer' })
|
||||
port!: number;
|
||||
|
||||
@IsString()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsDateString, IsInt, IsPositive, ValidateNested } from 'class-validator';
|
||||
import { AssetOrder, UserAvatarColor } from 'src/enum';
|
||||
@@ -72,7 +72,7 @@ class DownloadUpdate implements Partial<DownloadResponse> {
|
||||
@Optional()
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@ApiProperty({ type: 'integer' })
|
||||
@ApiPropertyOptional({ type: 'integer' })
|
||||
archiveSize?: number;
|
||||
|
||||
@ValidateBoolean({ optional: true })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsEmail, IsInt, IsNotEmpty, IsString, Min } from 'class-validator';
|
||||
import { User, UserAdmin } from 'src/database';
|
||||
@@ -93,7 +93,7 @@ export class UserAdminCreateDto {
|
||||
@Optional({ nullable: true })
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||
@ApiPropertyOptional({ type: 'integer', format: 'int64' })
|
||||
quotaSizeInBytes?: number | null;
|
||||
|
||||
@ValidateBoolean({ optional: true })
|
||||
@@ -139,7 +139,7 @@ export class UserAdminUpdateDto {
|
||||
@Optional({ nullable: true })
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||
@ApiPropertyOptional({ type: 'integer', format: 'int64' })
|
||||
quotaSizeInBytes?: number | null;
|
||||
|
||||
@ValidateBoolean({ optional: true })
|
||||
|
||||
Reference in New Issue
Block a user