mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 09:15:34 +03:00
feat: allow accounts with a quota of 0 GiB (#17413)
* Allow 0GiB quotas in user create/edit form, remove unused translations * Make requireQuota check for null or 0 * Add unlimited quota change to the docs * Fix user dto formatting * Fix formating edit-user-form * Regenerate open-api files * Revert unnecessary i18n file changes * Re-add newline en.json * Resolve linting issues * Fix formatting edit-user-form * Re-add manifest
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsBoolean, IsEmail, IsNotEmpty, IsNumber, IsPositive, IsString } from 'class-validator';
|
||||
import { IsBoolean, IsEmail, IsNotEmpty, IsNumber, IsString, Min } from 'class-validator';
|
||||
import { User, UserAdmin } from 'src/database';
|
||||
import { UserMetadataEntity, UserMetadataItem } from 'src/entities/user-metadata.entity';
|
||||
import { UserEntity } from 'src/entities/user.entity';
|
||||
@@ -77,7 +77,7 @@ export class UserAdminCreateDto {
|
||||
|
||||
@Optional({ nullable: true })
|
||||
@IsNumber()
|
||||
@IsPositive()
|
||||
@Min(0)
|
||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||
quotaSizeInBytes?: number | null;
|
||||
|
||||
@@ -115,7 +115,7 @@ export class UserAdminUpdateDto {
|
||||
|
||||
@Optional({ nullable: true })
|
||||
@IsNumber()
|
||||
@IsPositive()
|
||||
@Min(0)
|
||||
@ApiProperty({ type: 'integer', format: 'int64' })
|
||||
quotaSizeInBytes?: number | null;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ export class AssetMediaService extends BaseService {
|
||||
}
|
||||
|
||||
private requireQuota(auth: AuthDto, size: number) {
|
||||
if (auth.user.quotaSizeInBytes && auth.user.quotaSizeInBytes < auth.user.quotaUsageInBytes + size) {
|
||||
if (auth.user.quotaSizeInBytes !== null && auth.user.quotaSizeInBytes < auth.user.quotaUsageInBytes + size) {
|
||||
throw new BadRequestException('Quota has been exceeded!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user