You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-17 15:47:54 +02:00
feat(server): lighter buckets (#17831)
* feat(web): lighter timeline buckets * GalleryViewer * weird ssr * Remove generics from AssetInteraction * ensure keys on getAssetInfo, alt-text * empty - trigger ci * re-add alt-text * test fix * update tests * tests * missing import * feat(server): lighter buckets * fix: flappy e2e test * lint * revert settings * unneeded cast * fix after merge * Adapt web client to consume new server response format * test * missing import * lint * Use nulls, make-sql * openapi battle * date->string * tests * tests * lint/tests * lint * test * push aggregation to query * openapi * stack as tuple * openapi * update references to description * update alt text tests * update sql * update sql * update timeline tests * linting, fix expected response * string tuple * fix spec * fix * silly generator * rename patch * minimize sorting * review * lint * lint * sql * test * avoid abbreviations * review comment - type safety in test * merge conflicts * lint * lint/abbreviations * remove unncessary code * review comments * sql * re-add package-lock * use booleans, fix visibility in openapi spec, less cursed controller * update sql * no need to use sql template * array access actually doesn't seem to matter * remove redundant code * re-add sql decorator * unused type * remove null assertions * bad merge * Fix test * shave * extra clean shave * use decorator for content type * redundant types * redundant comment * update comment * unnecessary res --------- Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
241
mobile/openapi/lib/model/time_bucket_asset_response_dto.dart
generated
Normal file
241
mobile/openapi/lib/model/time_bucket_asset_response_dto.dart
generated
Normal file
@ -0,0 +1,241 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class TimeBucketAssetResponseDto {
|
||||
/// Returns a new [TimeBucketAssetResponseDto] instance.
|
||||
TimeBucketAssetResponseDto({
|
||||
this.city = const [],
|
||||
this.country = const [],
|
||||
this.duration = const [],
|
||||
this.id = const [],
|
||||
this.isFavorite = const [],
|
||||
this.isImage = const [],
|
||||
this.isTrashed = const [],
|
||||
this.livePhotoVideoId = const [],
|
||||
this.localDateTime = const [],
|
||||
this.ownerId = const [],
|
||||
this.projectionType = const [],
|
||||
this.ratio = const [],
|
||||
this.stack = const [],
|
||||
this.thumbhash = const [],
|
||||
this.visibility = const [],
|
||||
});
|
||||
|
||||
List<String?> city;
|
||||
|
||||
List<String?> country;
|
||||
|
||||
List<String?> duration;
|
||||
|
||||
List<String> id;
|
||||
|
||||
List<bool> isFavorite;
|
||||
|
||||
List<bool> isImage;
|
||||
|
||||
List<bool> isTrashed;
|
||||
|
||||
List<String?> livePhotoVideoId;
|
||||
|
||||
List<String> localDateTime;
|
||||
|
||||
List<String> ownerId;
|
||||
|
||||
List<String?> projectionType;
|
||||
|
||||
List<num> ratio;
|
||||
|
||||
/// (stack ID, stack asset count) tuple
|
||||
List<List<String>?> stack;
|
||||
|
||||
List<String?> thumbhash;
|
||||
|
||||
List<AssetVisibility> visibility;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is TimeBucketAssetResponseDto &&
|
||||
_deepEquality.equals(other.city, city) &&
|
||||
_deepEquality.equals(other.country, country) &&
|
||||
_deepEquality.equals(other.duration, duration) &&
|
||||
_deepEquality.equals(other.id, id) &&
|
||||
_deepEquality.equals(other.isFavorite, isFavorite) &&
|
||||
_deepEquality.equals(other.isImage, isImage) &&
|
||||
_deepEquality.equals(other.isTrashed, isTrashed) &&
|
||||
_deepEquality.equals(other.livePhotoVideoId, livePhotoVideoId) &&
|
||||
_deepEquality.equals(other.localDateTime, localDateTime) &&
|
||||
_deepEquality.equals(other.ownerId, ownerId) &&
|
||||
_deepEquality.equals(other.projectionType, projectionType) &&
|
||||
_deepEquality.equals(other.ratio, ratio) &&
|
||||
_deepEquality.equals(other.stack, stack) &&
|
||||
_deepEquality.equals(other.thumbhash, thumbhash) &&
|
||||
_deepEquality.equals(other.visibility, visibility);
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(city.hashCode) +
|
||||
(country.hashCode) +
|
||||
(duration.hashCode) +
|
||||
(id.hashCode) +
|
||||
(isFavorite.hashCode) +
|
||||
(isImage.hashCode) +
|
||||
(isTrashed.hashCode) +
|
||||
(livePhotoVideoId.hashCode) +
|
||||
(localDateTime.hashCode) +
|
||||
(ownerId.hashCode) +
|
||||
(projectionType.hashCode) +
|
||||
(ratio.hashCode) +
|
||||
(stack.hashCode) +
|
||||
(thumbhash.hashCode) +
|
||||
(visibility.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'TimeBucketAssetResponseDto[city=$city, country=$country, duration=$duration, id=$id, isFavorite=$isFavorite, isImage=$isImage, isTrashed=$isTrashed, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, ownerId=$ownerId, projectionType=$projectionType, ratio=$ratio, stack=$stack, thumbhash=$thumbhash, visibility=$visibility]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'city'] = this.city;
|
||||
json[r'country'] = this.country;
|
||||
json[r'duration'] = this.duration;
|
||||
json[r'id'] = this.id;
|
||||
json[r'isFavorite'] = this.isFavorite;
|
||||
json[r'isImage'] = this.isImage;
|
||||
json[r'isTrashed'] = this.isTrashed;
|
||||
json[r'livePhotoVideoId'] = this.livePhotoVideoId;
|
||||
json[r'localDateTime'] = this.localDateTime;
|
||||
json[r'ownerId'] = this.ownerId;
|
||||
json[r'projectionType'] = this.projectionType;
|
||||
json[r'ratio'] = this.ratio;
|
||||
json[r'stack'] = this.stack;
|
||||
json[r'thumbhash'] = this.thumbhash;
|
||||
json[r'visibility'] = this.visibility;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [TimeBucketAssetResponseDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static TimeBucketAssetResponseDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "TimeBucketAssetResponseDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return TimeBucketAssetResponseDto(
|
||||
city: json[r'city'] is Iterable
|
||||
? (json[r'city'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
country: json[r'country'] is Iterable
|
||||
? (json[r'country'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
duration: json[r'duration'] is Iterable
|
||||
? (json[r'duration'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
id: json[r'id'] is Iterable
|
||||
? (json[r'id'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
isFavorite: json[r'isFavorite'] is Iterable
|
||||
? (json[r'isFavorite'] as Iterable).cast<bool>().toList(growable: false)
|
||||
: const [],
|
||||
isImage: json[r'isImage'] is Iterable
|
||||
? (json[r'isImage'] as Iterable).cast<bool>().toList(growable: false)
|
||||
: const [],
|
||||
isTrashed: json[r'isTrashed'] is Iterable
|
||||
? (json[r'isTrashed'] as Iterable).cast<bool>().toList(growable: false)
|
||||
: const [],
|
||||
livePhotoVideoId: json[r'livePhotoVideoId'] is Iterable
|
||||
? (json[r'livePhotoVideoId'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
localDateTime: json[r'localDateTime'] is Iterable
|
||||
? (json[r'localDateTime'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
ownerId: json[r'ownerId'] is Iterable
|
||||
? (json[r'ownerId'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
projectionType: json[r'projectionType'] is Iterable
|
||||
? (json[r'projectionType'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
ratio: json[r'ratio'] is Iterable
|
||||
? (json[r'ratio'] as Iterable).cast<num>().toList(growable: false)
|
||||
: const [],
|
||||
stack: json[r'stack'] is List
|
||||
? (json[r'stack'] as List).map((e) =>
|
||||
e == null ? null : (e as List).cast<String>()
|
||||
).toList()
|
||||
: const [],
|
||||
thumbhash: json[r'thumbhash'] is Iterable
|
||||
? (json[r'thumbhash'] as Iterable).cast<String>().toList(growable: false)
|
||||
: const [],
|
||||
visibility: AssetVisibility.listFromJson(json[r'visibility']),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<TimeBucketAssetResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <TimeBucketAssetResponseDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = TimeBucketAssetResponseDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, TimeBucketAssetResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, TimeBucketAssetResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = TimeBucketAssetResponseDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of TimeBucketAssetResponseDto-objects as value to a dart map
|
||||
static Map<String, List<TimeBucketAssetResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<TimeBucketAssetResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = TimeBucketAssetResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'city',
|
||||
'country',
|
||||
'duration',
|
||||
'id',
|
||||
'isFavorite',
|
||||
'isImage',
|
||||
'isTrashed',
|
||||
'livePhotoVideoId',
|
||||
'localDateTime',
|
||||
'ownerId',
|
||||
'projectionType',
|
||||
'ratio',
|
||||
'thumbhash',
|
||||
'visibility',
|
||||
};
|
||||
}
|
||||
|
85
mobile/openapi/lib/model/time_bucket_size.dart
generated
85
mobile/openapi/lib/model/time_bucket_size.dart
generated
@ -1,85 +0,0 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
|
||||
class TimeBucketSize {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const TimeBucketSize._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const DAY = TimeBucketSize._(r'DAY');
|
||||
static const MONTH = TimeBucketSize._(r'MONTH');
|
||||
|
||||
/// List of all possible values in this [enum][TimeBucketSize].
|
||||
static const values = <TimeBucketSize>[
|
||||
DAY,
|
||||
MONTH,
|
||||
];
|
||||
|
||||
static TimeBucketSize? fromJson(dynamic value) => TimeBucketSizeTypeTransformer().decode(value);
|
||||
|
||||
static List<TimeBucketSize> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <TimeBucketSize>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = TimeBucketSize.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [TimeBucketSize] to String,
|
||||
/// and [decode] dynamic data back to [TimeBucketSize].
|
||||
class TimeBucketSizeTypeTransformer {
|
||||
factory TimeBucketSizeTypeTransformer() => _instance ??= const TimeBucketSizeTypeTransformer._();
|
||||
|
||||
const TimeBucketSizeTypeTransformer._();
|
||||
|
||||
String encode(TimeBucketSize data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a TimeBucketSize.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
TimeBucketSize? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'DAY': return TimeBucketSize.DAY;
|
||||
case r'MONTH': return TimeBucketSize.MONTH;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [TimeBucketSizeTypeTransformer] instance.
|
||||
static TimeBucketSizeTypeTransformer? _instance;
|
||||
}
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class TimeBucketResponseDto {
|
||||
/// Returns a new [TimeBucketResponseDto] instance.
|
||||
TimeBucketResponseDto({
|
||||
class TimeBucketsResponseDto {
|
||||
/// Returns a new [TimeBucketsResponseDto] instance.
|
||||
TimeBucketsResponseDto({
|
||||
required this.count,
|
||||
required this.timeBucket,
|
||||
});
|
||||
@ -22,7 +22,7 @@ class TimeBucketResponseDto {
|
||||
String timeBucket;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is TimeBucketResponseDto &&
|
||||
bool operator ==(Object other) => identical(this, other) || other is TimeBucketsResponseDto &&
|
||||
other.count == count &&
|
||||
other.timeBucket == timeBucket;
|
||||
|
||||
@ -33,7 +33,7 @@ class TimeBucketResponseDto {
|
||||
(timeBucket.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'TimeBucketResponseDto[count=$count, timeBucket=$timeBucket]';
|
||||
String toString() => 'TimeBucketsResponseDto[count=$count, timeBucket=$timeBucket]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -42,15 +42,15 @@ class TimeBucketResponseDto {
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [TimeBucketResponseDto] instance and imports its values from
|
||||
/// Returns a new [TimeBucketsResponseDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static TimeBucketResponseDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "TimeBucketResponseDto");
|
||||
static TimeBucketsResponseDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "TimeBucketsResponseDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return TimeBucketResponseDto(
|
||||
return TimeBucketsResponseDto(
|
||||
count: mapValueOfType<int>(json, r'count')!,
|
||||
timeBucket: mapValueOfType<String>(json, r'timeBucket')!,
|
||||
);
|
||||
@ -58,11 +58,11 @@ class TimeBucketResponseDto {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<TimeBucketResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <TimeBucketResponseDto>[];
|
||||
static List<TimeBucketsResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <TimeBucketsResponseDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = TimeBucketResponseDto.fromJson(row);
|
||||
final value = TimeBucketsResponseDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
@ -71,12 +71,12 @@ class TimeBucketResponseDto {
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, TimeBucketResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, TimeBucketResponseDto>{};
|
||||
static Map<String, TimeBucketsResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, TimeBucketsResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = TimeBucketResponseDto.fromJson(entry.value);
|
||||
final value = TimeBucketsResponseDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
@ -85,14 +85,14 @@ class TimeBucketResponseDto {
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of TimeBucketResponseDto-objects as value to a dart map
|
||||
static Map<String, List<TimeBucketResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<TimeBucketResponseDto>>{};
|
||||
// maps a json object with a list of TimeBucketsResponseDto-objects as value to a dart map
|
||||
static Map<String, List<TimeBucketsResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<TimeBucketsResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = TimeBucketResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = TimeBucketsResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
Reference in New Issue
Block a user