Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
martabal committed Jul 14, 2023
1 parent 01cdd71 commit 636e0e5
Show file tree
Hide file tree
Showing 21 changed files with 160 additions and 212 deletions.
4 changes: 2 additions & 2 deletions cli/src/api/open-api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ export interface PersonResponseDto {
* @type {boolean}
* @memberof PersonResponseDto
*/
'hidden': boolean;
'isHidden': boolean;
}
/**
*
Expand All @@ -1843,7 +1843,7 @@ export interface PersonUpdateDto {
* @type {boolean}
* @memberof PersonUpdateDto
*/
'hidden'?: boolean;
'isHidden'?: boolean;
}
/**
*
Expand Down
2 changes: 1 addition & 1 deletion mobile/openapi/doc/PersonResponseDto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mobile/openapi/doc/PersonUpdateDto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions mobile/openapi/lib/model/person_response_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions mobile/openapi/lib/model/person_update_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mobile/openapi/test/person_response_dto_test.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mobile/openapi/test/person_update_dto_test.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions server/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5896,15 +5896,15 @@
"thumbnailPath": {
"type": "string"
},
"hidden": {
"isHidden": {
"type": "boolean"
}
},
"required": [
"id",
"name",
"thumbnailPath",
"hidden"
"isHidden"
]
},
"PersonUpdateDto": {
Expand All @@ -5918,7 +5918,7 @@
"type": "string",
"description": "Asset is used to get the feature face thumbnail."
},
"hidden": {
"isHidden": {
"type": "boolean",
"description": "Person visibility"
}
Expand Down
6 changes: 3 additions & 3 deletions server/src/domain/person/person.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class PersonUpdateDto {
@IsOptional()
@IsBoolean()
@Transform(toBoolean)
hidden?: boolean;
isHidden?: boolean;
}

export class MergePersonDto {
Expand All @@ -36,15 +36,15 @@ export class PersonResponseDto {
id!: string;
name!: string;
thumbnailPath!: string;
hidden!: boolean;
isHidden!: boolean;
}

export function mapPerson(person: PersonEntity): PersonResponseDto {
return {
id: person.id,
name: person.name,
thumbnailPath: person.thumbnailPath,
hidden: person.hidden,
isHidden: person.isHidden,
};
}

Expand Down
4 changes: 2 additions & 2 deletions server/src/domain/person/person.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export class PersonService {
await this.jobRepository.queue({ name: JobName.SEARCH_INDEX_ASSET, data: { ids } });
}

if (dto.hidden !== undefined) {
person = await this.repository.update({ id, hidden: dto.hidden });
if (dto.isHidden !== undefined) {
person = await this.repository.update({ id, isHidden: dto.isHidden });
const assets = await this.repository.getAssets(authUser.id, id);
const ids = assets.map((asset) => asset.id);
await this.jobRepository.queue({ name: JobName.SEARCH_INDEX_ASSET, data: { ids } });
Expand Down
8 changes: 7 additions & 1 deletion server/src/immich/api-v1/asset/asset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,13 @@ export class AssetService {
const asset = await this._assetRepository.getById(assetId);

if (allowExif) {
return mapAsset(asset);
const data = mapAsset(asset);

if (data.people) {
data.people = data.people.filter((person) => !person.isHidden);
}

return data;
} else {
return mapAssetWithoutExif(asset);
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/infra/entities/person.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export class PersonEntity {
faces!: AssetFaceEntity[];

@Column({ default: false })
hidden!: boolean;
isHidden!: boolean;
}
4 changes: 2 additions & 2 deletions server/src/infra/migrations/1689281196844-AddHiddenFaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export class Infra1689281196844 implements MigrationInterface {
name = 'Infra1689281196844'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "person" ADD "hidden" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "person" ADD "isHidden" boolean NOT NULL DEFAULT false`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "person" DROP COLUMN "hidden"`);
await queryRunner.query(`ALTER TABLE "person" DROP COLUMN "isHidden"`);
}

}
34 changes: 6 additions & 28 deletions server/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ export const personStub = {
name: '',
thumbnailPath: '/path/to/thumbnail.jpg',
faces: [],
hidden: false,
isHidden: false,
}),
withName: Object.freeze<PersonEntity>({
id: 'person-1',
Expand All @@ -1171,29 +1171,7 @@ export const personStub = {
name: 'Person 1',
thumbnailPath: '/path/to/thumbnail.jpg',
faces: [],
hidden: false,
}),
isHidden: Object.freeze<PersonEntity>({
id: 'person-1',
createdAt: new Date('2021-01-01'),
updatedAt: new Date('2021-01-01'),
ownerId: userEntityStub.admin.id,
owner: userEntityStub.admin,
name: 'Person 1',
thumbnailPath: '/path/to/thumbnail.jpg',
faces: [],
hidden: false,
}),
isnotHidden: Object.freeze<PersonEntity>({
id: 'person-1',
createdAt: new Date('2021-01-01'),
updatedAt: new Date('2021-01-01'),
ownerId: userEntityStub.admin.id,
owner: userEntityStub.admin,
name: 'Person 1',
thumbnailPath: '/path/to/thumbnail.jpg',
faces: [],
hidden: true,
isHidden: false,
}),
noThumbnail: Object.freeze<PersonEntity>({
id: 'person-1',
Expand All @@ -1204,7 +1182,7 @@ export const personStub = {
name: '',
thumbnailPath: '',
faces: [],
hidden: false,
isHidden: false,
}),
newThumbnail: Object.freeze<PersonEntity>({
id: 'person-1',
Expand All @@ -1215,7 +1193,7 @@ export const personStub = {
name: '',
thumbnailPath: '/new/path/to/thumbnail.jpg',
faces: [],
hidden: false,
isHidden: false,
}),
primaryPerson: Object.freeze<PersonEntity>({
id: 'person-1',
Expand All @@ -1226,7 +1204,7 @@ export const personStub = {
name: 'Person 1',
thumbnailPath: '/path/to/thumbnail',
faces: [],
hidden: false,
isHidden: false,
}),
mergePerson: Object.freeze<PersonEntity>({
id: 'person-2',
Expand All @@ -1237,7 +1215,7 @@ export const personStub = {
name: 'Person 2',
thumbnailPath: '/path/to/thumbnail',
faces: [],
hidden: false,
isHidden: false,
}),
};

Expand Down
4 changes: 2 additions & 2 deletions web/src/api/open-api/api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 636e0e5

Please sign in to comment.