mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
chore: remove deprecated endpoint (#13190)
This commit is contained in:
parent
08db817d14
commit
7ee0221c8e
12 changed files with 0 additions and 236 deletions
BIN
mobile/openapi/README.md
generated
BIN
mobile/openapi/README.md
generated
Binary file not shown.
BIN
mobile/openapi/lib/api/deprecated_api.dart
generated
BIN
mobile/openapi/lib/api/deprecated_api.dart
generated
Binary file not shown.
BIN
mobile/openapi/lib/api/people_api.dart
generated
BIN
mobile/openapi/lib/api/people_api.dart
generated
Binary file not shown.
|
@ -4030,57 +4030,6 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/people/{id}/assets": {
|
|
||||||
"get": {
|
|
||||||
"deprecated": true,
|
|
||||||
"description": "This property was deprecated in v1.113.0",
|
|
||||||
"operationId": "getPersonAssets",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"required": true,
|
|
||||||
"in": "path",
|
|
||||||
"schema": {
|
|
||||||
"format": "uuid",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/components/schemas/AssetResponseDto"
|
|
||||||
},
|
|
||||||
"type": "array"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"bearer": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cookie": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"api_key": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"People",
|
|
||||||
"Deprecated"
|
|
||||||
],
|
|
||||||
"x-immich-lifecycle": {
|
|
||||||
"deprecatedAt": "v1.113.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/people/{id}/merge": {
|
"/people/{id}/merge": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "mergePerson",
|
"operationId": "mergePerson",
|
||||||
|
|
|
@ -2384,19 +2384,6 @@ export function updatePerson({ id, personUpdateDto }: {
|
||||||
body: personUpdateDto
|
body: personUpdateDto
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* This property was deprecated in v1.113.0
|
|
||||||
*/
|
|
||||||
export function getPersonAssets({ id }: {
|
|
||||||
id: string;
|
|
||||||
}, opts?: Oazapfts.RequestOpts) {
|
|
||||||
return oazapfts.ok(oazapfts.fetchJson<{
|
|
||||||
status: 200;
|
|
||||||
data: AssetResponseDto[];
|
|
||||||
}>(`/people/${encodeURIComponent(id)}/assets`, {
|
|
||||||
...opts
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
export function mergePerson({ id, mergePersonDto }: {
|
export function mergePerson({ id, mergePersonDto }: {
|
||||||
id: string;
|
id: string;
|
||||||
mergePersonDto: MergePersonDto;
|
mergePersonDto: MergePersonDto;
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import { Body, Controller, Get, Inject, Next, Param, Post, Put, Query, Res } from '@nestjs/common';
|
import { Body, Controller, Get, Inject, Next, Param, Post, Put, Query, Res } from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
import { NextFunction, Response } from 'express';
|
import { NextFunction, Response } from 'express';
|
||||||
import { EndpointLifecycle } from 'src/decorators';
|
|
||||||
import { BulkIdResponseDto } from 'src/dtos/asset-ids.response.dto';
|
import { BulkIdResponseDto } from 'src/dtos/asset-ids.response.dto';
|
||||||
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
|
|
||||||
import { AuthDto } from 'src/dtos/auth.dto';
|
import { AuthDto } from 'src/dtos/auth.dto';
|
||||||
import {
|
import {
|
||||||
AssetFaceUpdateDto,
|
AssetFaceUpdateDto,
|
||||||
|
@ -83,13 +81,6 @@ export class PersonController {
|
||||||
await sendFile(res, next, () => this.service.getThumbnail(auth, id), this.logger);
|
await sendFile(res, next, () => this.service.getThumbnail(auth, id), this.logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EndpointLifecycle({ deprecatedAt: 'v1.113.0' })
|
|
||||||
@Get(':id/assets')
|
|
||||||
@Authenticated()
|
|
||||||
getPersonAssets(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<AssetResponseDto[]> {
|
|
||||||
return this.service.getAssets(auth, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Put(':id/reassign')
|
@Put(':id/reassign')
|
||||||
@Authenticated({ permission: Permission.PERSON_REASSIGN })
|
@Authenticated({ permission: Permission.PERSON_REASSIGN })
|
||||||
reassignFaces(
|
reassignFaces(
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { AssetFaceEntity } from 'src/entities/asset-face.entity';
|
import { AssetFaceEntity } from 'src/entities/asset-face.entity';
|
||||||
import { AssetEntity } from 'src/entities/asset.entity';
|
|
||||||
import { FaceSearchEntity } from 'src/entities/face-search.entity';
|
import { FaceSearchEntity } from 'src/entities/face-search.entity';
|
||||||
import { PersonEntity } from 'src/entities/person.entity';
|
import { PersonEntity } from 'src/entities/person.entity';
|
||||||
import { SourceType } from 'src/enum';
|
import { SourceType } from 'src/enum';
|
||||||
|
@ -56,8 +55,6 @@ export interface IPersonRepository {
|
||||||
getByName(userId: string, personName: string, options: PersonNameSearchOptions): Promise<PersonEntity[]>;
|
getByName(userId: string, personName: string, options: PersonNameSearchOptions): Promise<PersonEntity[]>;
|
||||||
getDistinctNames(userId: string, options: PersonNameSearchOptions): Promise<PersonNameResponse[]>;
|
getDistinctNames(userId: string, options: PersonNameSearchOptions): Promise<PersonNameResponse[]>;
|
||||||
|
|
||||||
getAssets(personId: string): Promise<AssetEntity[]>;
|
|
||||||
|
|
||||||
create(person: Partial<PersonEntity>): Promise<PersonEntity>;
|
create(person: Partial<PersonEntity>): Promise<PersonEntity>;
|
||||||
createAll(people: Partial<PersonEntity>[]): Promise<string[]>;
|
createAll(people: Partial<PersonEntity>[]): Promise<string[]>;
|
||||||
createFaces(entities: Partial<AssetFaceEntity>[]): Promise<string[]>;
|
createFaces(entities: Partial<AssetFaceEntity>[]): Promise<string[]>;
|
||||||
|
|
|
@ -248,114 +248,6 @@ WHERE
|
||||||
AND "asset"."deletedAt" IS NULL
|
AND "asset"."deletedAt" IS NULL
|
||||||
AND "asset"."livePhotoVideoId" IS NULL
|
AND "asset"."livePhotoVideoId" IS NULL
|
||||||
|
|
||||||
-- PersonRepository.getAssets
|
|
||||||
SELECT DISTINCT
|
|
||||||
"distinctAlias"."AssetEntity_id" AS "ids_AssetEntity_id",
|
|
||||||
"distinctAlias"."AssetEntity_fileCreatedAt"
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT
|
|
||||||
"AssetEntity"."id" AS "AssetEntity_id",
|
|
||||||
"AssetEntity"."deviceAssetId" AS "AssetEntity_deviceAssetId",
|
|
||||||
"AssetEntity"."ownerId" AS "AssetEntity_ownerId",
|
|
||||||
"AssetEntity"."libraryId" AS "AssetEntity_libraryId",
|
|
||||||
"AssetEntity"."deviceId" AS "AssetEntity_deviceId",
|
|
||||||
"AssetEntity"."type" AS "AssetEntity_type",
|
|
||||||
"AssetEntity"."status" AS "AssetEntity_status",
|
|
||||||
"AssetEntity"."originalPath" AS "AssetEntity_originalPath",
|
|
||||||
"AssetEntity"."thumbhash" AS "AssetEntity_thumbhash",
|
|
||||||
"AssetEntity"."encodedVideoPath" AS "AssetEntity_encodedVideoPath",
|
|
||||||
"AssetEntity"."createdAt" AS "AssetEntity_createdAt",
|
|
||||||
"AssetEntity"."updatedAt" AS "AssetEntity_updatedAt",
|
|
||||||
"AssetEntity"."deletedAt" AS "AssetEntity_deletedAt",
|
|
||||||
"AssetEntity"."fileCreatedAt" AS "AssetEntity_fileCreatedAt",
|
|
||||||
"AssetEntity"."localDateTime" AS "AssetEntity_localDateTime",
|
|
||||||
"AssetEntity"."fileModifiedAt" AS "AssetEntity_fileModifiedAt",
|
|
||||||
"AssetEntity"."isFavorite" AS "AssetEntity_isFavorite",
|
|
||||||
"AssetEntity"."isArchived" AS "AssetEntity_isArchived",
|
|
||||||
"AssetEntity"."isExternal" AS "AssetEntity_isExternal",
|
|
||||||
"AssetEntity"."isOffline" AS "AssetEntity_isOffline",
|
|
||||||
"AssetEntity"."checksum" AS "AssetEntity_checksum",
|
|
||||||
"AssetEntity"."duration" AS "AssetEntity_duration",
|
|
||||||
"AssetEntity"."isVisible" AS "AssetEntity_isVisible",
|
|
||||||
"AssetEntity"."livePhotoVideoId" AS "AssetEntity_livePhotoVideoId",
|
|
||||||
"AssetEntity"."originalFileName" AS "AssetEntity_originalFileName",
|
|
||||||
"AssetEntity"."sidecarPath" AS "AssetEntity_sidecarPath",
|
|
||||||
"AssetEntity"."stackId" AS "AssetEntity_stackId",
|
|
||||||
"AssetEntity"."duplicateId" AS "AssetEntity_duplicateId",
|
|
||||||
"AssetEntity__AssetEntity_faces"."id" AS "AssetEntity__AssetEntity_faces_id",
|
|
||||||
"AssetEntity__AssetEntity_faces"."assetId" AS "AssetEntity__AssetEntity_faces_assetId",
|
|
||||||
"AssetEntity__AssetEntity_faces"."personId" AS "AssetEntity__AssetEntity_faces_personId",
|
|
||||||
"AssetEntity__AssetEntity_faces"."imageWidth" AS "AssetEntity__AssetEntity_faces_imageWidth",
|
|
||||||
"AssetEntity__AssetEntity_faces"."imageHeight" AS "AssetEntity__AssetEntity_faces_imageHeight",
|
|
||||||
"AssetEntity__AssetEntity_faces"."boundingBoxX1" AS "AssetEntity__AssetEntity_faces_boundingBoxX1",
|
|
||||||
"AssetEntity__AssetEntity_faces"."boundingBoxY1" AS "AssetEntity__AssetEntity_faces_boundingBoxY1",
|
|
||||||
"AssetEntity__AssetEntity_faces"."boundingBoxX2" AS "AssetEntity__AssetEntity_faces_boundingBoxX2",
|
|
||||||
"AssetEntity__AssetEntity_faces"."boundingBoxY2" AS "AssetEntity__AssetEntity_faces_boundingBoxY2",
|
|
||||||
"AssetEntity__AssetEntity_faces"."sourceType" AS "AssetEntity__AssetEntity_faces_sourceType",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."id" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_id",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."createdAt" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_createdAt",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."updatedAt" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_updatedAt",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."ownerId" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_ownerId",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."name" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_name",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."birthDate" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_birthDate",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."thumbnailPath" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_thumbnailPath",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."faceAssetId" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_faceAssetId",
|
|
||||||
"8258e303a73a72cf6abb13d73fb592dde0d68280"."isHidden" AS "8258e303a73a72cf6abb13d73fb592dde0d68280_isHidden",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."assetId" AS "AssetEntity__AssetEntity_exifInfo_assetId",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."description" AS "AssetEntity__AssetEntity_exifInfo_description",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."exifImageWidth" AS "AssetEntity__AssetEntity_exifInfo_exifImageWidth",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."exifImageHeight" AS "AssetEntity__AssetEntity_exifInfo_exifImageHeight",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."fileSizeInByte" AS "AssetEntity__AssetEntity_exifInfo_fileSizeInByte",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."orientation" AS "AssetEntity__AssetEntity_exifInfo_orientation",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."dateTimeOriginal" AS "AssetEntity__AssetEntity_exifInfo_dateTimeOriginal",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."modifyDate" AS "AssetEntity__AssetEntity_exifInfo_modifyDate",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."timeZone" AS "AssetEntity__AssetEntity_exifInfo_timeZone",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."latitude" AS "AssetEntity__AssetEntity_exifInfo_latitude",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."longitude" AS "AssetEntity__AssetEntity_exifInfo_longitude",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."projectionType" AS "AssetEntity__AssetEntity_exifInfo_projectionType",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."city" AS "AssetEntity__AssetEntity_exifInfo_city",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."livePhotoCID" AS "AssetEntity__AssetEntity_exifInfo_livePhotoCID",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."autoStackId" AS "AssetEntity__AssetEntity_exifInfo_autoStackId",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."state" AS "AssetEntity__AssetEntity_exifInfo_state",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."country" AS "AssetEntity__AssetEntity_exifInfo_country",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."make" AS "AssetEntity__AssetEntity_exifInfo_make",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."model" AS "AssetEntity__AssetEntity_exifInfo_model",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."lensModel" AS "AssetEntity__AssetEntity_exifInfo_lensModel",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."fNumber" AS "AssetEntity__AssetEntity_exifInfo_fNumber",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."focalLength" AS "AssetEntity__AssetEntity_exifInfo_focalLength",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."iso" AS "AssetEntity__AssetEntity_exifInfo_iso",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."exposureTime" AS "AssetEntity__AssetEntity_exifInfo_exposureTime",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."profileDescription" AS "AssetEntity__AssetEntity_exifInfo_profileDescription",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."colorspace" AS "AssetEntity__AssetEntity_exifInfo_colorspace",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."bitsPerSample" AS "AssetEntity__AssetEntity_exifInfo_bitsPerSample",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."rating" AS "AssetEntity__AssetEntity_exifInfo_rating",
|
|
||||||
"AssetEntity__AssetEntity_exifInfo"."fps" AS "AssetEntity__AssetEntity_exifInfo_fps"
|
|
||||||
FROM
|
|
||||||
"assets" "AssetEntity"
|
|
||||||
LEFT JOIN "asset_faces" "AssetEntity__AssetEntity_faces" ON "AssetEntity__AssetEntity_faces"."assetId" = "AssetEntity"."id"
|
|
||||||
LEFT JOIN "person" "8258e303a73a72cf6abb13d73fb592dde0d68280" ON "8258e303a73a72cf6abb13d73fb592dde0d68280"."id" = "AssetEntity__AssetEntity_faces"."personId"
|
|
||||||
LEFT JOIN "exif" "AssetEntity__AssetEntity_exifInfo" ON "AssetEntity__AssetEntity_exifInfo"."assetId" = "AssetEntity"."id"
|
|
||||||
WHERE
|
|
||||||
(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
("AssetEntity__AssetEntity_faces"."personId" = $1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
AND ("AssetEntity"."isVisible" = $2)
|
|
||||||
AND ("AssetEntity"."isArchived" = $3)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
AND ("AssetEntity"."deletedAt" IS NULL)
|
|
||||||
) "distinctAlias"
|
|
||||||
ORDER BY
|
|
||||||
"distinctAlias"."AssetEntity_fileCreatedAt" DESC,
|
|
||||||
"AssetEntity_id" ASC
|
|
||||||
LIMIT
|
|
||||||
1000
|
|
||||||
|
|
||||||
-- PersonRepository.getNumberOfPeople
|
-- PersonRepository.getNumberOfPeople
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(DISTINCT ("person"."id")) AS "total",
|
COUNT(DISTINCT ("person"."id")) AS "total",
|
||||||
|
|
|
@ -234,30 +234,6 @@ export class PersonRepository implements IPersonRepository {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@GenerateSql({ params: [DummyValue.UUID] })
|
|
||||||
getAssets(personId: string): Promise<AssetEntity[]> {
|
|
||||||
return this.assetRepository.find({
|
|
||||||
where: {
|
|
||||||
faces: {
|
|
||||||
personId,
|
|
||||||
},
|
|
||||||
isVisible: true,
|
|
||||||
isArchived: false,
|
|
||||||
},
|
|
||||||
relations: {
|
|
||||||
faces: {
|
|
||||||
person: true,
|
|
||||||
},
|
|
||||||
exifInfo: true,
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
fileCreatedAt: 'desc',
|
|
||||||
},
|
|
||||||
// TODO: remove after either (1) pagination or (2) time bucket is implemented for this query
|
|
||||||
take: 1000,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@GenerateSql({ params: [DummyValue.UUID] })
|
@GenerateSql({ params: [DummyValue.UUID] })
|
||||||
async getNumberOfPeople(userId: string): Promise<PeopleStatistics> {
|
async getNumberOfPeople(userId: string): Promise<PeopleStatistics> {
|
||||||
const items = await this.personRepository
|
const items = await this.personRepository
|
||||||
|
|
|
@ -189,23 +189,6 @@ describe(PersonService.name, () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getAssets', () => {
|
|
||||||
it('should require person.read permission', async () => {
|
|
||||||
personMock.getAssets.mockResolvedValue([assetStub.image, assetStub.video]);
|
|
||||||
await expect(sut.getAssets(authStub.admin, 'person-1')).rejects.toBeInstanceOf(BadRequestException);
|
|
||||||
expect(personMock.getAssets).not.toHaveBeenCalled();
|
|
||||||
expect(accessMock.person.checkOwnerAccess).toHaveBeenCalledWith(authStub.admin.user.id, new Set(['person-1']));
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return a person's assets", async () => {
|
|
||||||
personMock.getAssets.mockResolvedValue([assetStub.image, assetStub.video]);
|
|
||||||
accessMock.person.checkOwnerAccess.mockResolvedValue(new Set(['person-1']));
|
|
||||||
await sut.getAssets(authStub.admin, 'person-1');
|
|
||||||
expect(personMock.getAssets).toHaveBeenCalledWith('person-1');
|
|
||||||
expect(accessMock.person.checkOwnerAccess).toHaveBeenCalledWith(authStub.admin.user.id, new Set(['person-1']));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('update', () => {
|
describe('update', () => {
|
||||||
it('should require person.write permission', async () => {
|
it('should require person.write permission', async () => {
|
||||||
personMock.getById.mockResolvedValue(personStub.noName);
|
personMock.getById.mockResolvedValue(personStub.noName);
|
||||||
|
@ -227,7 +210,6 @@ describe(PersonService.name, () => {
|
||||||
|
|
||||||
it("should update a person's name", async () => {
|
it("should update a person's name", async () => {
|
||||||
personMock.update.mockResolvedValue(personStub.withName);
|
personMock.update.mockResolvedValue(personStub.withName);
|
||||||
personMock.getAssets.mockResolvedValue([assetStub.image]);
|
|
||||||
accessMock.person.checkOwnerAccess.mockResolvedValue(new Set(['person-1']));
|
accessMock.person.checkOwnerAccess.mockResolvedValue(new Set(['person-1']));
|
||||||
|
|
||||||
await expect(sut.update(authStub.admin, 'person-1', { name: 'Person 1' })).resolves.toEqual(responseDto);
|
await expect(sut.update(authStub.admin, 'person-1', { name: 'Person 1' })).resolves.toEqual(responseDto);
|
||||||
|
@ -238,7 +220,6 @@ describe(PersonService.name, () => {
|
||||||
|
|
||||||
it("should update a person's date of birth", async () => {
|
it("should update a person's date of birth", async () => {
|
||||||
personMock.update.mockResolvedValue(personStub.withBirthDate);
|
personMock.update.mockResolvedValue(personStub.withBirthDate);
|
||||||
personMock.getAssets.mockResolvedValue([assetStub.image]);
|
|
||||||
accessMock.person.checkOwnerAccess.mockResolvedValue(new Set(['person-1']));
|
accessMock.person.checkOwnerAccess.mockResolvedValue(new Set(['person-1']));
|
||||||
|
|
||||||
await expect(sut.update(authStub.admin, 'person-1', { birthDate: '1976-06-30' })).resolves.toEqual({
|
await expect(sut.update(authStub.admin, 'person-1', { birthDate: '1976-06-30' })).resolves.toEqual({
|
||||||
|
@ -257,7 +238,6 @@ describe(PersonService.name, () => {
|
||||||
|
|
||||||
it('should update a person visibility', async () => {
|
it('should update a person visibility', async () => {
|
||||||
personMock.update.mockResolvedValue(personStub.withName);
|
personMock.update.mockResolvedValue(personStub.withName);
|
||||||
personMock.getAssets.mockResolvedValue([assetStub.image]);
|
|
||||||
accessMock.person.checkOwnerAccess.mockResolvedValue(new Set(['person-1']));
|
accessMock.person.checkOwnerAccess.mockResolvedValue(new Set(['person-1']));
|
||||||
|
|
||||||
await expect(sut.update(authStub.admin, 'person-1', { isHidden: false })).resolves.toEqual(responseDto);
|
await expect(sut.update(authStub.admin, 'person-1', { isHidden: false })).resolves.toEqual(responseDto);
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { BadRequestException, Injectable, NotFoundException } from '@nestjs/comm
|
||||||
import { FACE_THUMBNAIL_SIZE } from 'src/constants';
|
import { FACE_THUMBNAIL_SIZE } from 'src/constants';
|
||||||
import { StorageCore } from 'src/cores/storage.core';
|
import { StorageCore } from 'src/cores/storage.core';
|
||||||
import { BulkIdErrorReason, BulkIdResponseDto } from 'src/dtos/asset-ids.response.dto';
|
import { BulkIdErrorReason, BulkIdResponseDto } from 'src/dtos/asset-ids.response.dto';
|
||||||
import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
|
|
||||||
import { AuthDto } from 'src/dtos/auth.dto';
|
import { AuthDto } from 'src/dtos/auth.dto';
|
||||||
import {
|
import {
|
||||||
AssetFaceResponseDto,
|
AssetFaceResponseDto,
|
||||||
|
@ -174,12 +173,6 @@ export class PersonService extends BaseService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAssets(auth: AuthDto, id: string): Promise<AssetResponseDto[]> {
|
|
||||||
await requireAccess(this.accessRepository, { auth, permission: Permission.PERSON_READ, ids: [id] });
|
|
||||||
const assets = await this.personRepository.getAssets(id);
|
|
||||||
return assets.map((asset) => mapAsset(asset));
|
|
||||||
}
|
|
||||||
|
|
||||||
create(auth: AuthDto, dto: PersonCreateDto): Promise<PersonResponseDto> {
|
create(auth: AuthDto, dto: PersonCreateDto): Promise<PersonResponseDto> {
|
||||||
return this.personRepository.create({
|
return this.personRepository.create({
|
||||||
ownerId: auth.user.id,
|
ownerId: auth.user.id,
|
||||||
|
|
|
@ -6,7 +6,6 @@ export const newPersonRepositoryMock = (): Mocked<IPersonRepository> => {
|
||||||
getById: vitest.fn(),
|
getById: vitest.fn(),
|
||||||
getAll: vitest.fn(),
|
getAll: vitest.fn(),
|
||||||
getAllForUser: vitest.fn(),
|
getAllForUser: vitest.fn(),
|
||||||
getAssets: vitest.fn(),
|
|
||||||
getAllWithoutFaces: vitest.fn(),
|
getAllWithoutFaces: vitest.fn(),
|
||||||
|
|
||||||
getByName: vitest.fn(),
|
getByName: vitest.fn(),
|
||||||
|
|
Loading…
Reference in a new issue