mirror of
https://github.com/immich-app/immich.git
synced 2026-06-17 21:04:51 +08:00
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker / Build and Push (., cpu, server/Dockerfile, immich-server, linux/amd64,linux/arm64) (push) Waiting to run
Docker / Build and Push (machine-learning, armnn, machine-learning/Dockerfile, immich-machine-learning, linux/arm64, -armnn) (push) Waiting to run
Docker / Build and Push (machine-learning, cpu, machine-learning/Dockerfile, immich-machine-learning, linux/amd64,linux/arm64) (push) Waiting to run
Docker / Build and Push (machine-learning, cuda, machine-learning/Dockerfile, immich-machine-learning, linux/amd64, -cuda) (push) Waiting to run
Docker / Build and Push (machine-learning, openvino, machine-learning/Dockerfile, immich-machine-learning, linux/amd64, -openvino) (push) Waiting to run
Docs build / build (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Waiting to run
Test / Server (push) Waiting to run
Test / CLI (push) Waiting to run
Test / CLI (Windows) (push) Waiting to run
Test / Web (push) Waiting to run
Test / End-to-End Tests (push) Waiting to run
Test / Mobile (push) Waiting to run
Test / Machine Learning (push) Waiting to run
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / TypeORM Checks (push) Waiting to run
* feat: metadata in UserPreference * feat: web metadata settings * feat: web metadata settings * fix: typo * patch openapi * fix: missing translation key * new organization of preference strucutre * feature settings on web * localization * added and used feature settings * add default value to response dto * patch openapi * format en.json file * implement helper method * use tags preference logic * Fix logic bug and add tests * fix preference can be null in detail panel
34 lines
1.0 KiB
Dart
34 lines
1.0 KiB
Dart
import 'package:openapi/api.dart';
|
|
|
|
dynamic upgradeDto(dynamic value, String targetType) {
|
|
switch (targetType) {
|
|
case 'UserPreferencesResponseDto':
|
|
if (value is Map) {
|
|
addDefault(value, 'download.includeEmbeddedVideos', false);
|
|
addDefault(value, 'folders', FoldersResponse().toJson());
|
|
addDefault(value, 'memories', MemoriesResponse().toJson());
|
|
addDefault(value, 'ratings', RatingsResponse().toJson());
|
|
addDefault(value, 'people', PeopleResponse().toJson());
|
|
addDefault(value, 'tags', TagsResponse().toJson());
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
addDefault(dynamic value, String keys, dynamic defaultValue) {
|
|
// Loop through the keys and assign the default value if the key is not present
|
|
List<String> keyList = keys.split('.');
|
|
dynamic current = value;
|
|
|
|
for (int i = 0; i < keyList.length - 1; i++) {
|
|
if (current[keyList[i]] == null) {
|
|
current[keyList[i]] = {};
|
|
}
|
|
current = current[keyList[i]];
|
|
}
|
|
|
|
if (current[keyList.last] == null) {
|
|
current[keyList.last] = defaultValue;
|
|
}
|
|
}
|