mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
fix: use local time for time buckets and improve memories (#4072)
* fix: timezone bucket timezones * chore: open api * fix: interpret local time in utc * fix: tests * fix: refactor memory lane * fix(web): use local date in memory viewer * chore: set localDateTime non-null * fix: filter out memories from the current year * wip: move localDateTime to asset * fix: correct sorting from db * fix: migration * fix: web typo * fix: formatting * fix: e2e * chore: localDateTime is non-null * chore: more non-nulliness * fix: asset stub * fix: tests * fix: use extract and index for day of year * fix: don't show memories before today * fix: cleanup * fix: tests * fix: only use localtime for tz * fix: display memories in client timezone * fix: tests * fix: svelte tests * fix: bugs * chore: open api --------- Co-authored-by: Jonathan Jogenfors <jonathan@jogenfors.se>
This commit is contained in:
10
mobile/openapi/doc/AssetApi.md
generated
10
mobile/openapi/doc/AssetApi.md
generated
@@ -963,7 +963,7 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **getMemoryLane**
|
||||
> List<MemoryLaneResponseDto> getMemoryLane(timestamp)
|
||||
> List<MemoryLaneResponseDto> getMemoryLane(day, month)
|
||||
|
||||
|
||||
|
||||
@@ -986,10 +986,11 @@ import 'package:openapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
|
||||
|
||||
final api_instance = AssetApi();
|
||||
final timestamp = 2013-10-20T19:20:30+01:00; // DateTime | Get pictures for +24 hours from this time going back x years
|
||||
final day = 56; // int |
|
||||
final month = 56; // int |
|
||||
|
||||
try {
|
||||
final result = api_instance.getMemoryLane(timestamp);
|
||||
final result = api_instance.getMemoryLane(day, month);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling AssetApi->getMemoryLane: $e\n');
|
||||
@@ -1000,7 +1001,8 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**timestamp** | **DateTime**| Get pictures for +24 hours from this time going back x years |
|
||||
**day** | **int**| |
|
||||
**month** | **int**| |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
1
mobile/openapi/doc/AssetResponseDto.md
generated
1
mobile/openapi/doc/AssetResponseDto.md
generated
@@ -23,6 +23,7 @@ Name | Type | Description | Notes
|
||||
**isReadOnly** | **bool** | |
|
||||
**libraryId** | **String** | |
|
||||
**livePhotoVideoId** | **String** | | [optional]
|
||||
**localDateTime** | [**DateTime**](DateTime.md) | |
|
||||
**originalFileName** | **String** | |
|
||||
**originalPath** | **String** | |
|
||||
**owner** | [**UserResponseDto**](UserResponseDto.md) | | [optional]
|
||||
|
||||
19
mobile/openapi/lib/api/asset_api.dart
generated
19
mobile/openapi/lib/api/asset_api.dart
generated
@@ -984,9 +984,10 @@ class AssetApi {
|
||||
/// Performs an HTTP 'GET /asset/memory-lane' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [DateTime] timestamp (required):
|
||||
/// Get pictures for +24 hours from this time going back x years
|
||||
Future<Response> getMemoryLaneWithHttpInfo(DateTime timestamp,) async {
|
||||
/// * [int] day (required):
|
||||
///
|
||||
/// * [int] month (required):
|
||||
Future<Response> getMemoryLaneWithHttpInfo(int day, int month,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/asset/memory-lane';
|
||||
|
||||
@@ -997,7 +998,8 @@ class AssetApi {
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
queryParams.addAll(_queryParams('', 'timestamp', timestamp));
|
||||
queryParams.addAll(_queryParams('', 'day', day));
|
||||
queryParams.addAll(_queryParams('', 'month', month));
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
@@ -1015,10 +1017,11 @@ class AssetApi {
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [DateTime] timestamp (required):
|
||||
/// Get pictures for +24 hours from this time going back x years
|
||||
Future<List<MemoryLaneResponseDto>?> getMemoryLane(DateTime timestamp,) async {
|
||||
final response = await getMemoryLaneWithHttpInfo(timestamp,);
|
||||
/// * [int] day (required):
|
||||
///
|
||||
/// * [int] month (required):
|
||||
Future<List<MemoryLaneResponseDto>?> getMemoryLane(int day, int month,) async {
|
||||
final response = await getMemoryLaneWithHttpInfo(day, month,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
||||
10
mobile/openapi/lib/model/asset_response_dto.dart
generated
10
mobile/openapi/lib/model/asset_response_dto.dart
generated
@@ -28,6 +28,7 @@ class AssetResponseDto {
|
||||
required this.isReadOnly,
|
||||
required this.libraryId,
|
||||
this.livePhotoVideoId,
|
||||
required this.localDateTime,
|
||||
required this.originalFileName,
|
||||
required this.originalPath,
|
||||
this.owner,
|
||||
@@ -78,6 +79,8 @@ class AssetResponseDto {
|
||||
|
||||
String? livePhotoVideoId;
|
||||
|
||||
DateTime localDateTime;
|
||||
|
||||
String originalFileName;
|
||||
|
||||
String originalPath;
|
||||
@@ -130,6 +133,7 @@ class AssetResponseDto {
|
||||
other.isReadOnly == isReadOnly &&
|
||||
other.libraryId == libraryId &&
|
||||
other.livePhotoVideoId == livePhotoVideoId &&
|
||||
other.localDateTime == localDateTime &&
|
||||
other.originalFileName == originalFileName &&
|
||||
other.originalPath == originalPath &&
|
||||
other.owner == owner &&
|
||||
@@ -160,6 +164,7 @@ class AssetResponseDto {
|
||||
(isReadOnly.hashCode) +
|
||||
(libraryId.hashCode) +
|
||||
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +
|
||||
(localDateTime.hashCode) +
|
||||
(originalFileName.hashCode) +
|
||||
(originalPath.hashCode) +
|
||||
(owner == null ? 0 : owner!.hashCode) +
|
||||
@@ -173,7 +178,7 @@ class AssetResponseDto {
|
||||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isArchived=$isArchived, isExternal=$isExternal, isFavorite=$isFavorite, isOffline=$isOffline, isReadOnly=$isReadOnly, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, originalFileName=$originalFileName, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, tags=$tags, thumbhash=$thumbhash, type=$type, updatedAt=$updatedAt]';
|
||||
String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isArchived=$isArchived, isExternal=$isExternal, isFavorite=$isFavorite, isOffline=$isOffline, isReadOnly=$isReadOnly, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, tags=$tags, thumbhash=$thumbhash, type=$type, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -200,6 +205,7 @@ class AssetResponseDto {
|
||||
} else {
|
||||
// json[r'livePhotoVideoId'] = null;
|
||||
}
|
||||
json[r'localDateTime'] = this.localDateTime.toUtc().toIso8601String();
|
||||
json[r'originalFileName'] = this.originalFileName;
|
||||
json[r'originalPath'] = this.originalPath;
|
||||
if (this.owner != null) {
|
||||
@@ -249,6 +255,7 @@ class AssetResponseDto {
|
||||
isReadOnly: mapValueOfType<bool>(json, r'isReadOnly')!,
|
||||
libraryId: mapValueOfType<String>(json, r'libraryId')!,
|
||||
livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),
|
||||
localDateTime: mapDateTime(json, r'localDateTime', '')!,
|
||||
originalFileName: mapValueOfType<String>(json, r'originalFileName')!,
|
||||
originalPath: mapValueOfType<String>(json, r'originalPath')!,
|
||||
owner: UserResponseDto.fromJson(json[r'owner']),
|
||||
@@ -320,6 +327,7 @@ class AssetResponseDto {
|
||||
'isOffline',
|
||||
'isReadOnly',
|
||||
'libraryId',
|
||||
'localDateTime',
|
||||
'originalFileName',
|
||||
'originalPath',
|
||||
'ownerId',
|
||||
|
||||
2
mobile/openapi/test/asset_api_test.dart
generated
2
mobile/openapi/test/asset_api_test.dart
generated
@@ -107,7 +107,7 @@ void main() {
|
||||
// TODO
|
||||
});
|
||||
|
||||
//Future<List<MemoryLaneResponseDto>> getMemoryLane(DateTime timestamp) async
|
||||
//Future<List<MemoryLaneResponseDto>> getMemoryLane(int day, int month) async
|
||||
test('test getMemoryLane', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
5
mobile/openapi/test/asset_response_dto_test.dart
generated
5
mobile/openapi/test/asset_response_dto_test.dart
generated
@@ -92,6 +92,11 @@ void main() {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// DateTime localDateTime
|
||||
test('to test the property `localDateTime`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String originalFileName
|
||||
test('to test the property `originalFileName`', () async {
|
||||
// TODO
|
||||
|
||||
Reference in New Issue
Block a user