mirror of
https://github.com/immich-app/immich.git
synced 2026-05-22 23:12:32 -04:00
e142e3aca7
* feat(server): add ordering date option to time buckets * feat(web): add recently added page * feat(server): recently created assets in explore data * feat(web): recently added in explore tab * fix: recently added assets ordering * fix(server): failing bucket test * feat(web): improve recently added preview * chore: update e2e explore/timeline tests * chore: rename and refactor timeline ordering dates * fix(web): invalid timeline option * feat(mobile): recently added page * fix(server): sync tests * fix(mobile): resync assets to get uploadedAt column * chore: rename assetorderby enum * chore(mobile): formatting * minor fixes * stylings --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
74 lines
2.2 KiB
Dart
74 lines
2.2 KiB
Dart
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
|
import 'package:immich_mobile/domain/models/exif.model.dart';
|
|
import 'package:immich_mobile/infrastructure/utils/exif.converter.dart';
|
|
import 'package:openapi/api.dart' as api;
|
|
|
|
extension DTOToAsset on api.AssetResponseDto {
|
|
RemoteAsset toDto() {
|
|
return RemoteAsset(
|
|
id: id,
|
|
name: originalFileName,
|
|
checksum: checksum,
|
|
createdAt: fileCreatedAt,
|
|
updatedAt: updatedAt,
|
|
uploadedAt: createdAt,
|
|
ownerId: ownerId,
|
|
visibility: visibility.toAssetVisibility(),
|
|
durationMs: duration,
|
|
height: height?.toInt(),
|
|
width: width?.toInt(),
|
|
isFavorite: isFavorite,
|
|
livePhotoVideoId: livePhotoVideoId,
|
|
thumbHash: thumbhash,
|
|
localId: null,
|
|
type: type.toAssetType(),
|
|
stackId: stack?.id,
|
|
isEdited: isEdited,
|
|
);
|
|
}
|
|
|
|
RemoteAssetExif toDtoWithExif() {
|
|
return RemoteAssetExif(
|
|
id: id,
|
|
name: originalFileName,
|
|
checksum: checksum,
|
|
createdAt: fileCreatedAt,
|
|
updatedAt: updatedAt,
|
|
uploadedAt: createdAt,
|
|
ownerId: ownerId,
|
|
visibility: visibility.toAssetVisibility(),
|
|
durationMs: duration,
|
|
height: height?.toInt(),
|
|
width: width?.toInt(),
|
|
isFavorite: isFavorite,
|
|
livePhotoVideoId: livePhotoVideoId,
|
|
thumbHash: thumbhash,
|
|
localId: null,
|
|
type: type.toAssetType(),
|
|
stackId: stack?.id,
|
|
isEdited: isEdited,
|
|
exifInfo: exifInfo != null ? ExifDtoConverter.fromDto(exifInfo!) : const ExifInfo(),
|
|
);
|
|
}
|
|
}
|
|
|
|
extension on api.AssetVisibility {
|
|
AssetVisibility toAssetVisibility() => switch (this) {
|
|
api.AssetVisibility.timeline => AssetVisibility.timeline,
|
|
api.AssetVisibility.hidden => AssetVisibility.hidden,
|
|
api.AssetVisibility.archive => AssetVisibility.archive,
|
|
api.AssetVisibility.locked => AssetVisibility.locked,
|
|
_ => AssetVisibility.timeline,
|
|
};
|
|
}
|
|
|
|
extension on api.AssetTypeEnum {
|
|
AssetType toAssetType() => switch (this) {
|
|
api.AssetTypeEnum.IMAGE => AssetType.image,
|
|
api.AssetTypeEnum.VIDEO => AssetType.video,
|
|
api.AssetTypeEnum.AUDIO => AssetType.audio,
|
|
api.AssetTypeEnum.OTHER => AssetType.other,
|
|
_ => throw Exception('Unknown AssetType value: $this'),
|
|
};
|
|
}
|