mirror of
https://github.com/immich-app/immich.git
synced 2026-02-04 08:49:01 +03:00
feat: make progressive system config optional (#25486)
This commit is contained in:
@@ -70,5 +70,33 @@ describe(SystemConfigController.name, () => {
|
||||
expect(body).toEqual(errorDto.badRequest(['nightlyTasks.databaseCleanup must be a boolean value']));
|
||||
});
|
||||
});
|
||||
|
||||
describe('image', () => {
|
||||
it('should accept config without optional progressive property', async () => {
|
||||
const config = _.cloneDeep(defaults);
|
||||
delete config.image.thumbnail.progressive;
|
||||
delete config.image.preview.progressive;
|
||||
delete config.image.fullsize.progressive;
|
||||
const { status } = await request(ctx.getHttpServer()).put('/system-config').send(config);
|
||||
expect(status).toBe(200);
|
||||
});
|
||||
|
||||
it('should accept config with progressive set to true', async () => {
|
||||
const config = _.cloneDeep(defaults);
|
||||
config.image.thumbnail.progressive = true;
|
||||
config.image.preview.progressive = true;
|
||||
config.image.fullsize.progressive = true;
|
||||
const { status } = await request(ctx.getHttpServer()).put('/system-config').send(config);
|
||||
expect(status).toBe(200);
|
||||
});
|
||||
|
||||
it('should reject invalid progressive value', async () => {
|
||||
const config = _.cloneDeep(defaults);
|
||||
(config.image.thumbnail.progressive as any) = 'invalid';
|
||||
const { status, body } = await request(ctx.getHttpServer()).put('/system-config').send(config);
|
||||
expect(status).toBe(400);
|
||||
expect(body).toEqual(errorDto.badRequest(['image.thumbnail.progressive must be a boolean value']));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -586,8 +586,8 @@ class SystemConfigGeneratedImageDto {
|
||||
@ApiProperty({ type: 'integer' })
|
||||
size!: number;
|
||||
|
||||
@ValidateBoolean()
|
||||
progressive!: boolean;
|
||||
@ValidateBoolean({ optional: true, default: false })
|
||||
progressive?: boolean;
|
||||
}
|
||||
|
||||
class SystemConfigGeneratedFullsizeImageDto {
|
||||
@@ -604,8 +604,8 @@ class SystemConfigGeneratedFullsizeImageDto {
|
||||
@ApiProperty({ type: 'integer' })
|
||||
quality!: number;
|
||||
|
||||
@ValidateBoolean()
|
||||
progressive!: boolean;
|
||||
@ValidateBoolean({ optional: true, default: false })
|
||||
progressive?: boolean;
|
||||
}
|
||||
|
||||
export class SystemConfigImageDto {
|
||||
|
||||
@@ -36,14 +36,14 @@ export type FullsizeImageOptions = {
|
||||
format: ImageFormat;
|
||||
quality: number;
|
||||
enabled: boolean;
|
||||
progressive: boolean;
|
||||
progressive?: boolean;
|
||||
};
|
||||
|
||||
export type ImageOptions = {
|
||||
format: ImageFormat;
|
||||
quality: number;
|
||||
size: number;
|
||||
progressive: boolean;
|
||||
progressive?: boolean;
|
||||
};
|
||||
|
||||
export type RawImageInfo = {
|
||||
|
||||
Reference in New Issue
Block a user