0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-11 02:23:09 -05:00

fix(server): don't expose source types in face creation api (#16381)

* don't expose source types in face creation api

* update open-api

* remove source type reference from web
This commit is contained in:
Mert 2025-02-27 17:17:07 +03:00 committed by GitHub
parent 967c69317b
commit 7d6cfd09e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 4 additions and 27 deletions

View file

@ -18,7 +18,6 @@ class AssetFaceCreateDto {
required this.imageHeight, required this.imageHeight,
required this.imageWidth, required this.imageWidth,
required this.personId, required this.personId,
this.sourceType = SourceType.manual,
required this.width, required this.width,
required this.x, required this.x,
required this.y, required this.y,
@ -34,8 +33,6 @@ class AssetFaceCreateDto {
String personId; String personId;
SourceType sourceType;
int width; int width;
int x; int x;
@ -49,7 +46,6 @@ class AssetFaceCreateDto {
other.imageHeight == imageHeight && other.imageHeight == imageHeight &&
other.imageWidth == imageWidth && other.imageWidth == imageWidth &&
other.personId == personId && other.personId == personId &&
other.sourceType == sourceType &&
other.width == width && other.width == width &&
other.x == x && other.x == x &&
other.y == y; other.y == y;
@ -62,13 +58,12 @@ class AssetFaceCreateDto {
(imageHeight.hashCode) + (imageHeight.hashCode) +
(imageWidth.hashCode) + (imageWidth.hashCode) +
(personId.hashCode) + (personId.hashCode) +
(sourceType.hashCode) +
(width.hashCode) + (width.hashCode) +
(x.hashCode) + (x.hashCode) +
(y.hashCode); (y.hashCode);
@override @override
String toString() => 'AssetFaceCreateDto[assetId=$assetId, height=$height, imageHeight=$imageHeight, imageWidth=$imageWidth, personId=$personId, sourceType=$sourceType, width=$width, x=$x, y=$y]'; String toString() => 'AssetFaceCreateDto[assetId=$assetId, height=$height, imageHeight=$imageHeight, imageWidth=$imageWidth, personId=$personId, width=$width, x=$x, y=$y]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -77,7 +72,6 @@ class AssetFaceCreateDto {
json[r'imageHeight'] = this.imageHeight; json[r'imageHeight'] = this.imageHeight;
json[r'imageWidth'] = this.imageWidth; json[r'imageWidth'] = this.imageWidth;
json[r'personId'] = this.personId; json[r'personId'] = this.personId;
json[r'sourceType'] = this.sourceType;
json[r'width'] = this.width; json[r'width'] = this.width;
json[r'x'] = this.x; json[r'x'] = this.x;
json[r'y'] = this.y; json[r'y'] = this.y;
@ -98,7 +92,6 @@ class AssetFaceCreateDto {
imageHeight: mapValueOfType<int>(json, r'imageHeight')!, imageHeight: mapValueOfType<int>(json, r'imageHeight')!,
imageWidth: mapValueOfType<int>(json, r'imageWidth')!, imageWidth: mapValueOfType<int>(json, r'imageWidth')!,
personId: mapValueOfType<String>(json, r'personId')!, personId: mapValueOfType<String>(json, r'personId')!,
sourceType: SourceType.fromJson(json[r'sourceType'])!,
width: mapValueOfType<int>(json, r'width')!, width: mapValueOfType<int>(json, r'width')!,
x: mapValueOfType<int>(json, r'x')!, x: mapValueOfType<int>(json, r'x')!,
y: mapValueOfType<int>(json, r'y')!, y: mapValueOfType<int>(json, r'y')!,
@ -154,7 +147,6 @@ class AssetFaceCreateDto {
'imageHeight', 'imageHeight',
'imageWidth', 'imageWidth',
'personId', 'personId',
'sourceType',
'width', 'width',
'x', 'x',
'y', 'y',

View file

@ -8301,14 +8301,6 @@
"format": "uuid", "format": "uuid",
"type": "string" "type": "string"
}, },
"sourceType": {
"allOf": [
{
"$ref": "#/components/schemas/SourceType"
}
],
"default": "manual"
},
"width": { "width": {
"type": "integer" "type": "integer"
}, },
@ -8325,7 +8317,6 @@
"imageHeight", "imageHeight",
"imageWidth", "imageWidth",
"personId", "personId",
"sourceType",
"width", "width",
"x", "x",
"y" "y"

View file

@ -529,7 +529,6 @@ export type AssetFaceCreateDto = {
imageHeight: number; imageHeight: number;
imageWidth: number; imageWidth: number;
personId: string; personId: string;
sourceType: SourceType;
width: number; width: number;
x: number; x: number;
y: number; y: number;

View file

@ -1,6 +1,6 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer'; import { Type } from 'class-transformer';
import { IsArray, IsEnum, IsInt, IsNotEmpty, IsNumber, IsString, Max, Min, ValidateNested } from 'class-validator'; import { IsArray, IsInt, IsNotEmpty, IsNumber, IsString, Max, Min, ValidateNested } from 'class-validator';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { PropertyLifecycle } from 'src/decorators'; import { PropertyLifecycle } from 'src/decorators';
import { AuthDto } from 'src/dtos/auth.dto'; import { AuthDto } from 'src/dtos/auth.dto';
@ -194,10 +194,6 @@ export class AssetFaceCreateDto extends AssetFaceUpdateItem {
@IsNotEmpty() @IsNotEmpty()
@IsNumber() @IsNumber()
height!: number; height!: number;
@ApiProperty({ type: 'string', enum: SourceType, enumName: 'SourceType' })
@IsEnum(SourceType)
sourceType: SourceType = SourceType.MANUAL;
} }
export class AssetFaceDeleteDto { export class AssetFaceDeleteDto {

View file

@ -736,7 +736,7 @@ export class PersonService extends BaseService {
boundingBoxX2: dto.x + dto.width, boundingBoxX2: dto.x + dto.width,
boundingBoxY1: dto.y, boundingBoxY1: dto.y,
boundingBoxY2: dto.y + dto.height, boundingBoxY2: dto.y + dto.height,
sourceType: dto.sourceType, sourceType: SourceType.MANUAL,
}); });
} }

View file

@ -4,7 +4,7 @@
import { notificationController } from '$lib/components/shared-components/notification/notification'; import { notificationController } from '$lib/components/shared-components/notification/notification';
import { isFaceEditMode } from '$lib/stores/face-edit.svelte'; import { isFaceEditMode } from '$lib/stores/face-edit.svelte';
import { getPeopleThumbnailUrl } from '$lib/utils'; import { getPeopleThumbnailUrl } from '$lib/utils';
import { getAllPeople, createFace, type PersonResponseDto, SourceType } from '@immich/sdk'; import { getAllPeople, createFace, type PersonResponseDto } from '@immich/sdk';
import { Button } from '@immich/ui'; import { Button } from '@immich/ui';
import { Canvas, InteractiveFabricObject, Rect } from 'fabric'; import { Canvas, InteractiveFabricObject, Rect } from 'fabric';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
@ -288,7 +288,6 @@
assetFaceCreateDto: { assetFaceCreateDto: {
assetId, assetId,
personId: person.id, personId: person.id,
sourceType: SourceType.Manual,
...data, ...data,
}, },
}); });