Skip to content

Commit

Permalink
fix(server): album statistics endpoint (#11924)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 authored Aug 20, 2024
1 parent cde0458 commit ef9a06b
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 104 deletions.
6 changes: 3 additions & 3 deletions e2e/src/api/specs/album.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,16 @@ describe('/albums', () => {
});
});

describe('GET /albums/count', () => {
describe('GET /albums/statistics', () => {
it('should require authentication', async () => {
const { status, body } = await request(app).get('/albums/count');
const { status, body } = await request(app).get('/albums/statistics');
expect(status).toBe(401);
expect(body).toEqual(errorDto.unauthorized);
});

it('should return total count of albums the user has access to', async () => {
const { status, body } = await request(app)
.get('/albums/count')
.get('/albums/statistics')
.set('Authorization', `Bearer ${user1.accessToken}`);

expect(status).toBe(200);
Expand Down
4 changes: 2 additions & 2 deletions mobile/openapi/README.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/lib/api.dart

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

68 changes: 34 additions & 34 deletions mobile/openapi/lib/api/albums_api.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/lib/api_client.dart

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

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

44 changes: 22 additions & 22 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,16 @@
]
}
},
"/albums/count": {
"/albums/statistics": {
"get": {
"operationId": "getAlbumCount",
"operationId": "getAlbumStatistics",
"parameters": [],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AlbumCountResponseDto"
"$ref": "#/components/schemas/AlbumStatisticsResponseDto"
}
}
},
Expand Down Expand Up @@ -7505,25 +7505,6 @@
],
"type": "object"
},
"AlbumCountResponseDto": {
"properties": {
"notShared": {
"type": "integer"
},
"owned": {
"type": "integer"
},
"shared": {
"type": "integer"
}
},
"required": [
"notShared",
"owned",
"shared"
],
"type": "object"
},
"AlbumResponseDto": {
"properties": {
"albumName": {
Expand Down Expand Up @@ -7611,6 +7592,25 @@
],
"type": "object"
},
"AlbumStatisticsResponseDto": {
"properties": {
"notShared": {
"type": "integer"
},
"owned": {
"type": "integer"
},
"shared": {
"type": "integer"
}
},
"required": [
"notShared",
"owned",
"shared"
],
"type": "object"
},
"AlbumUserAddDto": {
"properties": {
"role": {
Expand Down
8 changes: 4 additions & 4 deletions open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export type CreateAlbumDto = {
assetIds?: string[];
description?: string;
};
export type AlbumCountResponseDto = {
export type AlbumStatisticsResponseDto = {
notShared: number;
owned: number;
shared: number;
Expand Down Expand Up @@ -1369,11 +1369,11 @@ export function createAlbum({ createAlbumDto }: {
body: createAlbumDto
})));
}
export function getAlbumCount(opts?: Oazapfts.RequestOpts) {
export function getAlbumStatistics(opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: AlbumCountResponseDto;
}>("/albums/count", {
data: AlbumStatisticsResponseDto;
}>("/albums/statistics", {
...opts
}));
}
Expand Down
Loading

0 comments on commit ef9a06b

Please sign in to comment.