string tuple

This commit is contained in:
mertalev 2025-05-05 10:33:48 -04:00
parent 21bbf2f5e2
commit 71cc045405
No known key found for this signature in database
GPG Key ID: DF6ABC77AAD98C95
12 changed files with 21 additions and 127 deletions

View File

@ -478,7 +478,6 @@ Class | Method | HTTP request | Description
- [TemplateResponseDto](doc//TemplateResponseDto.md) - [TemplateResponseDto](doc//TemplateResponseDto.md)
- [TestEmailResponseDto](doc//TestEmailResponseDto.md) - [TestEmailResponseDto](doc//TestEmailResponseDto.md)
- [TimeBucketAssetResponseDto](doc//TimeBucketAssetResponseDto.md) - [TimeBucketAssetResponseDto](doc//TimeBucketAssetResponseDto.md)
- [TimeBucketAssetResponseDtoStackInnerInner](doc//TimeBucketAssetResponseDtoStackInnerInner.md)
- [TimeBucketsResponseDto](doc//TimeBucketsResponseDto.md) - [TimeBucketsResponseDto](doc//TimeBucketsResponseDto.md)
- [ToneMapping](doc//ToneMapping.md) - [ToneMapping](doc//ToneMapping.md)
- [TranscodeHWAccel](doc//TranscodeHWAccel.md) - [TranscodeHWAccel](doc//TranscodeHWAccel.md)

View File

@ -282,7 +282,6 @@ part 'model/template_dto.dart';
part 'model/template_response_dto.dart'; part 'model/template_response_dto.dart';
part 'model/test_email_response_dto.dart'; part 'model/test_email_response_dto.dart';
part 'model/time_bucket_asset_response_dto.dart'; part 'model/time_bucket_asset_response_dto.dart';
part 'model/time_bucket_asset_response_dto_stack_inner_inner.dart';
part 'model/time_buckets_response_dto.dart'; part 'model/time_buckets_response_dto.dart';
part 'model/tone_mapping.dart'; part 'model/tone_mapping.dart';
part 'model/transcode_hw_accel.dart'; part 'model/transcode_hw_accel.dart';

View File

@ -620,8 +620,6 @@ class ApiClient {
return TestEmailResponseDto.fromJson(value); return TestEmailResponseDto.fromJson(value);
case 'TimeBucketAssetResponseDto': case 'TimeBucketAssetResponseDto':
return TimeBucketAssetResponseDto.fromJson(value); return TimeBucketAssetResponseDto.fromJson(value);
case 'TimeBucketAssetResponseDtoStackInnerInner':
return TimeBucketAssetResponseDtoStackInnerInner.fromJson(value);
case 'TimeBucketsResponseDto': case 'TimeBucketsResponseDto':
return TimeBucketsResponseDto.fromJson(value); return TimeBucketsResponseDto.fromJson(value);
case 'ToneMapping': case 'ToneMapping':

View File

@ -56,8 +56,8 @@ class TimeBucketAssetResponseDto {
List<num> ratio; List<num> ratio;
/// The stack ID and stack asset count as a tuple /// (stack ID, stack asset count) tuple
List<List<TimeBucketAssetResponseDtoStackInnerInner>> stack; List<String> stack;
List<String> thumbhash; List<String> thumbhash;
@ -169,10 +169,8 @@ class TimeBucketAssetResponseDto {
ratio: json[r'ratio'] is Iterable ratio: json[r'ratio'] is Iterable
? (json[r'ratio'] as Iterable).cast<num>().toList(growable: false) ? (json[r'ratio'] as Iterable).cast<num>().toList(growable: false)
: const [], : const [],
stack: json[r'stack'] is List stack: json[r'stack'] is Iterable
? (json[r'stack'] as List).map((e) => ? (json[r'stack'] as Iterable).cast<String>().toList(growable: false)
TimeBucketAssetResponseDtoStackInnerInner.listFromJson(json[r'stack'])
).toList()
: const [], : const [],
thumbhash: json[r'thumbhash'] is Iterable thumbhash: json[r'thumbhash'] is Iterable
? (json[r'thumbhash'] as Iterable).cast<String>().toList(growable: false) ? (json[r'thumbhash'] as Iterable).cast<String>().toList(growable: false)

View File

@ -1,91 +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 TimeBucketAssetResponseDtoStackInnerInner {
/// Returns a new [TimeBucketAssetResponseDtoStackInnerInner] instance.
TimeBucketAssetResponseDtoStackInnerInner({
});
@override
bool operator ==(Object other) => identical(this, other) || other is TimeBucketAssetResponseDtoStackInnerInner &&
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
@override
String toString() => 'TimeBucketAssetResponseDtoStackInnerInner[]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
return json;
}
/// Returns a new [TimeBucketAssetResponseDtoStackInnerInner] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static TimeBucketAssetResponseDtoStackInnerInner? fromJson(dynamic value) {
upgradeDto(value, "TimeBucketAssetResponseDtoStackInnerInner");
if (value is Map) {
final json = value.cast<String, dynamic>();
return TimeBucketAssetResponseDtoStackInnerInner(
);
}
return null;
}
static List<TimeBucketAssetResponseDtoStackInnerInner> listFromJson(dynamic json, {bool growable = false,}) {
final result = <TimeBucketAssetResponseDtoStackInnerInner>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = TimeBucketAssetResponseDtoStackInnerInner.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, TimeBucketAssetResponseDtoStackInnerInner> mapFromJson(dynamic json) {
final map = <String, TimeBucketAssetResponseDtoStackInnerInner>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = TimeBucketAssetResponseDtoStackInnerInner.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of TimeBucketAssetResponseDtoStackInnerInner-objects as value to a dart map
static Map<String, List<TimeBucketAssetResponseDtoStackInnerInner>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<TimeBucketAssetResponseDtoStackInnerInner>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = TimeBucketAssetResponseDtoStackInnerInner.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
};
}

View File

@ -13646,23 +13646,13 @@
"type": "array" "type": "array"
}, },
"stack": { "stack": {
"description": "The stack ID and stack asset count as a tuple", "description": "(stack ID, stack asset count) tuple",
"items": { "items": {
"items": { "nullable": true,
"maxItems": 2,
"minItems": 2,
"oneOf": [
{
"type": "string" "type": "string"
}, },
{ "maxItems": 2,
"type": "number" "minItems": 2,
}
]
},
"nullable": true,
"type": "array"
},
"type": "array" "type": "array"
}, },
"thumbhash": { "thumbhash": {

View File

@ -1398,8 +1398,8 @@ export type TimeBucketAssetResponseDto = {
ownerId: string[]; ownerId: string[];
projectionType: (string | null)[]; projectionType: (string | null)[];
ratio: number[]; ratio: number[];
/** The stack ID and stack asset count as a tuple */ /** (stack ID, stack asset count) tuple */
stack?: ((string | number)[] | null)[]; stack?: (string | null)[];
thumbhash: (string | null)[]; thumbhash: (string | null)[];
}; };
export type TimeBucketsResponseDto = { export type TimeBucketsResponseDto = {

View File

@ -87,13 +87,14 @@ export class TimeBucketAssetResponseDto implements TimeBucketAssets {
@ApiProperty({ @ApiProperty({
type: 'array', type: 'array',
items: { items: {
type: 'array', type: 'string',
nullable: true, nullable: true,
items: { oneOf: [{ type: 'string' }, { type: 'number' }], minItems: 2, maxItems: 2 },
}, },
description: 'The stack ID and stack asset count as a tuple', maxItems: 2,
minItems: 2,
description: '(stack ID, stack asset count) tuple',
}) })
stack?: ([string, number] | null)[]; stack?: ([string, string] | null)[];
@ApiProperty({ type: 'array', items: { type: 'string', nullable: true } }) @ApiProperty({ type: 'array', items: { type: 'string', nullable: true } })
projectionType!: (string | null)[]; projectionType!: (string | null)[];

View File

@ -293,7 +293,7 @@ with
inner join "exif" on "assets"."id" = "exif"."assetId" inner join "exif" on "assets"."id" = "exif"."assetId"
left join lateral ( left join lateral (
select select
json_build_array(stacked."stackId", count('stacked')) as "stack" array[stacked."stackId"::text, count('stacked')::text] as "stack"
from from
"assets" as "stacked" "assets" as "stacked"
where where

View File

@ -652,7 +652,7 @@ export class AssetRepository {
(eb) => (eb) =>
eb eb
.selectFrom('assets as stacked') .selectFrom('assets as stacked')
.select(sql`json_build_array(stacked."stackId", count('stacked'))`.as('stack')) .select(sql`array[stacked."stackId"::text, count('stacked')::text]`.as('stack'))
.whereRef('stacked.stackId', '=', 'assets.stackId') .whereRef('stacked.stackId', '=', 'assets.stackId')
.where('stacked.deletedAt', 'is', null) .where('stacked.deletedAt', 'is', null)
.where('stacked.isArchived', '=', false) .where('stacked.isArchived', '=', false)

View File

@ -19,7 +19,7 @@ export type TimeBucketAssets = {
isImage: number[]; isImage: number[];
thumbhash: (string | null)[]; thumbhash: (string | null)[];
localDateTime: string[]; localDateTime: string[];
stack?: ([string, number] | null)[]; stack?: ([string, string] | null)[];
duration: (string | null)[]; duration: (string | null)[];
projectionType: (string | null)[]; projectionType: (string | null)[];
livePhotoVideoId: (string | null)[]; livePhotoVideoId: (string | null)[];

View File

@ -439,9 +439,9 @@ export class AssetBucket {
ratio: bucketAssets.ratio[i], ratio: bucketAssets.ratio[i],
stack: bucketAssets.stack?.[i] stack: bucketAssets.stack?.[i]
? { ? {
id: bucketAssets.stack[i]![0] as string, id: bucketAssets.stack[i]![0],
primaryAssetId: bucketAssets.id[i], primaryAssetId: bucketAssets.id[i],
assetCount: bucketAssets.stack[i]![1] as number, assetCount: Number.parseInt(bucketAssets.stack[i]![1]),
} }
: null, : null,
thumbhash: bucketAssets.thumbhash[i], thumbhash: bucketAssets.thumbhash[i],