refactor(server): stacks (#11453)

* refactor: stacks

* mobile: get it built

* chore: feedback

* fix: sync and duplicates

* mobile: remove old stack reference

* chore: add primary asset id

* revert change to asset entity

* mobile: refactor mobile api

* mobile: sync stack info after creating stack

* mobile: update timeline after deleting stack

* server: update asset updatedAt when stack is deleted

* mobile: simplify action

* mobile: rename to match dto property

* fix: web test

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Jason Rasmussen 2024-08-19 13:37:15 -04:00 committed by GitHub
parent ca52cbace1
commit 8338657eaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 2321 additions and 1152 deletions

View file

@ -38,9 +38,7 @@ class AssetResponseDto {
this.people = const [],
required this.resized,
this.smartInfo,
this.stack = const [],
required this.stackCount,
this.stackParentId,
this.stack,
this.tags = const [],
required this.thumbhash,
required this.type,
@ -124,11 +122,7 @@ class AssetResponseDto {
///
SmartInfoResponseDto? smartInfo;
List<AssetResponseDto> stack;
int? stackCount;
String? stackParentId;
AssetStackResponseDto? stack;
List<TagResponseDto> tags;
@ -167,9 +161,7 @@ class AssetResponseDto {
_deepEquality.equals(other.people, people) &&
other.resized == resized &&
other.smartInfo == smartInfo &&
_deepEquality.equals(other.stack, stack) &&
other.stackCount == stackCount &&
other.stackParentId == stackParentId &&
other.stack == stack &&
_deepEquality.equals(other.tags, tags) &&
other.thumbhash == thumbhash &&
other.type == type &&
@ -204,9 +196,7 @@ class AssetResponseDto {
(people.hashCode) +
(resized.hashCode) +
(smartInfo == null ? 0 : smartInfo!.hashCode) +
(stack.hashCode) +
(stackCount == null ? 0 : stackCount!.hashCode) +
(stackParentId == null ? 0 : stackParentId!.hashCode) +
(stack == null ? 0 : stack!.hashCode) +
(tags.hashCode) +
(thumbhash == null ? 0 : thumbhash!.hashCode) +
(type.hashCode) +
@ -214,7 +204,7 @@ class AssetResponseDto {
(updatedAt.hashCode);
@override
String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duplicateId=$duplicateId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, hasMetadata=$hasMetadata, id=$id, isArchived=$isArchived, isFavorite=$isFavorite, isOffline=$isOffline, isTrashed=$isTrashed, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalMimeType=$originalMimeType, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, stack=$stack, stackCount=$stackCount, stackParentId=$stackParentId, tags=$tags, thumbhash=$thumbhash, type=$type, unassignedFaces=$unassignedFaces, updatedAt=$updatedAt]';
String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duplicateId=$duplicateId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, hasMetadata=$hasMetadata, id=$id, isArchived=$isArchived, isFavorite=$isFavorite, isOffline=$isOffline, isTrashed=$isTrashed, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalMimeType=$originalMimeType, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, stack=$stack, tags=$tags, thumbhash=$thumbhash, type=$type, unassignedFaces=$unassignedFaces, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -271,16 +261,10 @@ class AssetResponseDto {
} else {
// json[r'smartInfo'] = null;
}
if (this.stack != null) {
json[r'stack'] = this.stack;
if (this.stackCount != null) {
json[r'stackCount'] = this.stackCount;
} else {
// json[r'stackCount'] = null;
}
if (this.stackParentId != null) {
json[r'stackParentId'] = this.stackParentId;
} else {
// json[r'stackParentId'] = null;
// json[r'stack'] = null;
}
json[r'tags'] = this.tags;
if (this.thumbhash != null) {
@ -327,9 +311,7 @@ class AssetResponseDto {
people: PersonWithFacesResponseDto.listFromJson(json[r'people']),
resized: mapValueOfType<bool>(json, r'resized')!,
smartInfo: SmartInfoResponseDto.fromJson(json[r'smartInfo']),
stack: AssetResponseDto.listFromJson(json[r'stack']),
stackCount: mapValueOfType<int>(json, r'stackCount'),
stackParentId: mapValueOfType<String>(json, r'stackParentId'),
stack: AssetStackResponseDto.fromJson(json[r'stack']),
tags: TagResponseDto.listFromJson(json[r'tags']),
thumbhash: mapValueOfType<String>(json, r'thumbhash'),
type: AssetTypeEnum.fromJson(json[r'type'])!,
@ -399,7 +381,6 @@ class AssetResponseDto {
'originalPath',
'ownerId',
'resized',
'stackCount',
'thumbhash',
'type',
'updatedAt',