1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-14 07:04:24 +02:00

feat: persistent memories (#15953)

feat: memories

refactor

chore: use heart as favorite icon

fix: linting
This commit is contained in:
Jason Rasmussen
2025-02-21 13:31:37 -05:00
committed by GitHub
parent 502f6e020d
commit d350022dec
29 changed files with 585 additions and 70 deletions

View File

@ -26,12 +26,16 @@ class ManualJobName {
static const personCleanup = ManualJobName._(r'person-cleanup');
static const tagCleanup = ManualJobName._(r'tag-cleanup');
static const userCleanup = ManualJobName._(r'user-cleanup');
static const memoryCleanup = ManualJobName._(r'memory-cleanup');
static const memoryCreate = ManualJobName._(r'memory-create');
/// List of all possible values in this [enum][ManualJobName].
static const values = <ManualJobName>[
personCleanup,
tagCleanup,
userCleanup,
memoryCleanup,
memoryCreate,
];
static ManualJobName? fromJson(dynamic value) => ManualJobNameTypeTransformer().decode(value);
@ -73,6 +77,8 @@ class ManualJobNameTypeTransformer {
case r'person-cleanup': return ManualJobName.personCleanup;
case r'tag-cleanup': return ManualJobName.tagCleanup;
case r'user-cleanup': return ManualJobName.userCleanup;
case r'memory-cleanup': return ManualJobName.memoryCleanup;
case r'memory-create': return ManualJobName.memoryCreate;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');

View File

@ -17,11 +17,13 @@ class MemoryResponseDto {
required this.createdAt,
required this.data,
this.deletedAt,
this.hideAt,
required this.id,
required this.isSaved,
required this.memoryAt,
required this.ownerId,
this.seenAt,
this.showAt,
required this.type,
required this.updatedAt,
});
@ -40,6 +42,14 @@ class MemoryResponseDto {
///
DateTime? deletedAt;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
DateTime? hideAt;
String id;
bool isSaved;
@ -56,6 +66,14 @@ class MemoryResponseDto {
///
DateTime? seenAt;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
DateTime? showAt;
MemoryType type;
DateTime updatedAt;
@ -66,11 +84,13 @@ class MemoryResponseDto {
other.createdAt == createdAt &&
other.data == data &&
other.deletedAt == deletedAt &&
other.hideAt == hideAt &&
other.id == id &&
other.isSaved == isSaved &&
other.memoryAt == memoryAt &&
other.ownerId == ownerId &&
other.seenAt == seenAt &&
other.showAt == showAt &&
other.type == type &&
other.updatedAt == updatedAt;
@ -81,16 +101,18 @@ class MemoryResponseDto {
(createdAt.hashCode) +
(data.hashCode) +
(deletedAt == null ? 0 : deletedAt!.hashCode) +
(hideAt == null ? 0 : hideAt!.hashCode) +
(id.hashCode) +
(isSaved.hashCode) +
(memoryAt.hashCode) +
(ownerId.hashCode) +
(seenAt == null ? 0 : seenAt!.hashCode) +
(showAt == null ? 0 : showAt!.hashCode) +
(type.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'MemoryResponseDto[assets=$assets, createdAt=$createdAt, data=$data, deletedAt=$deletedAt, id=$id, isSaved=$isSaved, memoryAt=$memoryAt, ownerId=$ownerId, seenAt=$seenAt, type=$type, updatedAt=$updatedAt]';
String toString() => 'MemoryResponseDto[assets=$assets, createdAt=$createdAt, data=$data, deletedAt=$deletedAt, hideAt=$hideAt, id=$id, isSaved=$isSaved, memoryAt=$memoryAt, ownerId=$ownerId, seenAt=$seenAt, showAt=$showAt, type=$type, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -101,6 +123,11 @@ class MemoryResponseDto {
json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
} else {
// json[r'deletedAt'] = null;
}
if (this.hideAt != null) {
json[r'hideAt'] = this.hideAt!.toUtc().toIso8601String();
} else {
// json[r'hideAt'] = null;
}
json[r'id'] = this.id;
json[r'isSaved'] = this.isSaved;
@ -110,6 +137,11 @@ class MemoryResponseDto {
json[r'seenAt'] = this.seenAt!.toUtc().toIso8601String();
} else {
// json[r'seenAt'] = null;
}
if (this.showAt != null) {
json[r'showAt'] = this.showAt!.toUtc().toIso8601String();
} else {
// json[r'showAt'] = null;
}
json[r'type'] = this.type;
json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String();
@ -129,11 +161,13 @@ class MemoryResponseDto {
createdAt: mapDateTime(json, r'createdAt', r'')!,
data: OnThisDayDto.fromJson(json[r'data'])!,
deletedAt: mapDateTime(json, r'deletedAt', r''),
hideAt: mapDateTime(json, r'hideAt', r''),
id: mapValueOfType<String>(json, r'id')!,
isSaved: mapValueOfType<bool>(json, r'isSaved')!,
memoryAt: mapDateTime(json, r'memoryAt', r'')!,
ownerId: mapValueOfType<String>(json, r'ownerId')!,
seenAt: mapDateTime(json, r'seenAt', r''),
showAt: mapDateTime(json, r'showAt', r''),
type: MemoryType.fromJson(json[r'type'])!,
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
);