mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore!: remove getRandom api endpoint (#27780)
* chore!: remove getRandom api endpoint * chore: sync openapi * fix: test * chore: more cleanup
This commit is contained in:
@@ -245,19 +245,6 @@ describe(AssetController.name, () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /assets/random', () => {
|
||||
it('should be an authenticated route', async () => {
|
||||
await request(ctx.getHttpServer()).get(`/assets/random`);
|
||||
expect(ctx.authenticate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not allow count to be a string', async () => {
|
||||
const { status, body } = await request(ctx.getHttpServer()).get('/assets/random?count=ABC');
|
||||
expect(status).toBe(400);
|
||||
expect(body).toEqual(factory.responses.badRequest(['[count] Invalid input: expected number, received NaN']));
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /assets/:id/metadata', () => {
|
||||
it('should be an authenticated route', async () => {
|
||||
await request(ctx.getHttpServer()).get(`/assets/${factory.uuid()}/metadata`);
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
AssetStatsDto,
|
||||
AssetStatsResponseDto,
|
||||
DeviceIdDto,
|
||||
RandomAssetsDto,
|
||||
UpdateAssetDto,
|
||||
} from 'src/dtos/asset.dto';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
@@ -32,17 +31,6 @@ import { UUIDParamDto } from 'src/validation';
|
||||
export class AssetController {
|
||||
constructor(private service: AssetService) {}
|
||||
|
||||
@Get('random')
|
||||
@Authenticated({ permission: Permission.AssetRead })
|
||||
@Endpoint({
|
||||
summary: 'Get random assets',
|
||||
description: 'Retrieve a specified number of random assets for the authenticated user.',
|
||||
history: new HistoryBuilder().added('v1').deprecated('v1', { replacementId: 'searchAssets' }),
|
||||
})
|
||||
getRandom(@Auth() auth: AuthDto, @Query() dto: RandomAssetsDto): Promise<AssetResponseDto[]> {
|
||||
return this.service.getRandom(auth, dto.count ?? 1);
|
||||
}
|
||||
|
||||
@Get('/device/:deviceId')
|
||||
@Endpoint({
|
||||
summary: 'Retrieve assets by device ID',
|
||||
|
||||
Reference in New Issue
Block a user