mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 17:23:20 +03:00
fix(server): stack info in asset response for mobile (#7346)
* fix(server): stack info in asset response for mobile * fix(server): getAllAssets - do not filter by stack ID * tet(server): GET /assets stack e2e * chore(server): fix checks * stack asset height --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import { AssetEntity, AssetStackEntity, AssetType, SharedLinkType } from '@app/i
|
||||
import { AssetRepository } from '@app/infra/repositories';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { errorStub, userDto, uuidStub } from '@test/fixtures';
|
||||
import { assetApi } from 'e2e/client/asset-api';
|
||||
import { randomBytes } from 'node:crypto';
|
||||
import request from 'supertest';
|
||||
import { api } from '../../client';
|
||||
@@ -532,6 +533,23 @@ describe(`${AssetController.name} (e2e)`, () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
it('should return stack data', async () => {
|
||||
const parentId = asset1.id;
|
||||
const childIds = [asset2.id, asset3.id];
|
||||
await request(server)
|
||||
.put('/asset')
|
||||
.set('Authorization', `Bearer ${user1.accessToken}`)
|
||||
.send({ stackParentId: parentId, ids: childIds });
|
||||
|
||||
const body = await assetApi.getAllAssets(server, user1.accessToken);
|
||||
// Response includes parent with stack children count
|
||||
const parentDto = body.find((a) => a.id == parentId);
|
||||
expect(parentDto?.stackCount).toEqual(3);
|
||||
|
||||
// Response includes children at the root level
|
||||
expect.arrayContaining([expect.objectContaining({ id: asset1.id }), expect.objectContaining({ id: asset2.id })]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('POST /asset/upload', () => {
|
||||
|
||||
Reference in New Issue
Block a user