1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02:00

feat(server, web): quotas (#4471)

* feat: quotas

* chore: open api

* chore: update status box and upload error message

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
cfitzw
2024-01-12 18:43:36 -06:00
committed by GitHub
parent f4edb6c4bd
commit deb1f970a8
63 changed files with 646 additions and 118 deletions

View File

@@ -13,6 +13,7 @@ Name | Type | Description | Notes
**memoriesEnabled** | **bool** | | [optional]
**name** | **String** | |
**password** | **String** | |
**quotaSizeInBytes** | **int** | | [optional]
**storageLabel** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -20,6 +20,8 @@ Name | Type | Description | Notes
**name** | **String** | |
**oauthId** | **String** | |
**profileImagePath** | **String** | |
**quotaSizeInBytes** | **int** | |
**quotaUsageInBytes** | **int** | |
**shouldChangePassword** | **bool** | |
**storageLabel** | **String** | |
**updatedAt** | [**DateTime**](DateTime.md) | |

View File

@@ -16,6 +16,7 @@ Name | Type | Description | Notes
**memoriesEnabled** | **bool** | | [optional]
**name** | **String** | | [optional]
**password** | **String** | | [optional]
**quotaSizeInBytes** | **int** | | [optional]
**shouldChangePassword** | **bool** | | [optional]
**storageLabel** | **String** | | [optional]

View File

@@ -9,6 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**photos** | **int** | |
**quotaSizeInBytes** | **int** | |
**usage** | **int** | |
**userId** | **String** | |
**userName** | **String** | |

View File

@@ -19,6 +19,8 @@ Name | Type | Description | Notes
**name** | **String** | |
**oauthId** | **String** | |
**profileImagePath** | **String** | |
**quotaSizeInBytes** | **int** | |
**quotaUsageInBytes** | **int** | |
**shouldChangePassword** | **bool** | |
**storageLabel** | **String** | |
**updatedAt** | [**DateTime**](DateTime.md) | |

View File

@@ -18,6 +18,7 @@ class CreateUserDto {
this.memoriesEnabled,
required this.name,
required this.password,
this.quotaSizeInBytes,
this.storageLabel,
});
@@ -37,6 +38,8 @@ class CreateUserDto {
String password;
int? quotaSizeInBytes;
String? storageLabel;
@override
@@ -46,6 +49,7 @@ class CreateUserDto {
other.memoriesEnabled == memoriesEnabled &&
other.name == name &&
other.password == password &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.storageLabel == storageLabel;
@override
@@ -56,10 +60,11 @@ class CreateUserDto {
(memoriesEnabled == null ? 0 : memoriesEnabled!.hashCode) +
(name.hashCode) +
(password.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(storageLabel == null ? 0 : storageLabel!.hashCode);
@override
String toString() => 'CreateUserDto[email=$email, externalPath=$externalPath, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, storageLabel=$storageLabel]';
String toString() => 'CreateUserDto[email=$email, externalPath=$externalPath, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, quotaSizeInBytes=$quotaSizeInBytes, storageLabel=$storageLabel]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -76,6 +81,11 @@ class CreateUserDto {
}
json[r'name'] = this.name;
json[r'password'] = this.password;
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
if (this.storageLabel != null) {
json[r'storageLabel'] = this.storageLabel;
} else {
@@ -97,6 +107,7 @@ class CreateUserDto {
memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
name: mapValueOfType<String>(json, r'name')!,
password: mapValueOfType<String>(json, r'password')!,
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
);
}

View File

@@ -25,6 +25,8 @@ class PartnerResponseDto {
required this.name,
required this.oauthId,
required this.profileImagePath,
required this.quotaSizeInBytes,
required this.quotaUsageInBytes,
required this.shouldChangePassword,
required this.storageLabel,
required this.updatedAt,
@@ -66,6 +68,10 @@ class PartnerResponseDto {
String profileImagePath;
int? quotaSizeInBytes;
int quotaUsageInBytes;
bool shouldChangePassword;
String? storageLabel;
@@ -86,6 +92,8 @@ class PartnerResponseDto {
other.name == name &&
other.oauthId == oauthId &&
other.profileImagePath == profileImagePath &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.quotaUsageInBytes == quotaUsageInBytes &&
other.shouldChangePassword == shouldChangePassword &&
other.storageLabel == storageLabel &&
other.updatedAt == updatedAt;
@@ -105,12 +113,14 @@ class PartnerResponseDto {
(name.hashCode) +
(oauthId.hashCode) +
(profileImagePath.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(quotaUsageInBytes.hashCode) +
(shouldChangePassword.hashCode) +
(storageLabel == null ? 0 : storageLabel!.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'PartnerResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, externalPath=$externalPath, id=$id, inTimeline=$inTimeline, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel, updatedAt=$updatedAt]';
String toString() => 'PartnerResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, externalPath=$externalPath, id=$id, inTimeline=$inTimeline, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -142,6 +152,12 @@ class PartnerResponseDto {
json[r'name'] = this.name;
json[r'oauthId'] = this.oauthId;
json[r'profileImagePath'] = this.profileImagePath;
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
json[r'quotaUsageInBytes'] = this.quotaUsageInBytes;
json[r'shouldChangePassword'] = this.shouldChangePassword;
if (this.storageLabel != null) {
json[r'storageLabel'] = this.storageLabel;
@@ -172,6 +188,8 @@ class PartnerResponseDto {
name: mapValueOfType<String>(json, r'name')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!,
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
quotaUsageInBytes: mapValueOfType<int>(json, r'quotaUsageInBytes')!,
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
updatedAt: mapDateTime(json, r'updatedAt', '')!,
@@ -232,6 +250,8 @@ class PartnerResponseDto {
'name',
'oauthId',
'profileImagePath',
'quotaSizeInBytes',
'quotaUsageInBytes',
'shouldChangePassword',
'storageLabel',
'updatedAt',

View File

@@ -21,6 +21,7 @@ class UpdateUserDto {
this.memoriesEnabled,
this.name,
this.password,
this.quotaSizeInBytes,
this.shouldChangePassword,
this.storageLabel,
});
@@ -83,6 +84,8 @@ class UpdateUserDto {
///
String? password;
int? quotaSizeInBytes;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
@@ -109,6 +112,7 @@ class UpdateUserDto {
other.memoriesEnabled == memoriesEnabled &&
other.name == name &&
other.password == password &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.shouldChangePassword == shouldChangePassword &&
other.storageLabel == storageLabel;
@@ -123,11 +127,12 @@ class UpdateUserDto {
(memoriesEnabled == null ? 0 : memoriesEnabled!.hashCode) +
(name == null ? 0 : name!.hashCode) +
(password == null ? 0 : password!.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(shouldChangePassword == null ? 0 : shouldChangePassword!.hashCode) +
(storageLabel == null ? 0 : storageLabel!.hashCode);
@override
String toString() => 'UpdateUserDto[avatarColor=$avatarColor, email=$email, externalPath=$externalPath, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel]';
String toString() => 'UpdateUserDto[avatarColor=$avatarColor, email=$email, externalPath=$externalPath, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, quotaSizeInBytes=$quotaSizeInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -167,6 +172,11 @@ class UpdateUserDto {
} else {
// json[r'password'] = null;
}
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
if (this.shouldChangePassword != null) {
json[r'shouldChangePassword'] = this.shouldChangePassword;
} else {
@@ -196,6 +206,7 @@ class UpdateUserDto {
memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
name: mapValueOfType<String>(json, r'name'),
password: mapValueOfType<String>(json, r'password'),
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword'),
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
);

View File

@@ -14,6 +14,7 @@ class UsageByUserDto {
/// Returns a new [UsageByUserDto] instance.
UsageByUserDto({
required this.photos,
required this.quotaSizeInBytes,
required this.usage,
required this.userId,
required this.userName,
@@ -22,6 +23,8 @@ class UsageByUserDto {
int photos;
int? quotaSizeInBytes;
int usage;
String userId;
@@ -33,6 +36,7 @@ class UsageByUserDto {
@override
bool operator ==(Object other) => identical(this, other) || other is UsageByUserDto &&
other.photos == photos &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.usage == usage &&
other.userId == userId &&
other.userName == userName &&
@@ -42,17 +46,23 @@ class UsageByUserDto {
int get hashCode =>
// ignore: unnecessary_parenthesis
(photos.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(usage.hashCode) +
(userId.hashCode) +
(userName.hashCode) +
(videos.hashCode);
@override
String toString() => 'UsageByUserDto[photos=$photos, usage=$usage, userId=$userId, userName=$userName, videos=$videos]';
String toString() => 'UsageByUserDto[photos=$photos, quotaSizeInBytes=$quotaSizeInBytes, usage=$usage, userId=$userId, userName=$userName, videos=$videos]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'photos'] = this.photos;
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
json[r'usage'] = this.usage;
json[r'userId'] = this.userId;
json[r'userName'] = this.userName;
@@ -69,6 +79,7 @@ class UsageByUserDto {
return UsageByUserDto(
photos: mapValueOfType<int>(json, r'photos')!,
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
usage: mapValueOfType<int>(json, r'usage')!,
userId: mapValueOfType<String>(json, r'userId')!,
userName: mapValueOfType<String>(json, r'userName')!,
@@ -121,6 +132,7 @@ class UsageByUserDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'photos',
'quotaSizeInBytes',
'usage',
'userId',
'userName',

View File

@@ -24,6 +24,8 @@ class UserResponseDto {
required this.name,
required this.oauthId,
required this.profileImagePath,
required this.quotaSizeInBytes,
required this.quotaUsageInBytes,
required this.shouldChangePassword,
required this.storageLabel,
required this.updatedAt,
@@ -57,6 +59,10 @@ class UserResponseDto {
String profileImagePath;
int? quotaSizeInBytes;
int quotaUsageInBytes;
bool shouldChangePassword;
String? storageLabel;
@@ -76,6 +82,8 @@ class UserResponseDto {
other.name == name &&
other.oauthId == oauthId &&
other.profileImagePath == profileImagePath &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.quotaUsageInBytes == quotaUsageInBytes &&
other.shouldChangePassword == shouldChangePassword &&
other.storageLabel == storageLabel &&
other.updatedAt == updatedAt;
@@ -94,12 +102,14 @@ class UserResponseDto {
(name.hashCode) +
(oauthId.hashCode) +
(profileImagePath.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(quotaUsageInBytes.hashCode) +
(shouldChangePassword.hashCode) +
(storageLabel == null ? 0 : storageLabel!.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'UserResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, externalPath=$externalPath, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel, updatedAt=$updatedAt]';
String toString() => 'UserResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, externalPath=$externalPath, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -126,6 +136,12 @@ class UserResponseDto {
json[r'name'] = this.name;
json[r'oauthId'] = this.oauthId;
json[r'profileImagePath'] = this.profileImagePath;
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
json[r'quotaUsageInBytes'] = this.quotaUsageInBytes;
json[r'shouldChangePassword'] = this.shouldChangePassword;
if (this.storageLabel != null) {
json[r'storageLabel'] = this.storageLabel;
@@ -155,6 +171,8 @@ class UserResponseDto {
name: mapValueOfType<String>(json, r'name')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!,
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
quotaUsageInBytes: mapValueOfType<int>(json, r'quotaUsageInBytes')!,
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
updatedAt: mapDateTime(json, r'updatedAt', '')!,
@@ -215,6 +233,8 @@ class UserResponseDto {
'name',
'oauthId',
'profileImagePath',
'quotaSizeInBytes',
'quotaUsageInBytes',
'shouldChangePassword',
'storageLabel',
'updatedAt',

View File

@@ -41,6 +41,11 @@ void main() {
// TODO
});
// int quotaSizeInBytes
test('to test the property `quotaSizeInBytes`', () async {
// TODO
});
// String storageLabel
test('to test the property `storageLabel`', () async {
// TODO

View File

@@ -76,6 +76,16 @@ void main() {
// TODO
});
// int quotaSizeInBytes
test('to test the property `quotaSizeInBytes`', () async {
// TODO
});
// int quotaUsageInBytes
test('to test the property `quotaUsageInBytes`', () async {
// TODO
});
// bool shouldChangePassword
test('to test the property `shouldChangePassword`', () async {
// TODO

View File

@@ -56,6 +56,11 @@ void main() {
// TODO
});
// int quotaSizeInBytes
test('to test the property `quotaSizeInBytes`', () async {
// TODO
});
// bool shouldChangePassword
test('to test the property `shouldChangePassword`', () async {
// TODO

View File

@@ -21,6 +21,11 @@ void main() {
// TODO
});
// int quotaSizeInBytes
test('to test the property `quotaSizeInBytes`', () async {
// TODO
});
// int usage
test('to test the property `usage`', () async {
// TODO

View File

@@ -71,6 +71,16 @@ void main() {
// TODO
});
// int quotaSizeInBytes
test('to test the property `quotaSizeInBytes`', () async {
// TODO
});
// int quotaUsageInBytes
test('to test the property `quotaUsageInBytes`', () async {
// TODO
});
// bool shouldChangePassword
test('to test the property `shouldChangePassword`', () async {
// TODO