Skip to content

Commit

Permalink
expose ownerId in personResponse
Browse files Browse the repository at this point in the history
make it possible for frontend to visualize the fact that this is a shared person
f.ex with a small icon or hiding actions like merge, change name etc that will
fail due to share beeing read-only.
  • Loading branch information
ttyridal committed Feb 21, 2024
1 parent 81cb0a9 commit fa04b02
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 3 deletions.
1 change: 1 addition & 0 deletions mobile/openapi/doc/PersonResponseDto.md

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

1 change: 1 addition & 0 deletions mobile/openapi/doc/PersonWithFacesResponseDto.md

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

10 changes: 9 additions & 1 deletion 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.

10 changes: 9 additions & 1 deletion mobile/openapi/lib/model/person_with_faces_response_dto.dart

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

5 changes: 5 additions & 0 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.

5 changes: 5 additions & 0 deletions mobile/openapi/test/person_with_faces_response_dto_test.dart

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

8 changes: 8 additions & 0 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8676,6 +8676,9 @@
"name": {
"type": "string"
},
"ownerId": {
"type": "string"
},
"thumbnailPath": {
"type": "string"
}
Expand All @@ -8685,6 +8688,7 @@
"id",
"isHidden",
"name",
"ownerId",
"thumbnailPath"
],
"type": "object"
Expand Down Expand Up @@ -8745,6 +8749,9 @@
"name": {
"type": "string"
},
"ownerId": {
"type": "string"
},
"thumbnailPath": {
"type": "string"
}
Expand All @@ -8755,6 +8762,7 @@
"id",
"isHidden",
"name",
"ownerId",
"thumbnailPath"
],
"type": "object"
Expand Down
12 changes: 12 additions & 0 deletions open-api/typescript-sdk/axios-client/api.ts

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

2 changes: 2 additions & 0 deletions open-api/typescript-sdk/fetch-client.ts

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

2 changes: 2 additions & 0 deletions server/src/domain/person/person.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class PersonResponseDto {
birthDate!: Date | null;
thumbnailPath!: string;
isHidden!: boolean;
ownerId!: string;
}

export class PersonWithFacesResponseDto extends PersonResponseDto {
Expand Down Expand Up @@ -143,6 +144,7 @@ export function mapPerson(person: PersonEntity): PersonResponseDto {
birthDate: person.birthDate,
thumbnailPath: person.thumbnailPath,
isHidden: person.isHidden,
ownerId: person.ownerId,
};
}

Expand Down
5 changes: 5 additions & 0 deletions server/src/domain/person/person.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const responseDto: PersonResponseDto = {
birthDate: null,
thumbnailPath: '/path/to/thumbnail.jpg',
isHidden: false,
ownerId: authStub.admin.user.id,
};

const statistics = { assets: 3 };
Expand Down Expand Up @@ -146,6 +147,7 @@ describe(PersonService.name, () => {
birthDate: null,
thumbnailPath: '/path/to/thumbnail',
isHidden: false,
ownerId: authStub.user1.user.id,
},
],
});
Expand Down Expand Up @@ -192,6 +194,7 @@ describe(PersonService.name, () => {
birthDate: null,
thumbnailPath: '/path/to/thumbnail.jpg',
isHidden: true,
ownerId: personStub.noName.ownerId,
},
],
});
Expand Down Expand Up @@ -325,6 +328,7 @@ describe(PersonService.name, () => {
birthDate: new Date('1976-06-30'),
thumbnailPath: '/path/to/thumbnail.jpg',
isHidden: false,
ownerId: personStub.noName.ownerId,
});
expect(personMock.getById).toHaveBeenCalledWith('person-1');
expect(personMock.update).toHaveBeenCalledWith({ id: 'person-1', birthDate: new Date('1976-06-30') });
Expand Down Expand Up @@ -525,6 +529,7 @@ describe(PersonService.name, () => {
isHidden: personStub.noName.isHidden,
id: personStub.noName.id,
name: personStub.noName.name,
ownerId: personStub.noName.ownerId,
thumbnailPath: personStub.noName.thumbnailPath,
});

Expand Down
5 changes: 4 additions & 1 deletion web/src/routes/(user)/explore/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import type { PageLoad } from './$types';

export const load = (async () => {
await authenticate();
const [items, response] = await Promise.all([getExploreData(), getAllPeople({ withHidden: false, withPartners: true })]);
const [items, response] = await Promise.all([
getExploreData(),
getAllPeople({ withHidden: false, withPartners: true }),
]);

return {
items,
Expand Down

0 comments on commit fa04b02

Please sign in to comment.