mirror of
https://github.com/immich-app/immich.git
synced 2025-12-16 01:30:47 -08:00
Compare commits
11 Commits
v1.136.0
...
drift-auth
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4677ceb03c | ||
|
|
ad65e9011a | ||
|
|
977c9b96ba | ||
|
|
aa2828ab33 | ||
|
|
a36840d7cc | ||
|
|
e34f46fa0d | ||
|
|
6170a3843c | ||
|
|
563e2ab503 | ||
|
|
79157e1043 | ||
|
|
02688a2a03 | ||
|
|
3b9bfceef0 |
8
.github/workflows/build-mobile.yml
vendored
8
.github/workflows/build-mobile.yml
vendored
@@ -122,17 +122,17 @@ jobs:
|
|||||||
IS_MAIN: ${{ github.ref == 'refs/heads/main' }}
|
IS_MAIN: ${{ github.ref == 'refs/heads/main' }}
|
||||||
run: |
|
run: |
|
||||||
if [[ $IS_MAIN == 'true' ]]; then
|
if [[ $IS_MAIN == 'true' ]]; then
|
||||||
flutter build apk --release --flavor production
|
flutter build apk --release
|
||||||
flutter build apk --release --flavor production --split-per-abi --target-platform android-arm,android-arm64,android-x64
|
flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64,android-x64
|
||||||
else
|
else
|
||||||
flutter build apk --debug --flavor production --split-per-abi --target-platform android-arm64
|
flutter build apk --debug --split-per-abi --target-platform android-arm64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Publish Android Artifact
|
- name: Publish Android Artifact
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
with:
|
with:
|
||||||
name: release-apk-signed
|
name: release-apk-signed
|
||||||
path: mobile/build/app/outputs/flutter-apk/**/*.apk
|
path: mobile/build/app/outputs/flutter-apk/*.apk
|
||||||
|
|
||||||
- name: Save Gradle Cache
|
- name: Save Gradle Cache
|
||||||
id: cache-gradle-save
|
id: cache-gradle-save
|
||||||
|
|||||||
3
.github/workflows/static_analysis.yml
vendored
3
.github/workflows/static_analysis.yml
vendored
@@ -98,7 +98,8 @@ jobs:
|
|||||||
run: dart analyze --fatal-infos
|
run: dart analyze --fatal-infos
|
||||||
|
|
||||||
- name: Run dart format
|
- name: Run dart format
|
||||||
run: dart format lib/ --set-exit-if-changed
|
# Ignore generated files manually until https://github.com/dart-lang/dart_style/issues/864 is resolved
|
||||||
|
run: dart format --set-exit-if-changed $(find lib -name '*.dart' -not \( -name 'generated_plugin_registrant.dart' -o -name '*.g.dart' -o -name '*.drift.dart' \))
|
||||||
|
|
||||||
- name: Run dart custom_lint
|
- name: Run dart custom_lint
|
||||||
run: dart run custom_lint
|
run: dart run custom_lint
|
||||||
|
|||||||
19
.vscode/launch.json
vendored
19
.vscode/launch.json
vendored
@@ -18,25 +18,6 @@
|
|||||||
"name": "Immich Workers",
|
"name": "Immich Workers",
|
||||||
"remoteRoot": "/usr/src/app",
|
"remoteRoot": "/usr/src/app",
|
||||||
"localRoot": "${workspaceFolder}/server"
|
"localRoot": "${workspaceFolder}/server"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Flavor - Production",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "dart",
|
|
||||||
"codeLens": {
|
|
||||||
"for": [
|
|
||||||
"run-test",
|
|
||||||
"run-test-file",
|
|
||||||
"run-file",
|
|
||||||
"debug-test",
|
|
||||||
"debug-test-file",
|
|
||||||
"debug-file",
|
|
||||||
],
|
|
||||||
"title": "${debugType}",
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
"--flavor", "production"
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -397,6 +397,7 @@
|
|||||||
"album_cover_updated": "Album cover updated",
|
"album_cover_updated": "Album cover updated",
|
||||||
"album_delete_confirmation": "Are you sure you want to delete the album {album}?",
|
"album_delete_confirmation": "Are you sure you want to delete the album {album}?",
|
||||||
"album_delete_confirmation_description": "If this album is shared, other users will not be able to access it anymore.",
|
"album_delete_confirmation_description": "If this album is shared, other users will not be able to access it anymore.",
|
||||||
|
"album_deleted": "Album deleted",
|
||||||
"album_info_card_backup_album_excluded": "EXCLUDED",
|
"album_info_card_backup_album_excluded": "EXCLUDED",
|
||||||
"album_info_card_backup_album_included": "INCLUDED",
|
"album_info_card_backup_album_included": "INCLUDED",
|
||||||
"album_info_updated": "Album info updated",
|
"album_info_updated": "Album info updated",
|
||||||
|
|||||||
4
mobile/.vscode/settings.json
vendored
4
mobile/.vscode/settings.json
vendored
@@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"dart.flutterSdkPath": ".fvm/versions/3.32.6",
|
"dart.flutterSdkPath": ".fvm/versions/3.32.6",
|
||||||
|
"dart.lineLength": 120,
|
||||||
|
"[dart]": {
|
||||||
|
"editor.rulers": [120],
|
||||||
|
},
|
||||||
"search.exclude": {
|
"search.exclude": {
|
||||||
"**/.fvm": true
|
"**/.fvm": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
# packages, and plugins designed to encourage good coding practices.
|
# packages, and plugins designed to encourage good coding practices.
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
formatter:
|
||||||
|
page_width: 120
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
# The lint rules applied to this project can be customized in the
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
|
|||||||
@@ -72,20 +72,6 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "default"
|
|
||||||
productFlavors {
|
|
||||||
production {
|
|
||||||
dimension "default"
|
|
||||||
applicationId "app.alextran.immich"
|
|
||||||
}
|
|
||||||
|
|
||||||
beta {
|
|
||||||
dimension "default"
|
|
||||||
applicationId "app.alextran.immich.beta"
|
|
||||||
versionNameSuffix "-BETA"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
applicationIdSuffix '.debug'
|
applicationIdSuffix '.debug'
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<application android:label="Immich Beta" tools:replace="android:label" />
|
|
||||||
</manifest>
|
|
||||||
1
mobile/drift_schemas/main/drift_schema_v5.json
generated
Normal file
1
mobile/drift_schemas/main/drift_schema_v5.json
generated
Normal file
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ enum ImmichColorPreset {
|
|||||||
lime,
|
lime,
|
||||||
green,
|
green,
|
||||||
cyan,
|
cyan,
|
||||||
slateGray
|
slateGray,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImmichColorPreset defaultColorPreset = ImmichColorPreset.indigo;
|
const ImmichColorPreset defaultColorPreset = ImmichColorPreset.indigo;
|
||||||
|
|||||||
@@ -7,10 +7,8 @@ const Map<String, Locale> locales = {
|
|||||||
'Arabic (ar)': Locale('ar'),
|
'Arabic (ar)': Locale('ar'),
|
||||||
'Bulgarian (bg)': Locale('bg'),
|
'Bulgarian (bg)': Locale('bg'),
|
||||||
'Catalan (ca)': Locale('ca'),
|
'Catalan (ca)': Locale('ca'),
|
||||||
'Chinese Simplified (zh_CN)':
|
'Chinese Simplified (zh_CN)': Locale.fromSubtags(languageCode: 'zh', scriptCode: 'SIMPLIFIED'),
|
||||||
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'SIMPLIFIED'),
|
'Chinese Traditional (zh_TW)': Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
|
||||||
'Chinese Traditional (zh_TW)':
|
|
||||||
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
|
|
||||||
'Croatian (hr)': Locale('hr'),
|
'Croatian (hr)': Locale('hr'),
|
||||||
'Czech (cs)': Locale('cs'),
|
'Czech (cs)': Locale('cs'),
|
||||||
'Danish (da)': Locale('da'),
|
'Danish (da)': Locale('da'),
|
||||||
@@ -37,10 +35,8 @@ const Map<String, Locale> locales = {
|
|||||||
'Portuguese (pt)': Locale('pt'),
|
'Portuguese (pt)': Locale('pt'),
|
||||||
'Romanian (ro)': Locale('ro'),
|
'Romanian (ro)': Locale('ro'),
|
||||||
'Russian (ru)': Locale('ru'),
|
'Russian (ru)': Locale('ru'),
|
||||||
'Serbian Cyrillic (sr_Cyrl)':
|
'Serbian Cyrillic (sr_Cyrl)': Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl'),
|
||||||
Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl'),
|
'Serbian Latin (sr_Latn)': Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn'),
|
||||||
'Serbian Latin (sr_Latn)':
|
|
||||||
Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn'),
|
|
||||||
'Slovak (sk)': Locale('sk'),
|
'Slovak (sk)': Locale('sk'),
|
||||||
'Slovenian (sl)': Locale('sl'),
|
'Slovenian (sl)': Locale('sl'),
|
||||||
'Spanish (es)': Locale('es'),
|
'Spanish (es)': Locale('es'),
|
||||||
|
|||||||
@@ -53,10 +53,8 @@ sealed class BaseAsset {
|
|||||||
return const Duration();
|
return const Duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get hasRemote =>
|
bool get hasRemote => storage == AssetState.remote || storage == AssetState.merged;
|
||||||
storage == AssetState.remote || storage == AssetState.merged;
|
bool get hasLocal => storage == AssetState.local || storage == AssetState.merged;
|
||||||
bool get hasLocal =>
|
|
||||||
storage == AssetState.local || storage == AssetState.merged;
|
|
||||||
bool get isLocalOnly => storage == AssetState.local;
|
bool get isLocalOnly => storage == AssetState.local;
|
||||||
bool get isRemoteOnly => storage == AssetState.remote;
|
bool get isRemoteOnly => storage == AssetState.remote;
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class LocalAsset extends BaseAsset {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AssetState get storage =>
|
AssetState get storage => remoteId == null ? AssetState.local : AssetState.merged;
|
||||||
remoteId == null ? AssetState.local : AssetState.merged;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get heroTag => '${id}_${remoteId ?? checksum}';
|
String get heroTag => '${id}_${remoteId ?? checksum}';
|
||||||
@@ -54,8 +53,7 @@ class LocalAsset extends BaseAsset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => super.hashCode ^ id.hashCode ^ remoteId.hashCode ^ orientation.hashCode;
|
||||||
super.hashCode ^ id.hashCode ^ remoteId.hashCode ^ orientation.hashCode;
|
|
||||||
|
|
||||||
LocalAsset copyWith({
|
LocalAsset copyWith({
|
||||||
String? id,
|
String? id,
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AssetState get storage =>
|
AssetState get storage => localId == null ? AssetState.remote : AssetState.merged;
|
||||||
localId == null ? AssetState.remote : AssetState.merged;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get heroTag => '${localId ?? checksum}_$id';
|
String get heroTag => '${localId ?? checksum}_$id';
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ class DeviceAsset {
|
|||||||
bool operator ==(covariant DeviceAsset other) {
|
bool operator ==(covariant DeviceAsset other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other.assetId == assetId &&
|
return other.assetId == assetId && other.hash == hash && other.modifiedTime == modifiedTime;
|
||||||
other.hash == hash &&
|
|
||||||
other.modifiedTime == modifiedTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ class ExifInfo {
|
|||||||
final int? iso;
|
final int? iso;
|
||||||
final double? exposureSeconds;
|
final double? exposureSeconds;
|
||||||
|
|
||||||
bool get hasCoordinates =>
|
bool get hasCoordinates => latitude != null && longitude != null && latitude != 0 && longitude != 0;
|
||||||
latitude != null && longitude != null && latitude != 0 && longitude != 0;
|
|
||||||
|
|
||||||
String get exposureTime {
|
String get exposureTime {
|
||||||
if (exposureSeconds == null) {
|
if (exposureSeconds == null) {
|
||||||
|
|||||||
@@ -43,12 +43,7 @@ class LogMessage {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return message.hashCode ^
|
return message.hashCode ^ level.hashCode ^ createdAt.hashCode ^ logger.hashCode ^ error.hashCode ^ stack.hashCode;
|
||||||
level.hashCode ^
|
|
||||||
createdAt.hashCode ^
|
|
||||||
logger.hashCode ^
|
|
||||||
error.hashCode ^
|
|
||||||
stack.hashCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ class MemoryData {
|
|||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory MemoryData.fromJson(String source) =>
|
factory MemoryData.fromJson(String source) => MemoryData.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||||
MemoryData.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'MemoryData(year: $year)';
|
String toString() => 'MemoryData(year: $year)';
|
||||||
|
|||||||
@@ -55,22 +55,17 @@ class PersonDto {
|
|||||||
factory PersonDto.fromMap(Map<String, dynamic> map) {
|
factory PersonDto.fromMap(Map<String, dynamic> map) {
|
||||||
return PersonDto(
|
return PersonDto(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
birthDate: map['birthDate'] != null
|
birthDate: map['birthDate'] != null ? DateTime.fromMillisecondsSinceEpoch(map['birthDate'] as int) : null,
|
||||||
? DateTime.fromMillisecondsSinceEpoch(map['birthDate'] as int)
|
|
||||||
: null,
|
|
||||||
isHidden: map['isHidden'] as bool,
|
isHidden: map['isHidden'] as bool,
|
||||||
name: map['name'] as String,
|
name: map['name'] as String,
|
||||||
thumbnailPath: map['thumbnailPath'] as String,
|
thumbnailPath: map['thumbnailPath'] as String,
|
||||||
updatedAt: map['updatedAt'] != null
|
updatedAt: map['updatedAt'] != null ? DateTime.fromMillisecondsSinceEpoch(map['updatedAt'] as int) : null,
|
||||||
? DateTime.fromMillisecondsSinceEpoch(map['updatedAt'] as int)
|
|
||||||
: null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory PersonDto.fromJson(String source) =>
|
factory PersonDto.fromJson(String source) => PersonDto.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||||
PersonDto.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(covariant PersonDto other) {
|
bool operator ==(covariant PersonDto other) {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
|
|
||||||
enum Setting<T> {
|
enum Setting<T> {
|
||||||
|
// TODO: Remove UserDto after new store in drift
|
||||||
|
currentUser<UserDto?>(StoreKey.currentUser, null),
|
||||||
tilesPerRow<int>(StoreKey.tilesPerRow, 4),
|
tilesPerRow<int>(StoreKey.tilesPerRow, 4),
|
||||||
groupAssetsBy<int>(StoreKey.groupAssetsBy, 0),
|
groupAssetsBy<int>(StoreKey.groupAssetsBy, 0),
|
||||||
showStorageIndicator<bool>(StoreKey.storageIndicator, true),
|
showStorageIndicator<bool>(StoreKey.storageIndicator, true),
|
||||||
|
|||||||
@@ -54,11 +54,7 @@ class Stack {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return id.hashCode ^
|
return id.hashCode ^ createdAt.hashCode ^ updatedAt.hashCode ^ ownerId.hashCode ^ primaryAssetId.hashCode;
|
||||||
createdAt.hashCode ^
|
|
||||||
updatedAt.hashCode ^
|
|
||||||
ownerId.hashCode ^
|
|
||||||
primaryAssetId.hashCode;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,9 +73,7 @@ class StackResponse {
|
|||||||
bool operator ==(covariant StackResponse other) {
|
bool operator ==(covariant StackResponse other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other.id == id &&
|
return other.id == id && other.primaryAssetId == primaryAssetId && other.assetIds == assetIds;
|
||||||
other.primaryAssetId == primaryAssetId &&
|
|
||||||
other.assetIds == assetIds;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:immich_mobile/domain/utils/event_stream.dart';
|
|||||||
enum GroupAssetsBy {
|
enum GroupAssetsBy {
|
||||||
day,
|
day,
|
||||||
month,
|
month,
|
||||||
|
auto,
|
||||||
none;
|
none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||||
|
|
||||||
// TODO: Rename to User once Isar is removed
|
// TODO: Remove UserDto once Isar is removed
|
||||||
class UserDto {
|
class UserDto {
|
||||||
final String id;
|
final String id;
|
||||||
final String email;
|
final String email;
|
||||||
@@ -44,19 +41,19 @@ class UserDto {
|
|||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return '''User: {
|
return '''User: {
|
||||||
id: $id,
|
id: $id,
|
||||||
email: $email,
|
email: $email,
|
||||||
name: $name,
|
name: $name,
|
||||||
isAdmin: $isAdmin,
|
isAdmin: $isAdmin,
|
||||||
updatedAt: $updatedAt,
|
updatedAt: $updatedAt,
|
||||||
profileImagePath: ${profileImagePath ?? '<NA>'},
|
profileImagePath: ${profileImagePath ?? '<NA>'},
|
||||||
avatarColor: $avatarColor,
|
avatarColor: $avatarColor,
|
||||||
memoryEnabled: $memoryEnabled,
|
memoryEnabled: $memoryEnabled,
|
||||||
inTimeline: $inTimeline,
|
inTimeline: $inTimeline,
|
||||||
isPartnerSharedBy: $isPartnerSharedBy,
|
isPartnerSharedBy: $isPartnerSharedBy,
|
||||||
isPartnerSharedWith: $isPartnerSharedWith,
|
isPartnerSharedWith: $isPartnerSharedWith,
|
||||||
quotaUsageInBytes: $quotaUsageInBytes,
|
quotaUsageInBytes: $quotaUsageInBytes,
|
||||||
quotaSizeInBytes: $quotaSizeInBytes,
|
quotaSizeInBytes: $quotaSizeInBytes,
|
||||||
}''';
|
}''';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,87 +124,229 @@ quotaSizeInBytes: $quotaSizeInBytes,
|
|||||||
quotaSizeInBytes.hashCode;
|
quotaSizeInBytes.hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PartnerUserDto {
|
class User {
|
||||||
final String id;
|
final String id;
|
||||||
final String email;
|
|
||||||
final String name;
|
final String name;
|
||||||
final bool inTimeline;
|
final String email;
|
||||||
|
final DateTime? deletedAt;
|
||||||
|
final AvatarColor? avatarColor;
|
||||||
|
|
||||||
final String? profileImagePath;
|
const User({
|
||||||
|
|
||||||
const PartnerUserDto({
|
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.email,
|
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.inTimeline,
|
required this.email,
|
||||||
this.profileImagePath,
|
this.deletedAt,
|
||||||
|
this.avatarColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
PartnerUserDto copyWith({
|
User copyWith({
|
||||||
String? id,
|
String? id,
|
||||||
String? email,
|
|
||||||
String? name,
|
String? name,
|
||||||
bool? inTimeline,
|
String? email,
|
||||||
String? profileImagePath,
|
DateTime? deletedAt,
|
||||||
|
AvatarColor? avatarColor,
|
||||||
}) {
|
}) {
|
||||||
return PartnerUserDto(
|
return User(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
email: email ?? this.email,
|
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
inTimeline: inTimeline ?? this.inTimeline,
|
email: email ?? this.email,
|
||||||
profileImagePath: profileImagePath ?? this.profileImagePath,
|
deletedAt: deletedAt ?? this.deletedAt,
|
||||||
|
avatarColor: avatarColor ?? this.avatarColor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return <String, dynamic>{
|
|
||||||
'id': id,
|
|
||||||
'email': email,
|
|
||||||
'name': name,
|
|
||||||
'inTimeline': inTimeline,
|
|
||||||
'profileImagePath': profileImagePath,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
factory PartnerUserDto.fromMap(Map<String, dynamic> map) {
|
|
||||||
return PartnerUserDto(
|
|
||||||
id: map['id'] as String,
|
|
||||||
email: map['email'] as String,
|
|
||||||
name: map['name'] as String,
|
|
||||||
inTimeline: map['inTimeline'] as bool,
|
|
||||||
profileImagePath: map['profileImagePath'] != null
|
|
||||||
? map['profileImagePath'] as String
|
|
||||||
: null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
|
||||||
|
|
||||||
factory PartnerUserDto.fromJson(String source) =>
|
|
||||||
PartnerUserDto.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PartnerUserDto(id: $id, email: $email, name: $name, inTimeline: $inTimeline, profileImagePath: $profileImagePath)';
|
return '''User {
|
||||||
|
id: $id,
|
||||||
|
name: $name,
|
||||||
|
email: $email,
|
||||||
|
deletedAt: ${deletedAt ?? "<NA>"},
|
||||||
|
avatarColor: ${avatarColor ?? "<NA>"},
|
||||||
|
}''';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(covariant PartnerUserDto other) {
|
bool operator ==(covariant User other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other.id == id &&
|
return other.id == id &&
|
||||||
other.email == email &&
|
|
||||||
other.name == name &&
|
other.name == name &&
|
||||||
other.inTimeline == inTimeline &&
|
other.email == email &&
|
||||||
other.profileImagePath == profileImagePath;
|
other.deletedAt == deletedAt &&
|
||||||
|
other.avatarColor == avatarColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return id.hashCode ^ name.hashCode ^ email.hashCode ^ deletedAt.hashCode ^ avatarColor.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AuthUser {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String email;
|
||||||
|
final DateTime? deletedAt;
|
||||||
|
final AvatarColor? avatarColor;
|
||||||
|
final bool isAdmin;
|
||||||
|
final String oauthId;
|
||||||
|
final String? pinCode;
|
||||||
|
final bool hasProfileImage;
|
||||||
|
final DateTime profileChangedAt;
|
||||||
|
final int? quotaSizeInBytes;
|
||||||
|
final int quotaUsageInBytes;
|
||||||
|
final String? storageLabel;
|
||||||
|
|
||||||
|
const AuthUser({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.email,
|
||||||
|
this.deletedAt,
|
||||||
|
this.avatarColor,
|
||||||
|
required this.isAdmin,
|
||||||
|
required this.oauthId,
|
||||||
|
this.pinCode,
|
||||||
|
required this.hasProfileImage,
|
||||||
|
required this.profileChangedAt,
|
||||||
|
this.quotaSizeInBytes,
|
||||||
|
required this.quotaUsageInBytes,
|
||||||
|
this.storageLabel,
|
||||||
|
});
|
||||||
|
|
||||||
|
AuthUser copyWith({
|
||||||
|
String? id,
|
||||||
|
String? name,
|
||||||
|
String? email,
|
||||||
|
DateTime? deletedAt,
|
||||||
|
AvatarColor? avatarColor,
|
||||||
|
bool? isAdmin,
|
||||||
|
String? oauthId,
|
||||||
|
String? pinCode,
|
||||||
|
bool? hasProfileImage,
|
||||||
|
DateTime? profileChangedAt,
|
||||||
|
int? quotaSizeInBytes,
|
||||||
|
int? quotaUsageInBytes,
|
||||||
|
String? storageLabel,
|
||||||
|
}) {
|
||||||
|
return AuthUser(
|
||||||
|
id: id ?? this.id,
|
||||||
|
name: name ?? this.name,
|
||||||
|
email: email ?? this.email,
|
||||||
|
deletedAt: deletedAt ?? this.deletedAt,
|
||||||
|
avatarColor: avatarColor ?? this.avatarColor,
|
||||||
|
isAdmin: isAdmin ?? this.isAdmin,
|
||||||
|
oauthId: oauthId ?? this.oauthId,
|
||||||
|
pinCode: pinCode ?? this.pinCode,
|
||||||
|
hasProfileImage: hasProfileImage ?? this.hasProfileImage,
|
||||||
|
profileChangedAt: profileChangedAt ?? this.profileChangedAt,
|
||||||
|
quotaSizeInBytes: quotaSizeInBytes ?? this.quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,
|
||||||
|
storageLabel: storageLabel ?? this.storageLabel,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '''AuthUser {
|
||||||
|
id: $id,
|
||||||
|
name: $name,
|
||||||
|
email: $email,
|
||||||
|
deletedAt: ${deletedAt ?? "<NA>"},
|
||||||
|
avatarColor: ${avatarColor ?? "<NA>"},
|
||||||
|
isAdmin: $isAdmin,
|
||||||
|
oauthId: $oauthId,
|
||||||
|
pinCode: ${pinCode ?? "<NA>"},
|
||||||
|
hasProfileImage: $hasProfileImage,
|
||||||
|
profileChangedAt: $profileChangedAt,
|
||||||
|
quotaSizeInBytes: ${quotaSizeInBytes ?? "<NA>"},
|
||||||
|
quotaUsageInBytes: $quotaUsageInBytes,
|
||||||
|
storageLabel: ${storageLabel ?? "<NA>"},
|
||||||
|
}''';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant AuthUser other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return other.id == id &&
|
||||||
|
other.name == name &&
|
||||||
|
other.email == email &&
|
||||||
|
other.deletedAt == deletedAt &&
|
||||||
|
other.avatarColor == avatarColor &&
|
||||||
|
other.isAdmin == isAdmin &&
|
||||||
|
other.oauthId == oauthId &&
|
||||||
|
other.pinCode == pinCode &&
|
||||||
|
other.hasProfileImage == hasProfileImage &&
|
||||||
|
other.profileChangedAt == profileChangedAt &&
|
||||||
|
other.quotaSizeInBytes == quotaSizeInBytes &&
|
||||||
|
other.quotaUsageInBytes == quotaUsageInBytes &&
|
||||||
|
other.storageLabel == storageLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return id.hashCode ^
|
return id.hashCode ^
|
||||||
email.hashCode ^
|
|
||||||
name.hashCode ^
|
name.hashCode ^
|
||||||
inTimeline.hashCode ^
|
email.hashCode ^
|
||||||
profileImagePath.hashCode;
|
deletedAt.hashCode ^
|
||||||
|
avatarColor.hashCode ^
|
||||||
|
isAdmin.hashCode ^
|
||||||
|
oauthId.hashCode ^
|
||||||
|
pinCode.hashCode ^
|
||||||
|
hasProfileImage.hashCode ^
|
||||||
|
profileChangedAt.hashCode ^
|
||||||
|
quotaSizeInBytes.hashCode ^
|
||||||
|
quotaUsageInBytes.hashCode ^
|
||||||
|
storageLabel.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PartnerUser {
|
||||||
|
final String id;
|
||||||
|
final String email;
|
||||||
|
final String name;
|
||||||
|
final bool inTimeline;
|
||||||
|
|
||||||
|
const PartnerUser({
|
||||||
|
required this.id,
|
||||||
|
required this.email,
|
||||||
|
required this.name,
|
||||||
|
required this.inTimeline,
|
||||||
|
});
|
||||||
|
|
||||||
|
PartnerUser copyWith({
|
||||||
|
String? id,
|
||||||
|
String? email,
|
||||||
|
String? name,
|
||||||
|
bool? inTimeline,
|
||||||
|
}) {
|
||||||
|
return PartnerUser(
|
||||||
|
id: id ?? this.id,
|
||||||
|
email: email ?? this.email,
|
||||||
|
name: name ?? this.name,
|
||||||
|
inTimeline: inTimeline ?? this.inTimeline,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '''PartnerUser {
|
||||||
|
id: $id,
|
||||||
|
email: $email,
|
||||||
|
name: $name,
|
||||||
|
inTimeline: $inTimeline,
|
||||||
|
}''';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant PartnerUser other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
|
return other.id == id && other.email == email && other.name == name && other.inTimeline == inTimeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return id.hashCode ^ email.hashCode ^ name.hashCode ^ inTimeline.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ enum AvatarColor {
|
|||||||
const AvatarColor(this.value);
|
const AvatarColor(this.value);
|
||||||
|
|
||||||
Color toColor({bool isDarkTheme = false}) => switch (this) {
|
Color toColor({bool isDarkTheme = false}) => switch (this) {
|
||||||
AvatarColor.primary =>
|
AvatarColor.primary => isDarkTheme ? const Color(0xFFABCBFA) : const Color(0xFF4250AF),
|
||||||
isDarkTheme ? const Color(0xFFABCBFA) : const Color(0xFF4250AF),
|
|
||||||
AvatarColor.pink => const Color.fromARGB(255, 244, 114, 182),
|
AvatarColor.pink => const Color.fromARGB(255, 244, 114, 182),
|
||||||
AvatarColor.red => const Color.fromARGB(255, 239, 68, 68),
|
AvatarColor.red => const Color.fromARGB(255, 239, 68, 68),
|
||||||
AvatarColor.yellow => const Color.fromARGB(255, 234, 179, 8),
|
AvatarColor.yellow => const Color.fromARGB(255, 234, 179, 8),
|
||||||
@@ -241,14 +240,11 @@ licenseKey: $licenseKey,
|
|||||||
bool operator ==(covariant License other) {
|
bool operator ==(covariant License other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return activatedAt == other.activatedAt &&
|
return activatedAt == other.activatedAt && activationKey == other.activationKey && licenseKey == other.licenseKey;
|
||||||
activationKey == other.activationKey &&
|
|
||||||
licenseKey == other.licenseKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => activatedAt.hashCode ^ activationKey.hashCode ^ licenseKey.hashCode;
|
||||||
activatedAt.hashCode ^ activationKey.hashCode ^ licenseKey.hashCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Model for a user metadata stored in the server
|
// Model for a user metadata stored in the server
|
||||||
@@ -310,10 +306,6 @@ license: ${license ?? "<NA>"},
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return userId.hashCode ^
|
return userId.hashCode ^ key.hashCode ^ onboarding.hashCode ^ preferences.hashCode ^ license.hashCode;
|
||||||
key.hashCode ^
|
|
||||||
onboarding.hashCode ^
|
|
||||||
preferences.hashCode ^
|
|
||||||
license.hashCode;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ class AssetService {
|
|||||||
|
|
||||||
Stream<BaseAsset?> watchAsset(BaseAsset asset) {
|
Stream<BaseAsset?> watchAsset(BaseAsset asset) {
|
||||||
final id = asset is LocalAsset ? asset.id : (asset as RemoteAsset).id;
|
final id = asset is LocalAsset ? asset.id : (asset as RemoteAsset).id;
|
||||||
return asset is LocalAsset
|
return asset is LocalAsset ? _localAssetRepository.watchAsset(id) : _remoteAssetRepository.watchAsset(id);
|
||||||
? _localAssetRepository.watchAsset(id)
|
|
||||||
: _remoteAssetRepository.watchAsset(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<RemoteAsset>> getStack(RemoteAsset asset) async {
|
Future<List<RemoteAsset>> getStack(RemoteAsset asset) async {
|
||||||
@@ -40,8 +38,7 @@ class AssetService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final id =
|
final id = asset is LocalAsset ? asset.remoteId! : (asset as RemoteAsset).id;
|
||||||
asset is LocalAsset ? asset.remoteId! : (asset as RemoteAsset).id;
|
|
||||||
return _remoteAssetRepository.getExif(id);
|
return _remoteAssetRepository.getExif(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +53,7 @@ class AssetService {
|
|||||||
width = exif?.width ?? asset.width?.toDouble();
|
width = exif?.width ?? asset.width?.toDouble();
|
||||||
height = exif?.height ?? asset.height?.toDouble();
|
height = exif?.height ?? asset.height?.toDouble();
|
||||||
} else if (asset is LocalAsset) {
|
} else if (asset is LocalAsset) {
|
||||||
isFlipped = _platform.isAndroid &&
|
isFlipped = _platform.isAndroid && (asset.orientation == 90 || asset.orientation == 270);
|
||||||
(asset.orientation == 90 || asset.orientation == 270);
|
|
||||||
width = asset.width?.toDouble();
|
width = asset.width?.toDouble();
|
||||||
height = asset.height?.toDouble();
|
height = asset.height?.toDouble();
|
||||||
} else {
|
} else {
|
||||||
@@ -78,10 +74,7 @@ class AssetService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<(int local, int remote)> getAssetCounts() async {
|
Future<(int local, int remote)> getAssetCounts() async {
|
||||||
return (
|
return (await _localAssetRepository.getCount(), await _remoteAssetRepository.getCount());
|
||||||
await _localAssetRepository.getCount(),
|
|
||||||
await _remoteAssetRepository.getCount()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getLocalHashedCount() {
|
Future<int> getLocalHashedCount() {
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ class HashService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
for (final album in localAlbums) {
|
for (final album in localAlbums) {
|
||||||
final assetsToHash =
|
final assetsToHash = await _localAlbumRepository.getAssetsToHash(album.id);
|
||||||
await _localAlbumRepository.getAssetsToHash(album.id);
|
|
||||||
if (assetsToHash.isNotEmpty) {
|
if (assetsToHash.isNotEmpty) {
|
||||||
await _hashAssets(assetsToHash);
|
await _hashAssets(assetsToHash);
|
||||||
}
|
}
|
||||||
@@ -88,8 +87,7 @@ class HashService {
|
|||||||
_log.fine("Hashing ${toHash.length} files");
|
_log.fine("Hashing ${toHash.length} files");
|
||||||
|
|
||||||
final hashed = <LocalAsset>[];
|
final hashed = <LocalAsset>[];
|
||||||
final hashes =
|
final hashes = await _nativeSyncApi.hashPaths(toHash.map((e) => e.path).toList());
|
||||||
await _nativeSyncApi.hashPaths(toHash.map((e) => e.path).toList());
|
|
||||||
assert(
|
assert(
|
||||||
hashes.length == toHash.length,
|
hashes.length == toHash.length,
|
||||||
"Hashes length does not match toHash length: ${hashes.length} != ${toHash.length}",
|
"Hashes length does not match toHash length: ${hashes.length} != ${toHash.length}",
|
||||||
|
|||||||
@@ -66,8 +66,7 @@ class LocalSyncService {
|
|||||||
// On iOS, we need to full sync albums that are marked as cloud as the delta sync
|
// On iOS, we need to full sync albums that are marked as cloud as the delta sync
|
||||||
// does not include changes for cloud albums. If ignoreIcloudAssets is enabled,
|
// does not include changes for cloud albums. If ignoreIcloudAssets is enabled,
|
||||||
// remove the albums from the local database from the previous sync
|
// remove the albums from the local database from the previous sync
|
||||||
final cloudAlbums =
|
final cloudAlbums = deviceAlbums.where((a) => a.isCloud).toLocalAlbums();
|
||||||
deviceAlbums.where((a) => a.isCloud).toLocalAlbums();
|
|
||||||
for (final album in cloudAlbums) {
|
for (final album in cloudAlbums) {
|
||||||
final dbAlbum = dbAlbums.firstWhereOrNull((a) => a.id == album.id);
|
final dbAlbum = dbAlbums.firstWhereOrNull((a) => a.id == album.id);
|
||||||
if (dbAlbum == null) {
|
if (dbAlbum == null) {
|
||||||
@@ -95,8 +94,7 @@ class LocalSyncService {
|
|||||||
final Stopwatch stopwatch = Stopwatch()..start();
|
final Stopwatch stopwatch = Stopwatch()..start();
|
||||||
|
|
||||||
final deviceAlbums = await _nativeSyncApi.getAlbums();
|
final deviceAlbums = await _nativeSyncApi.getAlbums();
|
||||||
final dbAlbums =
|
final dbAlbums = await _localAlbumRepository.getAll(sortBy: {SortLocalAlbumsBy.id});
|
||||||
await _localAlbumRepository.getAll(sortBy: {SortLocalAlbumsBy.id});
|
|
||||||
|
|
||||||
await diffSortedLists(
|
await diffSortedLists(
|
||||||
dbAlbums,
|
dbAlbums,
|
||||||
@@ -120,9 +118,7 @@ class LocalSyncService {
|
|||||||
try {
|
try {
|
||||||
_log.fine("Adding device album ${album.name}");
|
_log.fine("Adding device album ${album.name}");
|
||||||
|
|
||||||
final assets = album.assetCount > 0
|
final assets = album.assetCount > 0 ? await _nativeSyncApi.getAssetsForAlbum(album.id) : <PlatformAsset>[];
|
||||||
? await _nativeSyncApi.getAssetsForAlbum(album.id)
|
|
||||||
: <PlatformAsset>[];
|
|
||||||
|
|
||||||
await _localAlbumRepository.upsert(
|
await _localAlbumRepository.upsert(
|
||||||
album,
|
album,
|
||||||
@@ -188,10 +184,8 @@ class LocalSyncService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final updatedTime =
|
final updatedTime = (dbAlbum.updatedAt.millisecondsSinceEpoch ~/ 1000) + 1;
|
||||||
(dbAlbum.updatedAt.millisecondsSinceEpoch ~/ 1000) + 1;
|
final newAssetsCount = await _nativeSyncApi.getAssetsCountSince(deviceAlbum.id, updatedTime);
|
||||||
final newAssetsCount =
|
|
||||||
await _nativeSyncApi.getAssetsCountSince(deviceAlbum.id, updatedTime);
|
|
||||||
|
|
||||||
// Early return if no new assets were found
|
// Early return if no new assets were found
|
||||||
if (newAssetsCount == 0) {
|
if (newAssetsCount == 0) {
|
||||||
@@ -230,13 +224,9 @@ class LocalSyncService {
|
|||||||
Future<bool> fullDiff(LocalAlbum dbAlbum, LocalAlbum deviceAlbum) async {
|
Future<bool> fullDiff(LocalAlbum dbAlbum, LocalAlbum deviceAlbum) async {
|
||||||
try {
|
try {
|
||||||
final assetsInDevice = deviceAlbum.assetCount > 0
|
final assetsInDevice = deviceAlbum.assetCount > 0
|
||||||
? await _nativeSyncApi
|
? await _nativeSyncApi.getAssetsForAlbum(deviceAlbum.id).then((a) => a.toLocalAssets())
|
||||||
.getAssetsForAlbum(deviceAlbum.id)
|
|
||||||
.then((a) => a.toLocalAssets())
|
|
||||||
: <LocalAsset>[];
|
|
||||||
final assetsInDb = dbAlbum.assetCount > 0
|
|
||||||
? await _localAlbumRepository.getAssets(dbAlbum.id)
|
|
||||||
: <LocalAsset>[];
|
: <LocalAsset>[];
|
||||||
|
final assetsInDb = dbAlbum.assetCount > 0 ? await _localAlbumRepository.getAssets(dbAlbum.id) : <LocalAsset>[];
|
||||||
|
|
||||||
if (deviceAlbum.assetCount == 0) {
|
if (deviceAlbum.assetCount == 0) {
|
||||||
_log.fine(
|
_log.fine(
|
||||||
@@ -321,9 +311,7 @@ class LocalSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool _albumsEqual(LocalAlbum a, LocalAlbum b) {
|
bool _albumsEqual(LocalAlbum a, LocalAlbum b) {
|
||||||
return a.name == b.name &&
|
return a.name == b.name && a.assetCount == b.assetCount && a.updatedAt.isAtSameMomentAs(b.updatedAt);
|
||||||
a.assetCount == b.assetCount &&
|
|
||||||
a.updatedAt.isAtSameMomentAs(b.updatedAt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,9 +321,7 @@ extension on Iterable<PlatformAlbum> {
|
|||||||
(e) => LocalAlbum(
|
(e) => LocalAlbum(
|
||||||
id: e.id,
|
id: e.id,
|
||||||
name: e.name,
|
name: e.name,
|
||||||
updatedAt: e.updatedAt == null
|
updatedAt: e.updatedAt == null ? DateTime.now() : DateTime.fromMillisecondsSinceEpoch(e.updatedAt! * 1000),
|
||||||
? DateTime.now()
|
|
||||||
: DateTime.fromMillisecondsSinceEpoch(e.updatedAt! * 1000),
|
|
||||||
assetCount: e.assetCount,
|
assetCount: e.assetCount,
|
||||||
),
|
),
|
||||||
).toList();
|
).toList();
|
||||||
@@ -350,12 +336,8 @@ extension on Iterable<PlatformAsset> {
|
|||||||
name: e.name,
|
name: e.name,
|
||||||
checksum: null,
|
checksum: null,
|
||||||
type: AssetType.values.elementAtOrNull(e.type) ?? AssetType.other,
|
type: AssetType.values.elementAtOrNull(e.type) ?? AssetType.other,
|
||||||
createdAt: e.createdAt == null
|
createdAt: e.createdAt == null ? DateTime.now() : DateTime.fromMillisecondsSinceEpoch(e.createdAt! * 1000),
|
||||||
? DateTime.now()
|
updatedAt: e.updatedAt == null ? DateTime.now() : DateTime.fromMillisecondsSinceEpoch(e.updatedAt! * 1000),
|
||||||
: DateTime.fromMillisecondsSinceEpoch(e.createdAt! * 1000),
|
|
||||||
updatedAt: e.updatedAt == null
|
|
||||||
? DateTime.now()
|
|
||||||
: DateTime.fromMillisecondsSinceEpoch(e.updatedAt! * 1000),
|
|
||||||
width: e.width,
|
width: e.width,
|
||||||
height: e.height,
|
height: e.height,
|
||||||
durationInSeconds: e.durationInSeconds,
|
durationInSeconds: e.durationInSeconds,
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ class LogService {
|
|||||||
}) async {
|
}) async {
|
||||||
final instance = LogService._(logRepository, storeRepository, shouldBuffer);
|
final instance = LogService._(logRepository, storeRepository, shouldBuffer);
|
||||||
await logRepository.truncate(limit: kLogTruncateLimit);
|
await logRepository.truncate(limit: kLogTruncateLimit);
|
||||||
final level = await instance._storeRepository.tryGet(StoreKey.logLevel) ??
|
final level = await instance._storeRepository.tryGet(StoreKey.logLevel) ?? LogLevel.info.index;
|
||||||
LogLevel.info.index;
|
|
||||||
Logger.root.level = Level.LEVELS.elementAtOrNull(level) ?? Level.INFO;
|
Logger.root.level = Level.LEVELS.elementAtOrNull(level) ?? Level.INFO;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -146,9 +145,7 @@ class LoggerUnInitializedException implements Exception {
|
|||||||
|
|
||||||
/// Log levels according to dart logging [Level]
|
/// Log levels according to dart logging [Level]
|
||||||
extension LevelDomainToInfraExtension on Level {
|
extension LevelDomainToInfraExtension on Level {
|
||||||
LogLevel toLogLevel() =>
|
LogLevel toLogLevel() => LogLevel.values.elementAtOrNull(Level.LEVELS.indexOf(this)) ?? LogLevel.info;
|
||||||
LogLevel.values.elementAtOrNull(Level.LEVELS.indexOf(this)) ??
|
|
||||||
LogLevel.info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension on LogLevel {
|
extension on LogLevel {
|
||||||
|
|||||||
@@ -12,21 +12,19 @@ class DriftPartnerService {
|
|||||||
this._partnerApiRepository,
|
this._partnerApiRepository,
|
||||||
);
|
);
|
||||||
|
|
||||||
Future<List<PartnerUserDto>> getSharedWith(String userId) {
|
Future<List<PartnerUser>> getSharedWith(String userId) {
|
||||||
return _driftPartnerRepository.getSharedWith(userId);
|
return _driftPartnerRepository.getSharedWith(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<PartnerUserDto>> getSharedBy(String userId) {
|
Future<List<PartnerUser>> getSharedBy(String userId) {
|
||||||
return _driftPartnerRepository.getSharedBy(userId);
|
return _driftPartnerRepository.getSharedBy(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<PartnerUserDto>> getAvailablePartners(
|
Future<List<PartnerUser>> getAvailablePartners(
|
||||||
String currentUserId,
|
String currentUserId,
|
||||||
) async {
|
) async {
|
||||||
final otherUsers =
|
final otherUsers = await _driftPartnerRepository.getAvailablePartners(currentUserId);
|
||||||
await _driftPartnerRepository.getAvailablePartners(currentUserId);
|
final currentPartners = await _driftPartnerRepository.getSharedBy(currentUserId);
|
||||||
final currentPartners =
|
|
||||||
await _driftPartnerRepository.getSharedBy(currentUserId);
|
|
||||||
final available = otherUsers.where((user) {
|
final available = otherUsers.where((user) {
|
||||||
return !currentPartners.any((partner) => partner.id == user.id);
|
return !currentPartners.any((partner) => partner.id == user.id);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ class RemoteAlbumService {
|
|||||||
filtered = filtered
|
filtered = filtered
|
||||||
.where(
|
.where(
|
||||||
(album) =>
|
(album) =>
|
||||||
album.name.toLowerCase().contains(lowerQuery) ||
|
album.name.toLowerCase().contains(lowerQuery) || album.description.toLowerCase().contains(lowerQuery),
|
||||||
album.description.toLowerCase().contains(lowerQuery),
|
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
@@ -53,12 +52,10 @@ class RemoteAlbumService {
|
|||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
switch (filterMode) {
|
switch (filterMode) {
|
||||||
case QuickFilterMode.myAlbums:
|
case QuickFilterMode.myAlbums:
|
||||||
filtered =
|
filtered = filtered.where((album) => album.ownerId == userId).toList();
|
||||||
filtered.where((album) => album.ownerId == userId).toList();
|
|
||||||
break;
|
break;
|
||||||
case QuickFilterMode.sharedWithMe:
|
case QuickFilterMode.sharedWithMe:
|
||||||
filtered =
|
filtered = filtered.where((album) => album.ownerId != userId).toList();
|
||||||
filtered.where((album) => album.ownerId != userId).toList();
|
|
||||||
break;
|
break;
|
||||||
case QuickFilterMode.all:
|
case QuickFilterMode.all:
|
||||||
break;
|
break;
|
||||||
@@ -111,7 +108,7 @@ class RemoteAlbumService {
|
|||||||
return _repository.getDateRange(albumId);
|
return _repository.getDateRange(albumId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<UserDto>> getSharedUsers(String albumId) {
|
Future<List<User>> getSharedUsers(String albumId) {
|
||||||
return _repository.getSharedUsers(albumId);
|
return _repository.getSharedUsers(albumId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,11 @@ final AppSetting = SettingsService(storeService: StoreService.I);
|
|||||||
class SettingsService {
|
class SettingsService {
|
||||||
final StoreService _storeService;
|
final StoreService _storeService;
|
||||||
|
|
||||||
const SettingsService({required StoreService storeService})
|
const SettingsService({required StoreService storeService}) : _storeService = storeService;
|
||||||
: _storeService = storeService;
|
|
||||||
|
|
||||||
T get<T>(Setting<T> setting) =>
|
T get<T>(Setting<T> setting) => _storeService.get(setting.storeKey, setting.defaultValue);
|
||||||
_storeService.get(setting.storeKey, setting.defaultValue);
|
|
||||||
|
|
||||||
Future<void> set<T>(Setting<T> setting, T value) =>
|
Future<void> set<T>(Setting<T> setting, T value) => _storeService.put(setting.storeKey, value);
|
||||||
_storeService.put(setting.storeKey, value);
|
|
||||||
|
|
||||||
Stream<T> watch<T>(Setting<T> setting) => _storeService
|
Stream<T> watch<T>(Setting<T> setting) => _storeService.watch(setting.storeKey).map((v) => v ?? setting.defaultValue);
|
||||||
.watch(setting.storeKey)
|
|
||||||
.map((v) => v ?? setting.defaultValue);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ class StoreService {
|
|||||||
final Map<int, Object?> _cache = {};
|
final Map<int, Object?> _cache = {};
|
||||||
late final StreamSubscription<StoreDto> _storeUpdateSubscription;
|
late final StreamSubscription<StoreDto> _storeUpdateSubscription;
|
||||||
|
|
||||||
StoreService._({required IsarStoreRepository storeRepository})
|
StoreService._({required IsarStoreRepository storeRepository}) : _storeRepository = storeRepository;
|
||||||
: _storeRepository = storeRepository;
|
|
||||||
|
|
||||||
// TODO: Temporary typedef to make minimal changes. Remove this and make the presentation layer access store through a provider
|
// TODO: Temporary typedef to make minimal changes. Remove this and make the presentation layer access store through a provider
|
||||||
static StoreService? _instance;
|
static StoreService? _instance;
|
||||||
@@ -48,8 +47,7 @@ class StoreService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamSubscription<StoreDto> _listenForChange() =>
|
StreamSubscription<StoreDto> _listenForChange() => _storeRepository.watchAll().listen((event) {
|
||||||
_storeRepository.watchAll().listen((event) {
|
|
||||||
_cache[event.key.id] = event.value;
|
_cache[event.key.id] = event.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class SyncStreamService {
|
|||||||
bool get isCancelled => _cancelChecker?.call() ?? false;
|
bool get isCancelled => _cancelChecker?.call() ?? false;
|
||||||
|
|
||||||
Future<void> sync() {
|
Future<void> sync() {
|
||||||
_logger.info("Remote sync request for userr");
|
_logger.info("Remote sync request for user");
|
||||||
DLog.log("Remote sync request for user");
|
DLog.log("Remote sync request for user");
|
||||||
// Start the sync stream and handle events
|
// Start the sync stream and handle events
|
||||||
return _syncApiRepository.streamChanges(_handleEvents);
|
return _syncApiRepository.streamChanges(_handleEvents);
|
||||||
@@ -120,6 +120,8 @@ class SyncStreamService {
|
|||||||
) async {
|
) async {
|
||||||
_logger.fine("Processing sync data for $type of length ${data.length}");
|
_logger.fine("Processing sync data for $type of length ${data.length}");
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case SyncEntityType.authUserV1:
|
||||||
|
return _syncStreamRepository.updateAuthUsersV1(data.cast());
|
||||||
case SyncEntityType.userV1:
|
case SyncEntityType.userV1:
|
||||||
return _syncStreamRepository.updateUsersV1(data.cast());
|
return _syncStreamRepository.updateUsersV1(data.cast());
|
||||||
case SyncEntityType.userDeleteV1:
|
case SyncEntityType.userDeleteV1:
|
||||||
|
|||||||
@@ -33,11 +33,13 @@ class TimelineFactory {
|
|||||||
}) : _timelineRepository = timelineRepository,
|
}) : _timelineRepository = timelineRepository,
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
|
|
||||||
GroupAssetsBy get groupBy =>
|
GroupAssetsBy get groupBy {
|
||||||
GroupAssetsBy.values[_settingsService.get(Setting.groupAssetsBy)];
|
final group = GroupAssetsBy.values[_settingsService.get(Setting.groupAssetsBy)];
|
||||||
|
// We do not support auto grouping in the new timeline yet, fallback to day grouping
|
||||||
|
return group == GroupAssetsBy.auto ? GroupAssetsBy.day : group;
|
||||||
|
}
|
||||||
|
|
||||||
TimelineService main(List<String> timelineUsers) =>
|
TimelineService main(List<String> timelineUsers) => TimelineService(_timelineRepository.main(timelineUsers, groupBy));
|
||||||
TimelineService(_timelineRepository.main(timelineUsers, groupBy));
|
|
||||||
|
|
||||||
TimelineService localAlbum({required String albumId}) =>
|
TimelineService localAlbum({required String albumId}) =>
|
||||||
TimelineService(_timelineRepository.localAlbum(albumId, groupBy));
|
TimelineService(_timelineRepository.localAlbum(albumId, groupBy));
|
||||||
@@ -45,29 +47,21 @@ class TimelineFactory {
|
|||||||
TimelineService remoteAlbum({required String albumId}) =>
|
TimelineService remoteAlbum({required String albumId}) =>
|
||||||
TimelineService(_timelineRepository.remoteAlbum(albumId, groupBy));
|
TimelineService(_timelineRepository.remoteAlbum(albumId, groupBy));
|
||||||
|
|
||||||
TimelineService remoteAssets(String userId) =>
|
TimelineService remoteAssets(String userId) => TimelineService(_timelineRepository.remote(userId, groupBy));
|
||||||
TimelineService(_timelineRepository.remote(userId, groupBy));
|
|
||||||
|
|
||||||
TimelineService favorite(String userId) =>
|
TimelineService favorite(String userId) => TimelineService(_timelineRepository.favorite(userId, groupBy));
|
||||||
TimelineService(_timelineRepository.favorite(userId, groupBy));
|
|
||||||
|
|
||||||
TimelineService trash(String userId) =>
|
TimelineService trash(String userId) => TimelineService(_timelineRepository.trash(userId, groupBy));
|
||||||
TimelineService(_timelineRepository.trash(userId, groupBy));
|
|
||||||
|
|
||||||
TimelineService archive(String userId) =>
|
TimelineService archive(String userId) => TimelineService(_timelineRepository.archived(userId, groupBy));
|
||||||
TimelineService(_timelineRepository.archived(userId, groupBy));
|
|
||||||
|
|
||||||
TimelineService lockedFolder(String userId) =>
|
TimelineService lockedFolder(String userId) => TimelineService(_timelineRepository.locked(userId, groupBy));
|
||||||
TimelineService(_timelineRepository.locked(userId, groupBy));
|
|
||||||
|
|
||||||
TimelineService video(String userId) =>
|
TimelineService video(String userId) => TimelineService(_timelineRepository.video(userId, groupBy));
|
||||||
TimelineService(_timelineRepository.video(userId, groupBy));
|
|
||||||
|
|
||||||
TimelineService place(String place) =>
|
TimelineService place(String place) => TimelineService(_timelineRepository.place(place, groupBy));
|
||||||
TimelineService(_timelineRepository.place(place, groupBy));
|
|
||||||
|
|
||||||
TimelineService fromAssets(List<BaseAsset> assets) =>
|
TimelineService fromAssets(List<BaseAsset> assets) => TimelineService(_timelineRepository.fromAssets(assets));
|
||||||
TimelineService(_timelineRepository.fromAssets(assets));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimelineService {
|
class TimelineService {
|
||||||
@@ -94,8 +88,7 @@ class TimelineService {
|
|||||||
_bucketSource = bucketSource {
|
_bucketSource = bucketSource {
|
||||||
_bucketSubscription = _bucketSource().listen((buckets) {
|
_bucketSubscription = _bucketSource().listen((buckets) {
|
||||||
_mutex.run(() async {
|
_mutex.run(() async {
|
||||||
final totalAssets =
|
final totalAssets = buckets.fold<int>(0, (acc, bucket) => acc + bucket.assetCount);
|
||||||
buckets.fold<int>(0, (acc, bucket) => acc + bucket.assetCount);
|
|
||||||
|
|
||||||
if (totalAssets == 0) {
|
if (totalAssets == 0) {
|
||||||
_bufferOffset = 0;
|
_bufferOffset = 0;
|
||||||
@@ -128,8 +121,7 @@ class TimelineService {
|
|||||||
|
|
||||||
Stream<List<Bucket>> Function() get watchBuckets => _bucketSource;
|
Stream<List<Bucket>> Function() get watchBuckets => _bucketSource;
|
||||||
|
|
||||||
Future<List<BaseAsset>> loadAssets(int index, int count) =>
|
Future<List<BaseAsset>> loadAssets(int index, int count) => _mutex.run(() => _loadAssets(index, count));
|
||||||
_mutex.run(() => _loadAssets(index, count));
|
|
||||||
|
|
||||||
Future<List<BaseAsset>> _loadAssets(int index, int count) async {
|
Future<List<BaseAsset>> _loadAssets(int index, int count) async {
|
||||||
if (hasRange(index, count)) {
|
if (hasRange(index, count)) {
|
||||||
@@ -178,11 +170,9 @@ class TimelineService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pre-cache assets around the given index for asset viewer
|
// Pre-cache assets around the given index for asset viewer
|
||||||
Future<void> preCacheAssets(int index) =>
|
Future<void> preCacheAssets(int index) => _mutex.run(() => _loadAssets(index, math.min(5, _totalAssets - index)));
|
||||||
_mutex.run(() => _loadAssets(index, math.min(5, _totalAssets - index)));
|
|
||||||
|
|
||||||
BaseAsset getRandomAsset() =>
|
BaseAsset getRandomAsset() => _buffer.elementAt(math.Random().nextInt(_buffer.length));
|
||||||
_buffer.elementAt(math.Random().nextInt(_buffer.length));
|
|
||||||
|
|
||||||
BaseAsset getAsset(int index) {
|
BaseAsset getAsset(int index) {
|
||||||
if (!hasRange(index, 1)) {
|
if (!hasRange(index, 1)) {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:immich_mobile/domain/models/setting.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
|
import 'package:immich_mobile/domain/services/setting.service.dart';
|
||||||
import 'package:immich_mobile/domain/services/store.service.dart';
|
import 'package:immich_mobile/domain/services/store.service.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/user.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/user.repository.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/user_api.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/user_api.repository.dart';
|
||||||
@@ -66,3 +68,28 @@ class UserService {
|
|||||||
return _isarUserRepository.deleteAll();
|
return _isarUserRepository.deleteAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DriftUserService {
|
||||||
|
final DriftUserRepository _userRepository;
|
||||||
|
final SettingsService _settingsService;
|
||||||
|
|
||||||
|
const DriftUserService(
|
||||||
|
this._userRepository,
|
||||||
|
this._settingsService,
|
||||||
|
);
|
||||||
|
|
||||||
|
Future<User?> getMyUser() {
|
||||||
|
// TODO: Remove UserDto after new store
|
||||||
|
final isarCurrentUser = _settingsService.get(Setting.currentUser);
|
||||||
|
|
||||||
|
if (isarCurrentUser == null) {
|
||||||
|
throw Exception('User must be login');
|
||||||
|
}
|
||||||
|
|
||||||
|
return _userRepository.getById(isarCurrentUser.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<User>> getAll() {
|
||||||
|
return _userRepository.getAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -67,12 +67,10 @@ class BackgroundSyncManager {
|
|||||||
// captured by the closure passed to [runInIsolateGentle].
|
// captured by the closure passed to [runInIsolateGentle].
|
||||||
_deviceAlbumSyncTask = full
|
_deviceAlbumSyncTask = full
|
||||||
? runInIsolateGentle(
|
? runInIsolateGentle(
|
||||||
computation: (ref) =>
|
computation: (ref) => ref.read(localSyncServiceProvider).sync(full: true),
|
||||||
ref.read(localSyncServiceProvider).sync(full: true),
|
|
||||||
)
|
)
|
||||||
: runInIsolateGentle(
|
: runInIsolateGentle(
|
||||||
computation: (ref) =>
|
computation: (ref) => ref.read(localSyncServiceProvider).sync(full: false),
|
||||||
ref.read(localSyncServiceProvider).sync(full: false),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return _deviceAlbumSyncTask!.whenComplete(() {
|
return _deviceAlbumSyncTask!.whenComplete(() {
|
||||||
@@ -139,7 +137,5 @@ Cancelable<void> _handleWsAssetUploadReadyV1Batch(
|
|||||||
List<dynamic> batchData,
|
List<dynamic> batchData,
|
||||||
) =>
|
) =>
|
||||||
runInIsolateGentle(
|
runInIsolateGentle(
|
||||||
computation: (ref) => ref
|
computation: (ref) => ref.read(syncStreamServiceProvider).handleWsAssetUploadReadyV1Batch(batchData),
|
||||||
.read(syncStreamServiceProvider)
|
|
||||||
.handleWsAssetUploadReadyV1Batch(batchData),
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ class EventStream {
|
|||||||
|
|
||||||
static final EventStream shared = EventStream._();
|
static final EventStream shared = EventStream._();
|
||||||
|
|
||||||
final StreamController<Event> _controller =
|
final StreamController<Event> _controller = StreamController<Event>.broadcast();
|
||||||
StreamController<Event>.broadcast();
|
|
||||||
|
|
||||||
void emit(Event event) {
|
void emit(Event event) {
|
||||||
_controller.add(event);
|
_controller.add(event);
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ class Album {
|
|||||||
bool activityEnabled;
|
bool activityEnabled;
|
||||||
@enumerated
|
@enumerated
|
||||||
SortOrder sortOrder;
|
SortOrder sortOrder;
|
||||||
final IsarLink<User> owner = IsarLink<User>();
|
final IsarLink<IsarUser> owner = IsarLink<IsarUser>();
|
||||||
final IsarLink<Asset> thumbnail = IsarLink<Asset>();
|
final IsarLink<Asset> thumbnail = IsarLink<Asset>();
|
||||||
final IsarLinks<User> sharedUsers = IsarLinks<User>();
|
final IsarLinks<IsarUser> sharedUsers = IsarLinks<IsarUser>();
|
||||||
final IsarLinks<Asset> assets = IsarLinks<Asset>();
|
final IsarLinks<Asset> assets = IsarLinks<Asset>();
|
||||||
|
|
||||||
// transient fields
|
// transient fields
|
||||||
@@ -95,13 +95,11 @@ class Album {
|
|||||||
// accessible in an object freshly created (not loaded from DB)
|
// accessible in an object freshly created (not loaded from DB)
|
||||||
|
|
||||||
@ignore
|
@ignore
|
||||||
Iterable<User> get remoteUsers => sharedUsers.isEmpty
|
Iterable<IsarUser> get remoteUsers =>
|
||||||
? (sharedUsers as IsarLinksCommon<User>).addedObjects
|
sharedUsers.isEmpty ? (sharedUsers as IsarLinksCommon<IsarUser>).addedObjects : sharedUsers;
|
||||||
: sharedUsers;
|
|
||||||
|
|
||||||
@ignore
|
@ignore
|
||||||
Iterable<Asset> get remoteAssets =>
|
Iterable<Asset> get remoteAssets => assets.isEmpty ? (assets as IsarLinksCommon<Asset>).addedObjects : assets;
|
||||||
assets.isEmpty ? (assets as IsarLinksCommon<Asset>).addedObjects : assets;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(other) {
|
bool operator ==(other) {
|
||||||
@@ -162,35 +160,29 @@ class Album {
|
|||||||
activityEnabled: dto.isActivityEnabled,
|
activityEnabled: dto.isActivityEnabled,
|
||||||
);
|
);
|
||||||
a.remoteAssetCount = dto.assetCount;
|
a.remoteAssetCount = dto.assetCount;
|
||||||
a.owner.value = await db.users.getById(dto.ownerId);
|
a.owner.value = await db.isarUsers.getById(dto.ownerId);
|
||||||
if (dto.order != null) {
|
if (dto.order != null) {
|
||||||
a.sortOrder =
|
a.sortOrder = dto.order == AssetOrder.asc ? SortOrder.asc : SortOrder.desc;
|
||||||
dto.order == AssetOrder.asc ? SortOrder.asc : SortOrder.desc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dto.albumThumbnailAssetId != null) {
|
if (dto.albumThumbnailAssetId != null) {
|
||||||
a.thumbnail.value = await db.assets
|
a.thumbnail.value = await db.assets.where().remoteIdEqualTo(dto.albumThumbnailAssetId).findFirst();
|
||||||
.where()
|
|
||||||
.remoteIdEqualTo(dto.albumThumbnailAssetId)
|
|
||||||
.findFirst();
|
|
||||||
}
|
}
|
||||||
if (dto.albumUsers.isNotEmpty) {
|
if (dto.albumUsers.isNotEmpty) {
|
||||||
final users = await db.users.getAllById(
|
final users = await db.isarUsers.getAllById(
|
||||||
dto.albumUsers.map((e) => e.user.id).toList(growable: false),
|
dto.albumUsers.map((e) => e.user.id).toList(growable: false),
|
||||||
);
|
);
|
||||||
a.sharedUsers.addAll(users.cast());
|
a.sharedUsers.addAll(users.cast());
|
||||||
}
|
}
|
||||||
if (dto.assets.isNotEmpty) {
|
if (dto.assets.isNotEmpty) {
|
||||||
final assets =
|
final assets = await db.assets.getAllByRemoteId(dto.assets.map((e) => e.id));
|
||||||
await db.assets.getAllByRemoteId(dto.assets.map((e) => e.id));
|
|
||||||
a.assets.addAll(assets);
|
a.assets.addAll(assets);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() => 'remoteId: $remoteId name: $name description: $description';
|
||||||
'remoteId: $remoteId name: $name description: $description';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AssetsHelper on IsarCollection<Album> {
|
extension AssetsHelper on IsarCollection<Album> {
|
||||||
|
|||||||
13
mobile/lib/entities/album.entity.g.dart
generated
13
mobile/lib/entities/album.entity.g.dart
generated
@@ -116,7 +116,7 @@ const AlbumSchema = CollectionSchema(
|
|||||||
r'owner': LinkSchema(
|
r'owner': LinkSchema(
|
||||||
id: 8272576585804958029,
|
id: 8272576585804958029,
|
||||||
name: r'owner',
|
name: r'owner',
|
||||||
target: r'User',
|
target: r'IsarUser',
|
||||||
single: true,
|
single: true,
|
||||||
),
|
),
|
||||||
r'thumbnail': LinkSchema(
|
r'thumbnail': LinkSchema(
|
||||||
@@ -128,7 +128,7 @@ const AlbumSchema = CollectionSchema(
|
|||||||
r'sharedUsers': LinkSchema(
|
r'sharedUsers': LinkSchema(
|
||||||
id: 8972835302564625434,
|
id: 8972835302564625434,
|
||||||
name: r'sharedUsers',
|
name: r'sharedUsers',
|
||||||
target: r'User',
|
target: r'IsarUser',
|
||||||
single: false,
|
single: false,
|
||||||
),
|
),
|
||||||
r'assets': LinkSchema(
|
r'assets': LinkSchema(
|
||||||
@@ -275,10 +275,10 @@ List<IsarLinkBase<dynamic>> _albumGetLinks(Album object) {
|
|||||||
|
|
||||||
void _albumAttach(IsarCollection<dynamic> col, Id id, Album object) {
|
void _albumAttach(IsarCollection<dynamic> col, Id id, Album object) {
|
||||||
object.id = id;
|
object.id = id;
|
||||||
object.owner.attach(col, col.isar.collection<User>(), r'owner', id);
|
object.owner.attach(col, col.isar.collection<IsarUser>(), r'owner', id);
|
||||||
object.thumbnail.attach(col, col.isar.collection<Asset>(), r'thumbnail', id);
|
object.thumbnail.attach(col, col.isar.collection<Asset>(), r'thumbnail', id);
|
||||||
object.sharedUsers
|
object.sharedUsers
|
||||||
.attach(col, col.isar.collection<User>(), r'sharedUsers', id);
|
.attach(col, col.isar.collection<IsarUser>(), r'sharedUsers', id);
|
||||||
object.assets.attach(col, col.isar.collection<Asset>(), r'assets', id);
|
object.assets.attach(col, col.isar.collection<Asset>(), r'assets', id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1500,7 +1500,8 @@ extension AlbumQueryFilter on QueryBuilder<Album, Album, QFilterCondition> {
|
|||||||
extension AlbumQueryObject on QueryBuilder<Album, Album, QFilterCondition> {}
|
extension AlbumQueryObject on QueryBuilder<Album, Album, QFilterCondition> {}
|
||||||
|
|
||||||
extension AlbumQueryLinks on QueryBuilder<Album, Album, QFilterCondition> {
|
extension AlbumQueryLinks on QueryBuilder<Album, Album, QFilterCondition> {
|
||||||
QueryBuilder<Album, Album, QAfterFilterCondition> owner(FilterQuery<User> q) {
|
QueryBuilder<Album, Album, QAfterFilterCondition> owner(
|
||||||
|
FilterQuery<IsarUser> q) {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.link(q, r'owner');
|
return query.link(q, r'owner');
|
||||||
});
|
});
|
||||||
@@ -1526,7 +1527,7 @@ extension AlbumQueryLinks on QueryBuilder<Album, Album, QFilterCondition> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<Album, Album, QAfterFilterCondition> sharedUsers(
|
QueryBuilder<Album, Album, QAfterFilterCondition> sharedUsers(
|
||||||
FilterQuery<User> q) {
|
FilterQuery<IsarUser> q) {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.link(q, r'sharedUsers');
|
return query.link(q, r'sharedUsers');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import 'dart:io';
|
|||||||
import 'package:immich_mobile/constants/enums.dart';
|
import 'package:immich_mobile/constants/enums.dart';
|
||||||
import 'package:immich_mobile/domain/models/exif.model.dart';
|
import 'package:immich_mobile/domain/models/exif.model.dart';
|
||||||
import 'package:immich_mobile/extensions/string_extensions.dart';
|
import 'package:immich_mobile/extensions/string_extensions.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart'
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart' as entity;
|
||||||
as entity;
|
|
||||||
import 'package:immich_mobile/infrastructure/utils/exif.converter.dart';
|
import 'package:immich_mobile/infrastructure/utils/exif.converter.dart';
|
||||||
import 'package:immich_mobile/utils/diff.dart';
|
import 'package:immich_mobile/utils/diff.dart';
|
||||||
import 'package:immich_mobile/utils/hash.dart';
|
import 'package:immich_mobile/utils/hash.dart';
|
||||||
@@ -32,18 +31,14 @@ class Asset {
|
|||||||
width = remote.exifInfo?.exifImageWidth?.toInt(),
|
width = remote.exifInfo?.exifImageWidth?.toInt(),
|
||||||
livePhotoVideoId = remote.livePhotoVideoId,
|
livePhotoVideoId = remote.livePhotoVideoId,
|
||||||
ownerId = fastHash(remote.ownerId),
|
ownerId = fastHash(remote.ownerId),
|
||||||
exifInfo = remote.exifInfo == null
|
exifInfo = remote.exifInfo == null ? null : ExifDtoConverter.fromDto(remote.exifInfo!),
|
||||||
? null
|
|
||||||
: ExifDtoConverter.fromDto(remote.exifInfo!),
|
|
||||||
isFavorite = remote.isFavorite,
|
isFavorite = remote.isFavorite,
|
||||||
isArchived = remote.isArchived,
|
isArchived = remote.isArchived,
|
||||||
isTrashed = remote.isTrashed,
|
isTrashed = remote.isTrashed,
|
||||||
isOffline = remote.isOffline,
|
isOffline = remote.isOffline,
|
||||||
// workaround to nullify stackPrimaryAssetId for the parent asset until we refactor the mobile app
|
// workaround to nullify stackPrimaryAssetId for the parent asset until we refactor the mobile app
|
||||||
// stack handling to properly handle it
|
// stack handling to properly handle it
|
||||||
stackPrimaryAssetId = remote.stack?.primaryAssetId == remote.id
|
stackPrimaryAssetId = remote.stack?.primaryAssetId == remote.id ? null : remote.stack?.primaryAssetId,
|
||||||
? null
|
|
||||||
: remote.stack?.primaryAssetId,
|
|
||||||
stackCount = remote.stack?.assetCount ?? 0,
|
stackCount = remote.stack?.assetCount ?? 0,
|
||||||
stackId = remote.stack?.id,
|
stackId = remote.stack?.id,
|
||||||
thumbhash = remote.thumbhash,
|
thumbhash = remote.thumbhash,
|
||||||
@@ -108,8 +103,7 @@ class Asset {
|
|||||||
throw Exception('Asset $fileName has no local data');
|
throw Exception('Asset $fileName has no local data');
|
||||||
}
|
}
|
||||||
|
|
||||||
final updatedLocal =
|
final updatedLocal = _didUpdateLocal ? local : await local.obtainForNewProperties();
|
||||||
_didUpdateLocal ? local : await local.obtainForNewProperties();
|
|
||||||
if (updatedLocal == null) {
|
if (updatedLocal == null) {
|
||||||
throw Exception('Could not fetch local data for $fileName');
|
throw Exception('Could not fetch local data for $fileName');
|
||||||
}
|
}
|
||||||
@@ -185,10 +179,7 @@ class Asset {
|
|||||||
final orientatedWidth = this.orientatedWidth;
|
final orientatedWidth = this.orientatedWidth;
|
||||||
final orientatedHeight = this.orientatedHeight;
|
final orientatedHeight = this.orientatedHeight;
|
||||||
|
|
||||||
if (orientatedWidth != null &&
|
if (orientatedWidth != null && orientatedHeight != null && orientatedWidth > 0 && orientatedHeight > 0) {
|
||||||
orientatedHeight != null &&
|
|
||||||
orientatedWidth > 0 &&
|
|
||||||
orientatedHeight > 0) {
|
|
||||||
return orientatedWidth.toDouble() / orientatedHeight.toDouble();
|
return orientatedWidth.toDouble() / orientatedHeight.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,8 +380,7 @@ class Asset {
|
|||||||
// workaround to nullify stackPrimaryAssetId for the parent asset until we refactor the mobile app
|
// workaround to nullify stackPrimaryAssetId for the parent asset until we refactor the mobile app
|
||||||
// stack handling to properly handle it
|
// stack handling to properly handle it
|
||||||
stackId: stackId,
|
stackId: stackId,
|
||||||
stackPrimaryAssetId:
|
stackPrimaryAssetId: stackPrimaryAssetId == remoteId ? null : stackPrimaryAssetId,
|
||||||
stackPrimaryAssetId == remoteId ? null : stackPrimaryAssetId,
|
|
||||||
stackCount: stackCount,
|
stackCount: stackCount,
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
isArchived: isArchived,
|
isArchived: isArchived,
|
||||||
@@ -410,9 +400,7 @@ class Asset {
|
|||||||
// workaround to nullify stackPrimaryAssetId for the parent asset until we refactor the mobile app
|
// workaround to nullify stackPrimaryAssetId for the parent asset until we refactor the mobile app
|
||||||
// stack handling to properly handle it
|
// stack handling to properly handle it
|
||||||
stackId: a.stackId,
|
stackId: a.stackId,
|
||||||
stackPrimaryAssetId: a.stackPrimaryAssetId == a.remoteId
|
stackPrimaryAssetId: a.stackPrimaryAssetId == a.remoteId ? null : a.stackPrimaryAssetId,
|
||||||
? null
|
|
||||||
: a.stackPrimaryAssetId,
|
|
||||||
stackCount: a.stackCount,
|
stackCount: a.stackCount,
|
||||||
// isFavorite + isArchived are not set by device-only assets
|
// isFavorite + isArchived are not set by device-only assets
|
||||||
isFavorite: a.isFavorite,
|
isFavorite: a.isFavorite,
|
||||||
@@ -428,8 +416,7 @@ class Asset {
|
|||||||
localId: localId ?? a.localId,
|
localId: localId ?? a.localId,
|
||||||
width: width ?? a.width,
|
width: width ?? a.width,
|
||||||
height: height ?? a.height,
|
height: height ?? a.height,
|
||||||
exifInfo: exifInfo ??
|
exifInfo: exifInfo ?? a.exifInfo?.copyWith(assetId: id), // updated to use assetId
|
||||||
a.exifInfo?.copyWith(assetId: id), // updated to use assetId
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -491,18 +478,15 @@ class Asset {
|
|||||||
Future<void> put(Isar db) async {
|
Future<void> put(Isar db) async {
|
||||||
await db.assets.put(this);
|
await db.assets.put(this);
|
||||||
if (exifInfo != null) {
|
if (exifInfo != null) {
|
||||||
await db.exifInfos
|
await db.exifInfos.put(entity.ExifInfo.fromDto(exifInfo!.copyWith(assetId: id)));
|
||||||
.put(entity.ExifInfo.fromDto(exifInfo!.copyWith(assetId: id)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compareById(Asset a, Asset b) => a.id.compareTo(b.id);
|
static int compareById(Asset a, Asset b) => a.id.compareTo(b.id);
|
||||||
|
|
||||||
static int compareByLocalId(Asset a, Asset b) =>
|
static int compareByLocalId(Asset a, Asset b) => compareToNullable(a.localId, b.localId);
|
||||||
compareToNullable(a.localId, b.localId);
|
|
||||||
|
|
||||||
static int compareByChecksum(Asset a, Asset b) =>
|
static int compareByChecksum(Asset a, Asset b) => a.checksum.compareTo(b.checksum);
|
||||||
a.checksum.compareTo(b.checksum);
|
|
||||||
|
|
||||||
static int compareByOwnerChecksum(Asset a, Asset b) {
|
static int compareByOwnerChecksum(Asset a, Asset b) {
|
||||||
final int ownerIdOrder = a.ownerId.compareTo(b.ownerId);
|
final int ownerIdOrder = a.ownerId.compareTo(b.ownerId);
|
||||||
@@ -589,16 +573,11 @@ enum AssetState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension AssetsHelper on IsarCollection<Asset> {
|
extension AssetsHelper on IsarCollection<Asset> {
|
||||||
Future<int> deleteAllByRemoteId(Iterable<String> ids) =>
|
Future<int> deleteAllByRemoteId(Iterable<String> ids) => ids.isEmpty ? Future.value(0) : remote(ids).deleteAll();
|
||||||
ids.isEmpty ? Future.value(0) : remote(ids).deleteAll();
|
Future<int> deleteAllByLocalId(Iterable<String> ids) => ids.isEmpty ? Future.value(0) : local(ids).deleteAll();
|
||||||
Future<int> deleteAllByLocalId(Iterable<String> ids) =>
|
Future<List<Asset>> getAllByRemoteId(Iterable<String> ids) => ids.isEmpty ? Future.value([]) : remote(ids).findAll();
|
||||||
ids.isEmpty ? Future.value(0) : local(ids).deleteAll();
|
Future<List<Asset>> getAllByLocalId(Iterable<String> ids) => ids.isEmpty ? Future.value([]) : local(ids).findAll();
|
||||||
Future<List<Asset>> getAllByRemoteId(Iterable<String> ids) =>
|
Future<Asset?> getByRemoteId(String id) => where().remoteIdEqualTo(id).findFirst();
|
||||||
ids.isEmpty ? Future.value([]) : remote(ids).findAll();
|
|
||||||
Future<List<Asset>> getAllByLocalId(Iterable<String> ids) =>
|
|
||||||
ids.isEmpty ? Future.value([]) : local(ids).findAll();
|
|
||||||
Future<Asset?> getByRemoteId(String id) =>
|
|
||||||
where().remoteIdEqualTo(id).findFirst();
|
|
||||||
|
|
||||||
QueryBuilder<Asset, Asset, QAfterWhereClause> remote(
|
QueryBuilder<Asset, Asset, QAfterWhereClause> remote(
|
||||||
Iterable<String> ids,
|
Iterable<String> ids,
|
||||||
|
|||||||
@@ -22,15 +22,13 @@ extension LogOnError<T> on AsyncValue<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
return onLoading?.call() ??
|
return onLoading?.call() ?? const Center(child: ImmichLoadingIndicator());
|
||||||
const Center(child: ImmichLoadingIndicator());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasError && !hasValue) {
|
if (hasError && !hasValue) {
|
||||||
_asyncErrorLogger.severe('Could not load value', error, stackTrace);
|
_asyncErrorLogger.severe('Could not load value', error, stackTrace);
|
||||||
return onError?.call(error, stackTrace) ??
|
return onError?.call(error, stackTrace) ?? ScaffoldErrorBody(errorMsg: error?.toString());
|
||||||
ScaffoldErrorBody(errorMsg: error?.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return onData(requireValue);
|
return onData(requireValue);
|
||||||
|
|||||||
@@ -60,6 +60,5 @@ extension ContextHelper on BuildContext {
|
|||||||
FocusScopeNode get focusScope => FocusScope.of(this);
|
FocusScopeNode get focusScope => FocusScope.of(this);
|
||||||
|
|
||||||
// Show SnackBars from the current context
|
// Show SnackBars from the current context
|
||||||
void showSnackBar(SnackBar snackBar) =>
|
void showSnackBar(SnackBar snackBar) => ScaffoldMessenger.of(this).showSnackBar(snackBar);
|
||||||
ScaffoldMessenger.of(this).showSnackBar(snackBar);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ extension DateRangeFormatting on DateTime {
|
|||||||
final localeString = locale?.toString() ?? 'en_US';
|
final localeString = locale?.toString() ?? 'en_US';
|
||||||
|
|
||||||
// Check if it's a single date (same day)
|
// Check if it's a single date (same day)
|
||||||
if (startDate.year == endDate.year &&
|
if (startDate.year == endDate.year && startDate.month == endDate.month && startDate.day == endDate.day) {
|
||||||
startDate.month == endDate.month &&
|
|
||||||
startDate.day == endDate.day) {
|
|
||||||
if (startDate.year == currentYear) {
|
if (startDate.year == currentYear) {
|
||||||
// Single date of this year: "Aug 28"
|
// Single date of this year: "Aug 28"
|
||||||
return DateFormat.MMMd(localeString).format(startDate);
|
return DateFormat.MMMd(localeString).format(startDate);
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ extension DurationExtension on String {
|
|||||||
/// Parses and returns the string of format HH:MM:SS as a duration object else null
|
/// Parses and returns the string of format HH:MM:SS as a duration object else null
|
||||||
Duration? toDuration() {
|
Duration? toDuration() {
|
||||||
try {
|
try {
|
||||||
final parts = split(':')
|
final parts = split(':').map((e) => double.parse(e).toInt()).toList(growable: false);
|
||||||
.map((e) => double.parse(e).toInt())
|
|
||||||
.toList(growable: false);
|
|
||||||
return Duration(hours: parts[0], minutes: parts[1], seconds: parts[2]);
|
return Duration(hours: parts[0], minutes: parts[1], seconds: parts[2]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
extension ImmichColorSchemeExtensions on ColorScheme {
|
extension ImmichColorSchemeExtensions on ColorScheme {
|
||||||
bool get _isDarkMode => brightness == Brightness.dark;
|
bool get _isDarkMode => brightness == Brightness.dark;
|
||||||
Color get onSurfaceSecondary => _isDarkMode
|
Color get onSurfaceSecondary => _isDarkMode ? onSurface.darken(amount: .3) : onSurface.lighten(amount: .3);
|
||||||
? onSurface.darken(amount: .3)
|
|
||||||
: onSurface.lighten(amount: .3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ColorExtensions on Color {
|
extension ColorExtensions on Color {
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ String _translateHelper(
|
|||||||
try {
|
try {
|
||||||
final translatedMessage = key.tr(context: context);
|
final translatedMessage = key.tr(context: context);
|
||||||
return args != null
|
return args != null
|
||||||
? MessageFormat(translatedMessage, locale: Intl.defaultLocale ?? 'en')
|
? MessageFormat(translatedMessage, locale: Intl.defaultLocale ?? 'en').format(args)
|
||||||
.format(args)
|
|
||||||
: translatedMessage;
|
: translatedMessage;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('Translation failed for key "$key". Error: $e');
|
debugPrint('Translation failed for key "$key". Error: $e');
|
||||||
|
|||||||
@@ -8,12 +8,9 @@ class AssetFaceEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
|
|
||||||
TextColumn get assetId =>
|
TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get personId => text()
|
TextColumn get personId => text().nullable().references(PersonEntity, #id, onDelete: KeyAction.setNull)();
|
||||||
.nullable()
|
|
||||||
.references(PersonEntity, #id, onDelete: KeyAction.setNull)();
|
|
||||||
|
|
||||||
IntColumn get imageWidth => integer()();
|
IntColumn get imageWidth => integer()();
|
||||||
|
|
||||||
|
|||||||
56
mobile/lib/infrastructure/entities/auth_user.entity.dart
Normal file
56
mobile/lib/infrastructure/entities/auth_user.entity.dart
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
|
|
||||||
|
class AuthUserEntity extends Table with DriftDefaultsMixin {
|
||||||
|
const AuthUserEntity();
|
||||||
|
|
||||||
|
TextColumn get id => text()();
|
||||||
|
|
||||||
|
TextColumn get name => text()();
|
||||||
|
|
||||||
|
TextColumn get email => text()();
|
||||||
|
|
||||||
|
DateTimeColumn get deletedAt => dateTime().nullable()();
|
||||||
|
|
||||||
|
IntColumn get avatarColor => intEnum<AvatarColor>().nullable()();
|
||||||
|
|
||||||
|
BoolColumn get isAdmin => boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
|
TextColumn get oauthId => text().withDefault(const Constant(''))();
|
||||||
|
|
||||||
|
TextColumn get pinCode => text().nullable()();
|
||||||
|
|
||||||
|
BoolColumn get hasProfileImage => boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
|
DateTimeColumn get profileChangedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
|
IntColumn get quotaSizeInBytes => integer().nullable()();
|
||||||
|
|
||||||
|
IntColumn get quotaUsageInBytes => integer().withDefault(const Constant(0))();
|
||||||
|
|
||||||
|
TextColumn get storageLabel => text().nullable()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column> get primaryKey => {id};
|
||||||
|
}
|
||||||
|
|
||||||
|
extension AuthUserEntityDataDomainEx on AuthUserEntityData {
|
||||||
|
AuthUser toDto() => AuthUser(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
email: email,
|
||||||
|
deletedAt: deletedAt,
|
||||||
|
avatarColor: avatarColor,
|
||||||
|
isAdmin: isAdmin,
|
||||||
|
oauthId: oauthId,
|
||||||
|
pinCode: pinCode,
|
||||||
|
hasProfileImage: hasProfileImage,
|
||||||
|
profileChangedAt: profileChangedAt,
|
||||||
|
quotaSizeInBytes: quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: quotaUsageInBytes,
|
||||||
|
storageLabel: storageLabel,
|
||||||
|
);
|
||||||
|
}
|
||||||
951
mobile/lib/infrastructure/entities/auth_user.entity.drift.dart
generated
Normal file
951
mobile/lib/infrastructure/entities/auth_user.entity.drift.dart
generated
Normal file
@@ -0,0 +1,951 @@
|
|||||||
|
// dart format width=80
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
import 'package:drift/drift.dart' as i0;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart'
|
||||||
|
as i1;
|
||||||
|
import 'package:immich_mobile/domain/models/user_metadata.model.dart' as i2;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.dart'
|
||||||
|
as i3;
|
||||||
|
import 'package:drift/src/runtime/query_builder/query_builder.dart' as i4;
|
||||||
|
|
||||||
|
typedef $$AuthUserEntityTableCreateCompanionBuilder = i1.AuthUserEntityCompanion
|
||||||
|
Function({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
required String email,
|
||||||
|
i0.Value<DateTime?> deletedAt,
|
||||||
|
i0.Value<i2.AvatarColor?> avatarColor,
|
||||||
|
i0.Value<bool> isAdmin,
|
||||||
|
i0.Value<String> oauthId,
|
||||||
|
i0.Value<String?> pinCode,
|
||||||
|
i0.Value<bool> hasProfileImage,
|
||||||
|
i0.Value<DateTime> profileChangedAt,
|
||||||
|
i0.Value<int?> quotaSizeInBytes,
|
||||||
|
i0.Value<int> quotaUsageInBytes,
|
||||||
|
i0.Value<String?> storageLabel,
|
||||||
|
});
|
||||||
|
typedef $$AuthUserEntityTableUpdateCompanionBuilder = i1.AuthUserEntityCompanion
|
||||||
|
Function({
|
||||||
|
i0.Value<String> id,
|
||||||
|
i0.Value<String> name,
|
||||||
|
i0.Value<String> email,
|
||||||
|
i0.Value<DateTime?> deletedAt,
|
||||||
|
i0.Value<i2.AvatarColor?> avatarColor,
|
||||||
|
i0.Value<bool> isAdmin,
|
||||||
|
i0.Value<String> oauthId,
|
||||||
|
i0.Value<String?> pinCode,
|
||||||
|
i0.Value<bool> hasProfileImage,
|
||||||
|
i0.Value<DateTime> profileChangedAt,
|
||||||
|
i0.Value<int?> quotaSizeInBytes,
|
||||||
|
i0.Value<int> quotaUsageInBytes,
|
||||||
|
i0.Value<String?> storageLabel,
|
||||||
|
});
|
||||||
|
|
||||||
|
class $$AuthUserEntityTableFilterComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$AuthUserEntityTable> {
|
||||||
|
$$AuthUserEntityTableFilterComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.ColumnFilters<String> get id => $composableBuilder(
|
||||||
|
column: $table.id, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<String> get name => $composableBuilder(
|
||||||
|
column: $table.name, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<String> get email => $composableBuilder(
|
||||||
|
column: $table.email, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
||||||
|
column: $table.deletedAt, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnWithTypeConverterFilters<i2.AvatarColor?, i2.AvatarColor, int>
|
||||||
|
get avatarColor => $composableBuilder(
|
||||||
|
column: $table.avatarColor,
|
||||||
|
builder: (column) => i0.ColumnWithTypeConverterFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<bool> get isAdmin => $composableBuilder(
|
||||||
|
column: $table.isAdmin, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<String> get oauthId => $composableBuilder(
|
||||||
|
column: $table.oauthId, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<String> get pinCode => $composableBuilder(
|
||||||
|
column: $table.pinCode, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<bool> get hasProfileImage => $composableBuilder(
|
||||||
|
column: $table.hasProfileImage,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<DateTime> get profileChangedAt => $composableBuilder(
|
||||||
|
column: $table.profileChangedAt,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<int> get quotaSizeInBytes => $composableBuilder(
|
||||||
|
column: $table.quotaSizeInBytes,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<int> get quotaUsageInBytes => $composableBuilder(
|
||||||
|
column: $table.quotaUsageInBytes,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<String> get storageLabel => $composableBuilder(
|
||||||
|
column: $table.storageLabel,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$AuthUserEntityTableOrderingComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$AuthUserEntityTable> {
|
||||||
|
$$AuthUserEntityTableOrderingComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.ColumnOrderings<String> get id => $composableBuilder(
|
||||||
|
column: $table.id, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<String> get name => $composableBuilder(
|
||||||
|
column: $table.name, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<String> get email => $composableBuilder(
|
||||||
|
column: $table.email, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
||||||
|
column: $table.deletedAt,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<int> get avatarColor => $composableBuilder(
|
||||||
|
column: $table.avatarColor,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<bool> get isAdmin => $composableBuilder(
|
||||||
|
column: $table.isAdmin, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<String> get oauthId => $composableBuilder(
|
||||||
|
column: $table.oauthId, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<String> get pinCode => $composableBuilder(
|
||||||
|
column: $table.pinCode, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<bool> get hasProfileImage => $composableBuilder(
|
||||||
|
column: $table.hasProfileImage,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<DateTime> get profileChangedAt => $composableBuilder(
|
||||||
|
column: $table.profileChangedAt,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<int> get quotaSizeInBytes => $composableBuilder(
|
||||||
|
column: $table.quotaSizeInBytes,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<int> get quotaUsageInBytes => $composableBuilder(
|
||||||
|
column: $table.quotaUsageInBytes,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<String> get storageLabel => $composableBuilder(
|
||||||
|
column: $table.storageLabel,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$AuthUserEntityTableAnnotationComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$AuthUserEntityTable> {
|
||||||
|
$$AuthUserEntityTableAnnotationComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.GeneratedColumn<String> get id =>
|
||||||
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<String> get name =>
|
||||||
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<String> get email =>
|
||||||
|
$composableBuilder(column: $table.email, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<DateTime> get deletedAt =>
|
||||||
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumnWithTypeConverter<i2.AvatarColor?, int> get avatarColor =>
|
||||||
|
$composableBuilder(
|
||||||
|
column: $table.avatarColor, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<bool> get isAdmin =>
|
||||||
|
$composableBuilder(column: $table.isAdmin, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<String> get oauthId =>
|
||||||
|
$composableBuilder(column: $table.oauthId, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<String> get pinCode =>
|
||||||
|
$composableBuilder(column: $table.pinCode, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<bool> get hasProfileImage => $composableBuilder(
|
||||||
|
column: $table.hasProfileImage, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<DateTime> get profileChangedAt => $composableBuilder(
|
||||||
|
column: $table.profileChangedAt, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<int> get quotaSizeInBytes => $composableBuilder(
|
||||||
|
column: $table.quotaSizeInBytes, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<int> get quotaUsageInBytes => $composableBuilder(
|
||||||
|
column: $table.quotaUsageInBytes, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<String> get storageLabel => $composableBuilder(
|
||||||
|
column: $table.storageLabel, builder: (column) => column);
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$AuthUserEntityTableTableManager extends i0.RootTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$AuthUserEntityTable,
|
||||||
|
i1.AuthUserEntityData,
|
||||||
|
i1.$$AuthUserEntityTableFilterComposer,
|
||||||
|
i1.$$AuthUserEntityTableOrderingComposer,
|
||||||
|
i1.$$AuthUserEntityTableAnnotationComposer,
|
||||||
|
$$AuthUserEntityTableCreateCompanionBuilder,
|
||||||
|
$$AuthUserEntityTableUpdateCompanionBuilder,
|
||||||
|
(
|
||||||
|
i1.AuthUserEntityData,
|
||||||
|
i0.BaseReferences<i0.GeneratedDatabase, i1.$AuthUserEntityTable,
|
||||||
|
i1.AuthUserEntityData>
|
||||||
|
),
|
||||||
|
i1.AuthUserEntityData,
|
||||||
|
i0.PrefetchHooks Function()> {
|
||||||
|
$$AuthUserEntityTableTableManager(
|
||||||
|
i0.GeneratedDatabase db, i1.$AuthUserEntityTable table)
|
||||||
|
: super(i0.TableManagerState(
|
||||||
|
db: db,
|
||||||
|
table: table,
|
||||||
|
createFilteringComposer: () =>
|
||||||
|
i1.$$AuthUserEntityTableFilterComposer($db: db, $table: table),
|
||||||
|
createOrderingComposer: () =>
|
||||||
|
i1.$$AuthUserEntityTableOrderingComposer($db: db, $table: table),
|
||||||
|
createComputedFieldComposer: () => i1
|
||||||
|
.$$AuthUserEntityTableAnnotationComposer($db: db, $table: table),
|
||||||
|
updateCompanionCallback: ({
|
||||||
|
i0.Value<String> id = const i0.Value.absent(),
|
||||||
|
i0.Value<String> name = const i0.Value.absent(),
|
||||||
|
i0.Value<String> email = const i0.Value.absent(),
|
||||||
|
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||||
|
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent(),
|
||||||
|
i0.Value<bool> isAdmin = const i0.Value.absent(),
|
||||||
|
i0.Value<String> oauthId = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> pinCode = const i0.Value.absent(),
|
||||||
|
i0.Value<bool> hasProfileImage = const i0.Value.absent(),
|
||||||
|
i0.Value<DateTime> profileChangedAt = const i0.Value.absent(),
|
||||||
|
i0.Value<int?> quotaSizeInBytes = const i0.Value.absent(),
|
||||||
|
i0.Value<int> quotaUsageInBytes = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> storageLabel = const i0.Value.absent(),
|
||||||
|
}) =>
|
||||||
|
i1.AuthUserEntityCompanion(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
email: email,
|
||||||
|
deletedAt: deletedAt,
|
||||||
|
avatarColor: avatarColor,
|
||||||
|
isAdmin: isAdmin,
|
||||||
|
oauthId: oauthId,
|
||||||
|
pinCode: pinCode,
|
||||||
|
hasProfileImage: hasProfileImage,
|
||||||
|
profileChangedAt: profileChangedAt,
|
||||||
|
quotaSizeInBytes: quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: quotaUsageInBytes,
|
||||||
|
storageLabel: storageLabel,
|
||||||
|
),
|
||||||
|
createCompanionCallback: ({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
required String email,
|
||||||
|
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||||
|
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent(),
|
||||||
|
i0.Value<bool> isAdmin = const i0.Value.absent(),
|
||||||
|
i0.Value<String> oauthId = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> pinCode = const i0.Value.absent(),
|
||||||
|
i0.Value<bool> hasProfileImage = const i0.Value.absent(),
|
||||||
|
i0.Value<DateTime> profileChangedAt = const i0.Value.absent(),
|
||||||
|
i0.Value<int?> quotaSizeInBytes = const i0.Value.absent(),
|
||||||
|
i0.Value<int> quotaUsageInBytes = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> storageLabel = const i0.Value.absent(),
|
||||||
|
}) =>
|
||||||
|
i1.AuthUserEntityCompanion.insert(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
email: email,
|
||||||
|
deletedAt: deletedAt,
|
||||||
|
avatarColor: avatarColor,
|
||||||
|
isAdmin: isAdmin,
|
||||||
|
oauthId: oauthId,
|
||||||
|
pinCode: pinCode,
|
||||||
|
hasProfileImage: hasProfileImage,
|
||||||
|
profileChangedAt: profileChangedAt,
|
||||||
|
quotaSizeInBytes: quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: quotaUsageInBytes,
|
||||||
|
storageLabel: storageLabel,
|
||||||
|
),
|
||||||
|
withReferenceMapper: (p0) => p0
|
||||||
|
.map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))
|
||||||
|
.toList(),
|
||||||
|
prefetchHooksCallback: null,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef $$AuthUserEntityTableProcessedTableManager = i0.ProcessedTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$AuthUserEntityTable,
|
||||||
|
i1.AuthUserEntityData,
|
||||||
|
i1.$$AuthUserEntityTableFilterComposer,
|
||||||
|
i1.$$AuthUserEntityTableOrderingComposer,
|
||||||
|
i1.$$AuthUserEntityTableAnnotationComposer,
|
||||||
|
$$AuthUserEntityTableCreateCompanionBuilder,
|
||||||
|
$$AuthUserEntityTableUpdateCompanionBuilder,
|
||||||
|
(
|
||||||
|
i1.AuthUserEntityData,
|
||||||
|
i0.BaseReferences<i0.GeneratedDatabase, i1.$AuthUserEntityTable,
|
||||||
|
i1.AuthUserEntityData>
|
||||||
|
),
|
||||||
|
i1.AuthUserEntityData,
|
||||||
|
i0.PrefetchHooks Function()>;
|
||||||
|
|
||||||
|
class $AuthUserEntityTable extends i3.AuthUserEntity
|
||||||
|
with i0.TableInfo<$AuthUserEntityTable, i1.AuthUserEntityData> {
|
||||||
|
@override
|
||||||
|
final i0.GeneratedDatabase attachedDatabase;
|
||||||
|
final String? _alias;
|
||||||
|
$AuthUserEntityTable(this.attachedDatabase, [this._alias]);
|
||||||
|
static const i0.VerificationMeta _idMeta = const i0.VerificationMeta('id');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> id = i0.GeneratedColumn<String>(
|
||||||
|
'id', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
||||||
|
static const i0.VerificationMeta _nameMeta =
|
||||||
|
const i0.VerificationMeta('name');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> name = i0.GeneratedColumn<String>(
|
||||||
|
'name', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
||||||
|
static const i0.VerificationMeta _emailMeta =
|
||||||
|
const i0.VerificationMeta('email');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> email = i0.GeneratedColumn<String>(
|
||||||
|
'email', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
||||||
|
static const i0.VerificationMeta _deletedAtMeta =
|
||||||
|
const i0.VerificationMeta('deletedAt');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<DateTime> deletedAt =
|
||||||
|
i0.GeneratedColumn<DateTime>('deleted_at', aliasedName, true,
|
||||||
|
type: i0.DriftSqlType.dateTime, requiredDuringInsert: false);
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumnWithTypeConverter<i2.AvatarColor?, int>
|
||||||
|
avatarColor = i0.GeneratedColumn<int>('avatar_color', aliasedName, true,
|
||||||
|
type: i0.DriftSqlType.int, requiredDuringInsert: false)
|
||||||
|
.withConverter<i2.AvatarColor?>(
|
||||||
|
i1.$AuthUserEntityTable.$converteravatarColorn);
|
||||||
|
static const i0.VerificationMeta _isAdminMeta =
|
||||||
|
const i0.VerificationMeta('isAdmin');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<bool> isAdmin = i0.GeneratedColumn<bool>(
|
||||||
|
'is_admin', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.bool,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultConstraints:
|
||||||
|
i0.GeneratedColumn.constraintIsAlways('CHECK ("is_admin" IN (0, 1))'),
|
||||||
|
defaultValue: const i4.Constant(false));
|
||||||
|
static const i0.VerificationMeta _oauthIdMeta =
|
||||||
|
const i0.VerificationMeta('oauthId');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> oauthId = i0.GeneratedColumn<String>(
|
||||||
|
'oauth_id', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultValue: const i4.Constant(''));
|
||||||
|
static const i0.VerificationMeta _pinCodeMeta =
|
||||||
|
const i0.VerificationMeta('pinCode');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> pinCode = i0.GeneratedColumn<String>(
|
||||||
|
'pin_code', aliasedName, true,
|
||||||
|
type: i0.DriftSqlType.string, requiredDuringInsert: false);
|
||||||
|
static const i0.VerificationMeta _hasProfileImageMeta =
|
||||||
|
const i0.VerificationMeta('hasProfileImage');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<bool> hasProfileImage =
|
||||||
|
i0.GeneratedColumn<bool>('has_profile_image', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.bool,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'CHECK ("has_profile_image" IN (0, 1))'),
|
||||||
|
defaultValue: const i4.Constant(false));
|
||||||
|
static const i0.VerificationMeta _profileChangedAtMeta =
|
||||||
|
const i0.VerificationMeta('profileChangedAt');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<DateTime> profileChangedAt =
|
||||||
|
i0.GeneratedColumn<DateTime>('profile_changed_at', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.dateTime,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultValue: i4.currentDateAndTime);
|
||||||
|
static const i0.VerificationMeta _quotaSizeInBytesMeta =
|
||||||
|
const i0.VerificationMeta('quotaSizeInBytes');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<int> quotaSizeInBytes = i0.GeneratedColumn<int>(
|
||||||
|
'quota_size_in_bytes', aliasedName, true,
|
||||||
|
type: i0.DriftSqlType.int, requiredDuringInsert: false);
|
||||||
|
static const i0.VerificationMeta _quotaUsageInBytesMeta =
|
||||||
|
const i0.VerificationMeta('quotaUsageInBytes');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<int> quotaUsageInBytes =
|
||||||
|
i0.GeneratedColumn<int>('quota_usage_in_bytes', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.int,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultValue: const i4.Constant(0));
|
||||||
|
static const i0.VerificationMeta _storageLabelMeta =
|
||||||
|
const i0.VerificationMeta('storageLabel');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> storageLabel =
|
||||||
|
i0.GeneratedColumn<String>('storage_label', aliasedName, true,
|
||||||
|
type: i0.DriftSqlType.string, requiredDuringInsert: false);
|
||||||
|
@override
|
||||||
|
List<i0.GeneratedColumn> get $columns => [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
email,
|
||||||
|
deletedAt,
|
||||||
|
avatarColor,
|
||||||
|
isAdmin,
|
||||||
|
oauthId,
|
||||||
|
pinCode,
|
||||||
|
hasProfileImage,
|
||||||
|
profileChangedAt,
|
||||||
|
quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes,
|
||||||
|
storageLabel
|
||||||
|
];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
|
@override
|
||||||
|
String get actualTableName => $name;
|
||||||
|
static const String $name = 'auth_user_entity';
|
||||||
|
@override
|
||||||
|
i0.VerificationContext validateIntegrity(
|
||||||
|
i0.Insertable<i1.AuthUserEntityData> instance,
|
||||||
|
{bool isInserting = false}) {
|
||||||
|
final context = i0.VerificationContext();
|
||||||
|
final data = instance.toColumns(true);
|
||||||
|
if (data.containsKey('id')) {
|
||||||
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_idMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('name')) {
|
||||||
|
context.handle(
|
||||||
|
_nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_nameMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('email')) {
|
||||||
|
context.handle(
|
||||||
|
_emailMeta, email.isAcceptableOrUnknown(data['email']!, _emailMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_emailMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('deleted_at')) {
|
||||||
|
context.handle(_deletedAtMeta,
|
||||||
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('is_admin')) {
|
||||||
|
context.handle(_isAdminMeta,
|
||||||
|
isAdmin.isAcceptableOrUnknown(data['is_admin']!, _isAdminMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('oauth_id')) {
|
||||||
|
context.handle(_oauthIdMeta,
|
||||||
|
oauthId.isAcceptableOrUnknown(data['oauth_id']!, _oauthIdMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('pin_code')) {
|
||||||
|
context.handle(_pinCodeMeta,
|
||||||
|
pinCode.isAcceptableOrUnknown(data['pin_code']!, _pinCodeMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('has_profile_image')) {
|
||||||
|
context.handle(
|
||||||
|
_hasProfileImageMeta,
|
||||||
|
hasProfileImage.isAcceptableOrUnknown(
|
||||||
|
data['has_profile_image']!, _hasProfileImageMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('profile_changed_at')) {
|
||||||
|
context.handle(
|
||||||
|
_profileChangedAtMeta,
|
||||||
|
profileChangedAt.isAcceptableOrUnknown(
|
||||||
|
data['profile_changed_at']!, _profileChangedAtMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('quota_size_in_bytes')) {
|
||||||
|
context.handle(
|
||||||
|
_quotaSizeInBytesMeta,
|
||||||
|
quotaSizeInBytes.isAcceptableOrUnknown(
|
||||||
|
data['quota_size_in_bytes']!, _quotaSizeInBytesMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('quota_usage_in_bytes')) {
|
||||||
|
context.handle(
|
||||||
|
_quotaUsageInBytesMeta,
|
||||||
|
quotaUsageInBytes.isAcceptableOrUnknown(
|
||||||
|
data['quota_usage_in_bytes']!, _quotaUsageInBytesMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('storage_label')) {
|
||||||
|
context.handle(
|
||||||
|
_storageLabelMeta,
|
||||||
|
storageLabel.isAcceptableOrUnknown(
|
||||||
|
data['storage_label']!, _storageLabelMeta));
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<i0.GeneratedColumn> get $primaryKey => {id};
|
||||||
|
@override
|
||||||
|
i1.AuthUserEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
return i1.AuthUserEntityData(
|
||||||
|
id: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
email: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}email'])!,
|
||||||
|
deletedAt: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.dateTime, data['${effectivePrefix}deleted_at']),
|
||||||
|
avatarColor: i1.$AuthUserEntityTable.$converteravatarColorn.fromSql(
|
||||||
|
attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.int, data['${effectivePrefix}avatar_color'])),
|
||||||
|
isAdmin: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.bool, data['${effectivePrefix}is_admin'])!,
|
||||||
|
oauthId: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}oauth_id'])!,
|
||||||
|
pinCode: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}pin_code']),
|
||||||
|
hasProfileImage: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.bool, data['${effectivePrefix}has_profile_image'])!,
|
||||||
|
profileChangedAt: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.dateTime,
|
||||||
|
data['${effectivePrefix}profile_changed_at'])!,
|
||||||
|
quotaSizeInBytes: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.int, data['${effectivePrefix}quota_size_in_bytes']),
|
||||||
|
quotaUsageInBytes: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.int, data['${effectivePrefix}quota_usage_in_bytes'])!,
|
||||||
|
storageLabel: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.string, data['${effectivePrefix}storage_label']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
$AuthUserEntityTable createAlias(String alias) {
|
||||||
|
return $AuthUserEntityTable(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
static i0.JsonTypeConverter2<i2.AvatarColor, int, int> $converteravatarColor =
|
||||||
|
const i0.EnumIndexConverter<i2.AvatarColor>(i2.AvatarColor.values);
|
||||||
|
static i0.JsonTypeConverter2<i2.AvatarColor?, int?, int?>
|
||||||
|
$converteravatarColorn =
|
||||||
|
i0.JsonTypeConverter2.asNullable($converteravatarColor);
|
||||||
|
@override
|
||||||
|
bool get withoutRowId => true;
|
||||||
|
@override
|
||||||
|
bool get isStrict => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AuthUserEntityData extends i0.DataClass
|
||||||
|
implements i0.Insertable<i1.AuthUserEntityData> {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String email;
|
||||||
|
final DateTime? deletedAt;
|
||||||
|
final i2.AvatarColor? avatarColor;
|
||||||
|
final bool isAdmin;
|
||||||
|
final String oauthId;
|
||||||
|
final String? pinCode;
|
||||||
|
final bool hasProfileImage;
|
||||||
|
final DateTime profileChangedAt;
|
||||||
|
final int? quotaSizeInBytes;
|
||||||
|
final int quotaUsageInBytes;
|
||||||
|
final String? storageLabel;
|
||||||
|
const AuthUserEntityData(
|
||||||
|
{required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.email,
|
||||||
|
this.deletedAt,
|
||||||
|
this.avatarColor,
|
||||||
|
required this.isAdmin,
|
||||||
|
required this.oauthId,
|
||||||
|
this.pinCode,
|
||||||
|
required this.hasProfileImage,
|
||||||
|
required this.profileChangedAt,
|
||||||
|
this.quotaSizeInBytes,
|
||||||
|
required this.quotaUsageInBytes,
|
||||||
|
this.storageLabel});
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
map['id'] = i0.Variable<String>(id);
|
||||||
|
map['name'] = i0.Variable<String>(name);
|
||||||
|
map['email'] = i0.Variable<String>(email);
|
||||||
|
if (!nullToAbsent || deletedAt != null) {
|
||||||
|
map['deleted_at'] = i0.Variable<DateTime>(deletedAt);
|
||||||
|
}
|
||||||
|
if (!nullToAbsent || avatarColor != null) {
|
||||||
|
map['avatar_color'] = i0.Variable<int>(
|
||||||
|
i1.$AuthUserEntityTable.$converteravatarColorn.toSql(avatarColor));
|
||||||
|
}
|
||||||
|
map['is_admin'] = i0.Variable<bool>(isAdmin);
|
||||||
|
map['oauth_id'] = i0.Variable<String>(oauthId);
|
||||||
|
if (!nullToAbsent || pinCode != null) {
|
||||||
|
map['pin_code'] = i0.Variable<String>(pinCode);
|
||||||
|
}
|
||||||
|
map['has_profile_image'] = i0.Variable<bool>(hasProfileImage);
|
||||||
|
map['profile_changed_at'] = i0.Variable<DateTime>(profileChangedAt);
|
||||||
|
if (!nullToAbsent || quotaSizeInBytes != null) {
|
||||||
|
map['quota_size_in_bytes'] = i0.Variable<int>(quotaSizeInBytes);
|
||||||
|
}
|
||||||
|
map['quota_usage_in_bytes'] = i0.Variable<int>(quotaUsageInBytes);
|
||||||
|
if (!nullToAbsent || storageLabel != null) {
|
||||||
|
map['storage_label'] = i0.Variable<String>(storageLabel);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory AuthUserEntityData.fromJson(Map<String, dynamic> json,
|
||||||
|
{i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return AuthUserEntityData(
|
||||||
|
id: serializer.fromJson<String>(json['id']),
|
||||||
|
name: serializer.fromJson<String>(json['name']),
|
||||||
|
email: serializer.fromJson<String>(json['email']),
|
||||||
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
||||||
|
avatarColor: i1.$AuthUserEntityTable.$converteravatarColorn
|
||||||
|
.fromJson(serializer.fromJson<int?>(json['avatarColor'])),
|
||||||
|
isAdmin: serializer.fromJson<bool>(json['isAdmin']),
|
||||||
|
oauthId: serializer.fromJson<String>(json['oauthId']),
|
||||||
|
pinCode: serializer.fromJson<String?>(json['pinCode']),
|
||||||
|
hasProfileImage: serializer.fromJson<bool>(json['hasProfileImage']),
|
||||||
|
profileChangedAt: serializer.fromJson<DateTime>(json['profileChangedAt']),
|
||||||
|
quotaSizeInBytes: serializer.fromJson<int?>(json['quotaSizeInBytes']),
|
||||||
|
quotaUsageInBytes: serializer.fromJson<int>(json['quotaUsageInBytes']),
|
||||||
|
storageLabel: serializer.fromJson<String?>(json['storageLabel']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return <String, dynamic>{
|
||||||
|
'id': serializer.toJson<String>(id),
|
||||||
|
'name': serializer.toJson<String>(name),
|
||||||
|
'email': serializer.toJson<String>(email),
|
||||||
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
||||||
|
'avatarColor': serializer.toJson<int?>(
|
||||||
|
i1.$AuthUserEntityTable.$converteravatarColorn.toJson(avatarColor)),
|
||||||
|
'isAdmin': serializer.toJson<bool>(isAdmin),
|
||||||
|
'oauthId': serializer.toJson<String>(oauthId),
|
||||||
|
'pinCode': serializer.toJson<String?>(pinCode),
|
||||||
|
'hasProfileImage': serializer.toJson<bool>(hasProfileImage),
|
||||||
|
'profileChangedAt': serializer.toJson<DateTime>(profileChangedAt),
|
||||||
|
'quotaSizeInBytes': serializer.toJson<int?>(quotaSizeInBytes),
|
||||||
|
'quotaUsageInBytes': serializer.toJson<int>(quotaUsageInBytes),
|
||||||
|
'storageLabel': serializer.toJson<String?>(storageLabel),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.AuthUserEntityData copyWith(
|
||||||
|
{String? id,
|
||||||
|
String? name,
|
||||||
|
String? email,
|
||||||
|
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||||
|
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent(),
|
||||||
|
bool? isAdmin,
|
||||||
|
String? oauthId,
|
||||||
|
i0.Value<String?> pinCode = const i0.Value.absent(),
|
||||||
|
bool? hasProfileImage,
|
||||||
|
DateTime? profileChangedAt,
|
||||||
|
i0.Value<int?> quotaSizeInBytes = const i0.Value.absent(),
|
||||||
|
int? quotaUsageInBytes,
|
||||||
|
i0.Value<String?> storageLabel = const i0.Value.absent()}) =>
|
||||||
|
i1.AuthUserEntityData(
|
||||||
|
id: id ?? this.id,
|
||||||
|
name: name ?? this.name,
|
||||||
|
email: email ?? this.email,
|
||||||
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
||||||
|
avatarColor: avatarColor.present ? avatarColor.value : this.avatarColor,
|
||||||
|
isAdmin: isAdmin ?? this.isAdmin,
|
||||||
|
oauthId: oauthId ?? this.oauthId,
|
||||||
|
pinCode: pinCode.present ? pinCode.value : this.pinCode,
|
||||||
|
hasProfileImage: hasProfileImage ?? this.hasProfileImage,
|
||||||
|
profileChangedAt: profileChangedAt ?? this.profileChangedAt,
|
||||||
|
quotaSizeInBytes: quotaSizeInBytes.present
|
||||||
|
? quotaSizeInBytes.value
|
||||||
|
: this.quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,
|
||||||
|
storageLabel:
|
||||||
|
storageLabel.present ? storageLabel.value : this.storageLabel,
|
||||||
|
);
|
||||||
|
AuthUserEntityData copyWithCompanion(i1.AuthUserEntityCompanion data) {
|
||||||
|
return AuthUserEntityData(
|
||||||
|
id: data.id.present ? data.id.value : this.id,
|
||||||
|
name: data.name.present ? data.name.value : this.name,
|
||||||
|
email: data.email.present ? data.email.value : this.email,
|
||||||
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
||||||
|
avatarColor:
|
||||||
|
data.avatarColor.present ? data.avatarColor.value : this.avatarColor,
|
||||||
|
isAdmin: data.isAdmin.present ? data.isAdmin.value : this.isAdmin,
|
||||||
|
oauthId: data.oauthId.present ? data.oauthId.value : this.oauthId,
|
||||||
|
pinCode: data.pinCode.present ? data.pinCode.value : this.pinCode,
|
||||||
|
hasProfileImage: data.hasProfileImage.present
|
||||||
|
? data.hasProfileImage.value
|
||||||
|
: this.hasProfileImage,
|
||||||
|
profileChangedAt: data.profileChangedAt.present
|
||||||
|
? data.profileChangedAt.value
|
||||||
|
: this.profileChangedAt,
|
||||||
|
quotaSizeInBytes: data.quotaSizeInBytes.present
|
||||||
|
? data.quotaSizeInBytes.value
|
||||||
|
: this.quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: data.quotaUsageInBytes.present
|
||||||
|
? data.quotaUsageInBytes.value
|
||||||
|
: this.quotaUsageInBytes,
|
||||||
|
storageLabel: data.storageLabel.present
|
||||||
|
? data.storageLabel.value
|
||||||
|
: this.storageLabel,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('AuthUserEntityData(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('name: $name, ')
|
||||||
|
..write('email: $email, ')
|
||||||
|
..write('deletedAt: $deletedAt, ')
|
||||||
|
..write('avatarColor: $avatarColor, ')
|
||||||
|
..write('isAdmin: $isAdmin, ')
|
||||||
|
..write('oauthId: $oauthId, ')
|
||||||
|
..write('pinCode: $pinCode, ')
|
||||||
|
..write('hasProfileImage: $hasProfileImage, ')
|
||||||
|
..write('profileChangedAt: $profileChangedAt, ')
|
||||||
|
..write('quotaSizeInBytes: $quotaSizeInBytes, ')
|
||||||
|
..write('quotaUsageInBytes: $quotaUsageInBytes, ')
|
||||||
|
..write('storageLabel: $storageLabel')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
email,
|
||||||
|
deletedAt,
|
||||||
|
avatarColor,
|
||||||
|
isAdmin,
|
||||||
|
oauthId,
|
||||||
|
pinCode,
|
||||||
|
hasProfileImage,
|
||||||
|
profileChangedAt,
|
||||||
|
quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes,
|
||||||
|
storageLabel);
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is i1.AuthUserEntityData &&
|
||||||
|
other.id == this.id &&
|
||||||
|
other.name == this.name &&
|
||||||
|
other.email == this.email &&
|
||||||
|
other.deletedAt == this.deletedAt &&
|
||||||
|
other.avatarColor == this.avatarColor &&
|
||||||
|
other.isAdmin == this.isAdmin &&
|
||||||
|
other.oauthId == this.oauthId &&
|
||||||
|
other.pinCode == this.pinCode &&
|
||||||
|
other.hasProfileImage == this.hasProfileImage &&
|
||||||
|
other.profileChangedAt == this.profileChangedAt &&
|
||||||
|
other.quotaSizeInBytes == this.quotaSizeInBytes &&
|
||||||
|
other.quotaUsageInBytes == this.quotaUsageInBytes &&
|
||||||
|
other.storageLabel == this.storageLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
class AuthUserEntityCompanion
|
||||||
|
extends i0.UpdateCompanion<i1.AuthUserEntityData> {
|
||||||
|
final i0.Value<String> id;
|
||||||
|
final i0.Value<String> name;
|
||||||
|
final i0.Value<String> email;
|
||||||
|
final i0.Value<DateTime?> deletedAt;
|
||||||
|
final i0.Value<i2.AvatarColor?> avatarColor;
|
||||||
|
final i0.Value<bool> isAdmin;
|
||||||
|
final i0.Value<String> oauthId;
|
||||||
|
final i0.Value<String?> pinCode;
|
||||||
|
final i0.Value<bool> hasProfileImage;
|
||||||
|
final i0.Value<DateTime> profileChangedAt;
|
||||||
|
final i0.Value<int?> quotaSizeInBytes;
|
||||||
|
final i0.Value<int> quotaUsageInBytes;
|
||||||
|
final i0.Value<String?> storageLabel;
|
||||||
|
const AuthUserEntityCompanion({
|
||||||
|
this.id = const i0.Value.absent(),
|
||||||
|
this.name = const i0.Value.absent(),
|
||||||
|
this.email = const i0.Value.absent(),
|
||||||
|
this.deletedAt = const i0.Value.absent(),
|
||||||
|
this.avatarColor = const i0.Value.absent(),
|
||||||
|
this.isAdmin = const i0.Value.absent(),
|
||||||
|
this.oauthId = const i0.Value.absent(),
|
||||||
|
this.pinCode = const i0.Value.absent(),
|
||||||
|
this.hasProfileImage = const i0.Value.absent(),
|
||||||
|
this.profileChangedAt = const i0.Value.absent(),
|
||||||
|
this.quotaSizeInBytes = const i0.Value.absent(),
|
||||||
|
this.quotaUsageInBytes = const i0.Value.absent(),
|
||||||
|
this.storageLabel = const i0.Value.absent(),
|
||||||
|
});
|
||||||
|
AuthUserEntityCompanion.insert({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
required String email,
|
||||||
|
this.deletedAt = const i0.Value.absent(),
|
||||||
|
this.avatarColor = const i0.Value.absent(),
|
||||||
|
this.isAdmin = const i0.Value.absent(),
|
||||||
|
this.oauthId = const i0.Value.absent(),
|
||||||
|
this.pinCode = const i0.Value.absent(),
|
||||||
|
this.hasProfileImage = const i0.Value.absent(),
|
||||||
|
this.profileChangedAt = const i0.Value.absent(),
|
||||||
|
this.quotaSizeInBytes = const i0.Value.absent(),
|
||||||
|
this.quotaUsageInBytes = const i0.Value.absent(),
|
||||||
|
this.storageLabel = const i0.Value.absent(),
|
||||||
|
}) : id = i0.Value(id),
|
||||||
|
name = i0.Value(name),
|
||||||
|
email = i0.Value(email);
|
||||||
|
static i0.Insertable<i1.AuthUserEntityData> custom({
|
||||||
|
i0.Expression<String>? id,
|
||||||
|
i0.Expression<String>? name,
|
||||||
|
i0.Expression<String>? email,
|
||||||
|
i0.Expression<DateTime>? deletedAt,
|
||||||
|
i0.Expression<int>? avatarColor,
|
||||||
|
i0.Expression<bool>? isAdmin,
|
||||||
|
i0.Expression<String>? oauthId,
|
||||||
|
i0.Expression<String>? pinCode,
|
||||||
|
i0.Expression<bool>? hasProfileImage,
|
||||||
|
i0.Expression<DateTime>? profileChangedAt,
|
||||||
|
i0.Expression<int>? quotaSizeInBytes,
|
||||||
|
i0.Expression<int>? quotaUsageInBytes,
|
||||||
|
i0.Expression<String>? storageLabel,
|
||||||
|
}) {
|
||||||
|
return i0.RawValuesInsertable({
|
||||||
|
if (id != null) 'id': id,
|
||||||
|
if (name != null) 'name': name,
|
||||||
|
if (email != null) 'email': email,
|
||||||
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
||||||
|
if (avatarColor != null) 'avatar_color': avatarColor,
|
||||||
|
if (isAdmin != null) 'is_admin': isAdmin,
|
||||||
|
if (oauthId != null) 'oauth_id': oauthId,
|
||||||
|
if (pinCode != null) 'pin_code': pinCode,
|
||||||
|
if (hasProfileImage != null) 'has_profile_image': hasProfileImage,
|
||||||
|
if (profileChangedAt != null) 'profile_changed_at': profileChangedAt,
|
||||||
|
if (quotaSizeInBytes != null) 'quota_size_in_bytes': quotaSizeInBytes,
|
||||||
|
if (quotaUsageInBytes != null) 'quota_usage_in_bytes': quotaUsageInBytes,
|
||||||
|
if (storageLabel != null) 'storage_label': storageLabel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.AuthUserEntityCompanion copyWith(
|
||||||
|
{i0.Value<String>? id,
|
||||||
|
i0.Value<String>? name,
|
||||||
|
i0.Value<String>? email,
|
||||||
|
i0.Value<DateTime?>? deletedAt,
|
||||||
|
i0.Value<i2.AvatarColor?>? avatarColor,
|
||||||
|
i0.Value<bool>? isAdmin,
|
||||||
|
i0.Value<String>? oauthId,
|
||||||
|
i0.Value<String?>? pinCode,
|
||||||
|
i0.Value<bool>? hasProfileImage,
|
||||||
|
i0.Value<DateTime>? profileChangedAt,
|
||||||
|
i0.Value<int?>? quotaSizeInBytes,
|
||||||
|
i0.Value<int>? quotaUsageInBytes,
|
||||||
|
i0.Value<String?>? storageLabel}) {
|
||||||
|
return i1.AuthUserEntityCompanion(
|
||||||
|
id: id ?? this.id,
|
||||||
|
name: name ?? this.name,
|
||||||
|
email: email ?? this.email,
|
||||||
|
deletedAt: deletedAt ?? this.deletedAt,
|
||||||
|
avatarColor: avatarColor ?? this.avatarColor,
|
||||||
|
isAdmin: isAdmin ?? this.isAdmin,
|
||||||
|
oauthId: oauthId ?? this.oauthId,
|
||||||
|
pinCode: pinCode ?? this.pinCode,
|
||||||
|
hasProfileImage: hasProfileImage ?? this.hasProfileImage,
|
||||||
|
profileChangedAt: profileChangedAt ?? this.profileChangedAt,
|
||||||
|
quotaSizeInBytes: quotaSizeInBytes ?? this.quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,
|
||||||
|
storageLabel: storageLabel ?? this.storageLabel,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
if (id.present) {
|
||||||
|
map['id'] = i0.Variable<String>(id.value);
|
||||||
|
}
|
||||||
|
if (name.present) {
|
||||||
|
map['name'] = i0.Variable<String>(name.value);
|
||||||
|
}
|
||||||
|
if (email.present) {
|
||||||
|
map['email'] = i0.Variable<String>(email.value);
|
||||||
|
}
|
||||||
|
if (deletedAt.present) {
|
||||||
|
map['deleted_at'] = i0.Variable<DateTime>(deletedAt.value);
|
||||||
|
}
|
||||||
|
if (avatarColor.present) {
|
||||||
|
map['avatar_color'] = i0.Variable<int>(i1
|
||||||
|
.$AuthUserEntityTable.$converteravatarColorn
|
||||||
|
.toSql(avatarColor.value));
|
||||||
|
}
|
||||||
|
if (isAdmin.present) {
|
||||||
|
map['is_admin'] = i0.Variable<bool>(isAdmin.value);
|
||||||
|
}
|
||||||
|
if (oauthId.present) {
|
||||||
|
map['oauth_id'] = i0.Variable<String>(oauthId.value);
|
||||||
|
}
|
||||||
|
if (pinCode.present) {
|
||||||
|
map['pin_code'] = i0.Variable<String>(pinCode.value);
|
||||||
|
}
|
||||||
|
if (hasProfileImage.present) {
|
||||||
|
map['has_profile_image'] = i0.Variable<bool>(hasProfileImage.value);
|
||||||
|
}
|
||||||
|
if (profileChangedAt.present) {
|
||||||
|
map['profile_changed_at'] = i0.Variable<DateTime>(profileChangedAt.value);
|
||||||
|
}
|
||||||
|
if (quotaSizeInBytes.present) {
|
||||||
|
map['quota_size_in_bytes'] = i0.Variable<int>(quotaSizeInBytes.value);
|
||||||
|
}
|
||||||
|
if (quotaUsageInBytes.present) {
|
||||||
|
map['quota_usage_in_bytes'] = i0.Variable<int>(quotaUsageInBytes.value);
|
||||||
|
}
|
||||||
|
if (storageLabel.present) {
|
||||||
|
map['storage_label'] = i0.Variable<String>(storageLabel.value);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('AuthUserEntityCompanion(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('name: $name, ')
|
||||||
|
..write('email: $email, ')
|
||||||
|
..write('deletedAt: $deletedAt, ')
|
||||||
|
..write('avatarColor: $avatarColor, ')
|
||||||
|
..write('isAdmin: $isAdmin, ')
|
||||||
|
..write('oauthId: $oauthId, ')
|
||||||
|
..write('pinCode: $pinCode, ')
|
||||||
|
..write('hasProfileImage: $hasProfileImage, ')
|
||||||
|
..write('profileChangedAt: $profileChangedAt, ')
|
||||||
|
..write('quotaSizeInBytes: $quotaSizeInBytes, ')
|
||||||
|
..write('quotaUsageInBytes: $quotaUsageInBytes, ')
|
||||||
|
..write('storageLabel: $storageLabel')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -98,8 +98,7 @@ class ExifInfo {
|
|||||||
class RemoteExifEntity extends Table with DriftDefaultsMixin {
|
class RemoteExifEntity extends Table with DriftDefaultsMixin {
|
||||||
const RemoteExifEntity();
|
const RemoteExifEntity();
|
||||||
|
|
||||||
TextColumn get assetId =>
|
TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get city => text().nullable()();
|
TextColumn get city => text().nullable()();
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ class LocalAlbumEntity extends Table with DriftDefaultsMixin {
|
|||||||
TextColumn get name => text()();
|
TextColumn get name => text()();
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
IntColumn get backupSelection => intEnum<BackupSelection>()();
|
IntColumn get backupSelection => intEnum<BackupSelection>()();
|
||||||
BoolColumn get isIosSharedAlbum =>
|
BoolColumn get isIosSharedAlbum => boolean().withDefault(const Constant(false))();
|
||||||
boolean().withDefault(const Constant(false))();
|
|
||||||
|
|
||||||
// Used for mark & sweep
|
// Used for mark & sweep
|
||||||
BoolColumn get marker_ => boolean().nullable()();
|
BoolColumn get marker_ => boolean().nullable()();
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
|||||||
class LocalAlbumAssetEntity extends Table with DriftDefaultsMixin {
|
class LocalAlbumAssetEntity extends Table with DriftDefaultsMixin {
|
||||||
const LocalAlbumAssetEntity();
|
const LocalAlbumAssetEntity();
|
||||||
|
|
||||||
TextColumn get assetId =>
|
TextColumn get assetId => text().references(LocalAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(LocalAssetEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get albumId =>
|
TextColumn get albumId => text().references(LocalAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(LocalAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {assetId, albumId};
|
Set<Column> get primaryKey => {assetId, albumId};
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ class MemoryEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get deletedAt => dateTime().nullable()();
|
DateTimeColumn get deletedAt => dateTime().nullable()();
|
||||||
|
|
||||||
TextColumn get ownerId =>
|
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
IntColumn get type => intEnum<MemoryTypeEnum>()();
|
IntColumn get type => intEnum<MemoryTypeEnum>()();
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
|||||||
class MemoryAssetEntity extends Table with DriftDefaultsMixin {
|
class MemoryAssetEntity extends Table with DriftDefaultsMixin {
|
||||||
const MemoryAssetEntity();
|
const MemoryAssetEntity();
|
||||||
|
|
||||||
TextColumn get assetId =>
|
TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get memoryId =>
|
TextColumn get memoryId => text().references(MemoryEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(MemoryEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {assetId, memoryId};
|
Set<Column> get primaryKey => {assetId, memoryId};
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
|||||||
class PartnerEntity extends Table with DriftDefaultsMixin {
|
class PartnerEntity extends Table with DriftDefaultsMixin {
|
||||||
const PartnerEntity();
|
const PartnerEntity();
|
||||||
|
|
||||||
TextColumn get sharedById =>
|
TextColumn get sharedById => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get sharedWithId =>
|
TextColumn get sharedWithId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
BoolColumn get inTimeline => boolean().withDefault(const Constant(false))();
|
BoolColumn get inTimeline => boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ class PersonEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
TextColumn get ownerId =>
|
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get name => text()();
|
TextColumn get name => text()();
|
||||||
|
|
||||||
|
|||||||
@@ -17,15 +17,12 @@ class RemoteAlbumEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
TextColumn get ownerId =>
|
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get thumbnailAssetId => text()
|
TextColumn get thumbnailAssetId =>
|
||||||
.references(RemoteAssetEntity, #id, onDelete: KeyAction.setNull)
|
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.setNull).nullable()();
|
||||||
.nullable()();
|
|
||||||
|
|
||||||
BoolColumn get isActivityEnabled =>
|
BoolColumn get isActivityEnabled => boolean().withDefault(const Constant(true))();
|
||||||
boolean().withDefault(const Constant(true))();
|
|
||||||
|
|
||||||
IntColumn get order => intEnum<AlbumAssetOrder>()();
|
IntColumn get order => intEnum<AlbumAssetOrder>()();
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
|||||||
class RemoteAlbumAssetEntity extends Table with DriftDefaultsMixin {
|
class RemoteAlbumAssetEntity extends Table with DriftDefaultsMixin {
|
||||||
const RemoteAlbumAssetEntity();
|
const RemoteAlbumAssetEntity();
|
||||||
|
|
||||||
TextColumn get assetId =>
|
TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get albumId =>
|
TextColumn get albumId => text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {assetId, albumId};
|
Set<Column> get primaryKey => {assetId, albumId};
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
|||||||
class RemoteAlbumUserEntity extends Table with DriftDefaultsMixin {
|
class RemoteAlbumUserEntity extends Table with DriftDefaultsMixin {
|
||||||
const RemoteAlbumUserEntity();
|
const RemoteAlbumUserEntity();
|
||||||
|
|
||||||
TextColumn get albumId =>
|
TextColumn get albumId => text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get userId =>
|
TextColumn get userId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
IntColumn get role => intEnum<AlbumUserRole>()();
|
IntColumn get role => intEnum<AlbumUserRole>()();
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
|||||||
unique: true,
|
unique: true,
|
||||||
)
|
)
|
||||||
@TableIndex(name: 'idx_remote_asset_checksum', columns: {#checksum})
|
@TableIndex(name: 'idx_remote_asset_checksum', columns: {#checksum})
|
||||||
class RemoteAssetEntity extends Table
|
class RemoteAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin {
|
||||||
with DriftDefaultsMixin, AssetEntityMixin {
|
|
||||||
const RemoteAssetEntity();
|
const RemoteAssetEntity();
|
||||||
|
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
@@ -21,8 +20,7 @@ class RemoteAssetEntity extends Table
|
|||||||
|
|
||||||
BoolColumn get isFavorite => boolean().withDefault(const Constant(false))();
|
BoolColumn get isFavorite => boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
TextColumn get ownerId =>
|
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
DateTimeColumn get localDateTime => dateTime().nullable()();
|
DateTimeColumn get localDateTime => dateTime().nullable()();
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ class StackEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
TextColumn get ownerId =>
|
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
TextColumn get primaryAssetId => text()();
|
TextColumn get primaryAssetId => text()();
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import 'package:drift/drift.dart' hide Index;
|
import 'package:drift/drift.dart' hide Index;
|
||||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
import 'package:immich_mobile/utils/hash.dart';
|
import 'package:immich_mobile/utils/hash.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
part 'user.entity.g.dart';
|
part 'user.entity.g.dart';
|
||||||
|
|
||||||
|
// TODO: Remove User once Isar is removed
|
||||||
@Collection(inheritance: false)
|
@Collection(inheritance: false)
|
||||||
class User {
|
class IsarUser {
|
||||||
Id get isarId => fastHash(id);
|
Id get isarId => fastHash(id);
|
||||||
@Index(unique: true, replace: false, type: IndexType.hash)
|
@Index(unique: true, replace: false, type: IndexType.hash)
|
||||||
final String id;
|
final String id;
|
||||||
@@ -26,7 +28,7 @@ class User {
|
|||||||
final int quotaUsageInBytes;
|
final int quotaUsageInBytes;
|
||||||
final int quotaSizeInBytes;
|
final int quotaSizeInBytes;
|
||||||
|
|
||||||
const User({
|
const IsarUser({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.updatedAt,
|
required this.updatedAt,
|
||||||
required this.email,
|
required this.email,
|
||||||
@@ -42,7 +44,7 @@ class User {
|
|||||||
this.quotaSizeInBytes = 0,
|
this.quotaSizeInBytes = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
static User fromDto(UserDto dto) => User(
|
static IsarUser fromDto(UserDto dto) => IsarUser(
|
||||||
id: dto.id,
|
id: dto.id,
|
||||||
updatedAt: dto.updatedAt,
|
updatedAt: dto.updatedAt,
|
||||||
email: dto.email,
|
email: dto.email,
|
||||||
@@ -79,15 +81,25 @@ class UserEntity extends Table with DriftDefaultsMixin {
|
|||||||
const UserEntity();
|
const UserEntity();
|
||||||
|
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
|
|
||||||
TextColumn get name => text()();
|
TextColumn get name => text()();
|
||||||
BoolColumn get isAdmin => boolean().withDefault(const Constant(false))();
|
|
||||||
TextColumn get email => text()();
|
TextColumn get email => text()();
|
||||||
TextColumn get profileImagePath => text().nullable()();
|
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get deletedAt => dateTime().nullable()();
|
||||||
// Quota
|
|
||||||
IntColumn get quotaSizeInBytes => integer().nullable()();
|
IntColumn get avatarColor => intEnum<AvatarColor>().nullable()();
|
||||||
IntColumn get quotaUsageInBytes => integer().withDefault(const Constant(0))();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {id};
|
Set<Column> get primaryKey => {id};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension UserEntityDataDomainEx on UserEntityData {
|
||||||
|
User toDto() => User(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
email: email,
|
||||||
|
deletedAt: deletedAt,
|
||||||
|
avatarColor: avatarColor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,30 +3,24 @@
|
|||||||
import 'package:drift/drift.dart' as i0;
|
import 'package:drift/drift.dart' as i0;
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart'
|
||||||
as i1;
|
as i1;
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.dart' as i2;
|
import 'package:immich_mobile/domain/models/user_metadata.model.dart' as i2;
|
||||||
import 'package:drift/src/runtime/query_builder/query_builder.dart' as i3;
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart' as i3;
|
||||||
|
|
||||||
typedef $$UserEntityTableCreateCompanionBuilder = i1.UserEntityCompanion
|
typedef $$UserEntityTableCreateCompanionBuilder = i1.UserEntityCompanion
|
||||||
Function({
|
Function({
|
||||||
required String id,
|
required String id,
|
||||||
required String name,
|
required String name,
|
||||||
i0.Value<bool> isAdmin,
|
|
||||||
required String email,
|
required String email,
|
||||||
i0.Value<String?> profileImagePath,
|
i0.Value<DateTime?> deletedAt,
|
||||||
i0.Value<DateTime> updatedAt,
|
i0.Value<i2.AvatarColor?> avatarColor,
|
||||||
i0.Value<int?> quotaSizeInBytes,
|
|
||||||
i0.Value<int> quotaUsageInBytes,
|
|
||||||
});
|
});
|
||||||
typedef $$UserEntityTableUpdateCompanionBuilder = i1.UserEntityCompanion
|
typedef $$UserEntityTableUpdateCompanionBuilder = i1.UserEntityCompanion
|
||||||
Function({
|
Function({
|
||||||
i0.Value<String> id,
|
i0.Value<String> id,
|
||||||
i0.Value<String> name,
|
i0.Value<String> name,
|
||||||
i0.Value<bool> isAdmin,
|
|
||||||
i0.Value<String> email,
|
i0.Value<String> email,
|
||||||
i0.Value<String?> profileImagePath,
|
i0.Value<DateTime?> deletedAt,
|
||||||
i0.Value<DateTime> updatedAt,
|
i0.Value<i2.AvatarColor?> avatarColor,
|
||||||
i0.Value<int?> quotaSizeInBytes,
|
|
||||||
i0.Value<int> quotaUsageInBytes,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
class $$UserEntityTableFilterComposer
|
class $$UserEntityTableFilterComposer
|
||||||
@@ -44,26 +38,16 @@ class $$UserEntityTableFilterComposer
|
|||||||
i0.ColumnFilters<String> get name => $composableBuilder(
|
i0.ColumnFilters<String> get name => $composableBuilder(
|
||||||
column: $table.name, builder: (column) => i0.ColumnFilters(column));
|
column: $table.name, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
i0.ColumnFilters<bool> get isAdmin => $composableBuilder(
|
|
||||||
column: $table.isAdmin, builder: (column) => i0.ColumnFilters(column));
|
|
||||||
|
|
||||||
i0.ColumnFilters<String> get email => $composableBuilder(
|
i0.ColumnFilters<String> get email => $composableBuilder(
|
||||||
column: $table.email, builder: (column) => i0.ColumnFilters(column));
|
column: $table.email, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
i0.ColumnFilters<String> get profileImagePath => $composableBuilder(
|
i0.ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
||||||
column: $table.profileImagePath,
|
column: $table.deletedAt, builder: (column) => i0.ColumnFilters(column));
|
||||||
builder: (column) => i0.ColumnFilters(column));
|
|
||||||
|
|
||||||
i0.ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
i0.ColumnWithTypeConverterFilters<i2.AvatarColor?, i2.AvatarColor, int>
|
||||||
column: $table.updatedAt, builder: (column) => i0.ColumnFilters(column));
|
get avatarColor => $composableBuilder(
|
||||||
|
column: $table.avatarColor,
|
||||||
i0.ColumnFilters<int> get quotaSizeInBytes => $composableBuilder(
|
builder: (column) => i0.ColumnWithTypeConverterFilters(column));
|
||||||
column: $table.quotaSizeInBytes,
|
|
||||||
builder: (column) => i0.ColumnFilters(column));
|
|
||||||
|
|
||||||
i0.ColumnFilters<int> get quotaUsageInBytes => $composableBuilder(
|
|
||||||
column: $table.quotaUsageInBytes,
|
|
||||||
builder: (column) => i0.ColumnFilters(column));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class $$UserEntityTableOrderingComposer
|
class $$UserEntityTableOrderingComposer
|
||||||
@@ -81,26 +65,15 @@ class $$UserEntityTableOrderingComposer
|
|||||||
i0.ColumnOrderings<String> get name => $composableBuilder(
|
i0.ColumnOrderings<String> get name => $composableBuilder(
|
||||||
column: $table.name, builder: (column) => i0.ColumnOrderings(column));
|
column: $table.name, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
i0.ColumnOrderings<bool> get isAdmin => $composableBuilder(
|
|
||||||
column: $table.isAdmin, builder: (column) => i0.ColumnOrderings(column));
|
|
||||||
|
|
||||||
i0.ColumnOrderings<String> get email => $composableBuilder(
|
i0.ColumnOrderings<String> get email => $composableBuilder(
|
||||||
column: $table.email, builder: (column) => i0.ColumnOrderings(column));
|
column: $table.email, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
i0.ColumnOrderings<String> get profileImagePath => $composableBuilder(
|
i0.ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
||||||
column: $table.profileImagePath,
|
column: $table.deletedAt,
|
||||||
builder: (column) => i0.ColumnOrderings(column));
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
i0.ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
i0.ColumnOrderings<int> get avatarColor => $composableBuilder(
|
||||||
column: $table.updatedAt,
|
column: $table.avatarColor,
|
||||||
builder: (column) => i0.ColumnOrderings(column));
|
|
||||||
|
|
||||||
i0.ColumnOrderings<int> get quotaSizeInBytes => $composableBuilder(
|
|
||||||
column: $table.quotaSizeInBytes,
|
|
||||||
builder: (column) => i0.ColumnOrderings(column));
|
|
||||||
|
|
||||||
i0.ColumnOrderings<int> get quotaUsageInBytes => $composableBuilder(
|
|
||||||
column: $table.quotaUsageInBytes,
|
|
||||||
builder: (column) => i0.ColumnOrderings(column));
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,23 +92,15 @@ class $$UserEntityTableAnnotationComposer
|
|||||||
i0.GeneratedColumn<String> get name =>
|
i0.GeneratedColumn<String> get name =>
|
||||||
$composableBuilder(column: $table.name, builder: (column) => column);
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
||||||
|
|
||||||
i0.GeneratedColumn<bool> get isAdmin =>
|
|
||||||
$composableBuilder(column: $table.isAdmin, builder: (column) => column);
|
|
||||||
|
|
||||||
i0.GeneratedColumn<String> get email =>
|
i0.GeneratedColumn<String> get email =>
|
||||||
$composableBuilder(column: $table.email, builder: (column) => column);
|
$composableBuilder(column: $table.email, builder: (column) => column);
|
||||||
|
|
||||||
i0.GeneratedColumn<String> get profileImagePath => $composableBuilder(
|
i0.GeneratedColumn<DateTime> get deletedAt =>
|
||||||
column: $table.profileImagePath, builder: (column) => column);
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
||||||
|
|
||||||
i0.GeneratedColumn<DateTime> get updatedAt =>
|
i0.GeneratedColumnWithTypeConverter<i2.AvatarColor?, int> get avatarColor =>
|
||||||
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
$composableBuilder(
|
||||||
|
column: $table.avatarColor, builder: (column) => column);
|
||||||
i0.GeneratedColumn<int> get quotaSizeInBytes => $composableBuilder(
|
|
||||||
column: $table.quotaSizeInBytes, builder: (column) => column);
|
|
||||||
|
|
||||||
i0.GeneratedColumn<int> get quotaUsageInBytes => $composableBuilder(
|
|
||||||
column: $table.quotaUsageInBytes, builder: (column) => column);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class $$UserEntityTableTableManager extends i0.RootTableManager<
|
class $$UserEntityTableTableManager extends i0.RootTableManager<
|
||||||
@@ -168,42 +133,30 @@ class $$UserEntityTableTableManager extends i0.RootTableManager<
|
|||||||
updateCompanionCallback: ({
|
updateCompanionCallback: ({
|
||||||
i0.Value<String> id = const i0.Value.absent(),
|
i0.Value<String> id = const i0.Value.absent(),
|
||||||
i0.Value<String> name = const i0.Value.absent(),
|
i0.Value<String> name = const i0.Value.absent(),
|
||||||
i0.Value<bool> isAdmin = const i0.Value.absent(),
|
|
||||||
i0.Value<String> email = const i0.Value.absent(),
|
i0.Value<String> email = const i0.Value.absent(),
|
||||||
i0.Value<String?> profileImagePath = const i0.Value.absent(),
|
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||||
i0.Value<DateTime> updatedAt = const i0.Value.absent(),
|
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent(),
|
||||||
i0.Value<int?> quotaSizeInBytes = const i0.Value.absent(),
|
|
||||||
i0.Value<int> quotaUsageInBytes = const i0.Value.absent(),
|
|
||||||
}) =>
|
}) =>
|
||||||
i1.UserEntityCompanion(
|
i1.UserEntityCompanion(
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
isAdmin: isAdmin,
|
|
||||||
email: email,
|
email: email,
|
||||||
profileImagePath: profileImagePath,
|
deletedAt: deletedAt,
|
||||||
updatedAt: updatedAt,
|
avatarColor: avatarColor,
|
||||||
quotaSizeInBytes: quotaSizeInBytes,
|
|
||||||
quotaUsageInBytes: quotaUsageInBytes,
|
|
||||||
),
|
),
|
||||||
createCompanionCallback: ({
|
createCompanionCallback: ({
|
||||||
required String id,
|
required String id,
|
||||||
required String name,
|
required String name,
|
||||||
i0.Value<bool> isAdmin = const i0.Value.absent(),
|
|
||||||
required String email,
|
required String email,
|
||||||
i0.Value<String?> profileImagePath = const i0.Value.absent(),
|
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||||
i0.Value<DateTime> updatedAt = const i0.Value.absent(),
|
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent(),
|
||||||
i0.Value<int?> quotaSizeInBytes = const i0.Value.absent(),
|
|
||||||
i0.Value<int> quotaUsageInBytes = const i0.Value.absent(),
|
|
||||||
}) =>
|
}) =>
|
||||||
i1.UserEntityCompanion.insert(
|
i1.UserEntityCompanion.insert(
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
isAdmin: isAdmin,
|
|
||||||
email: email,
|
email: email,
|
||||||
profileImagePath: profileImagePath,
|
deletedAt: deletedAt,
|
||||||
updatedAt: updatedAt,
|
avatarColor: avatarColor,
|
||||||
quotaSizeInBytes: quotaSizeInBytes,
|
|
||||||
quotaUsageInBytes: quotaUsageInBytes,
|
|
||||||
),
|
),
|
||||||
withReferenceMapper: (p0) => p0
|
withReferenceMapper: (p0) => p0
|
||||||
.map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))
|
.map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))
|
||||||
@@ -229,7 +182,7 @@ typedef $$UserEntityTableProcessedTableManager = i0.ProcessedTableManager<
|
|||||||
i1.UserEntityData,
|
i1.UserEntityData,
|
||||||
i0.PrefetchHooks Function()>;
|
i0.PrefetchHooks Function()>;
|
||||||
|
|
||||||
class $UserEntityTable extends i2.UserEntity
|
class $UserEntityTable extends i3.UserEntity
|
||||||
with i0.TableInfo<$UserEntityTable, i1.UserEntityData> {
|
with i0.TableInfo<$UserEntityTable, i1.UserEntityData> {
|
||||||
@override
|
@override
|
||||||
final i0.GeneratedDatabase attachedDatabase;
|
final i0.GeneratedDatabase attachedDatabase;
|
||||||
@@ -246,61 +199,27 @@ class $UserEntityTable extends i2.UserEntity
|
|||||||
late final i0.GeneratedColumn<String> name = i0.GeneratedColumn<String>(
|
late final i0.GeneratedColumn<String> name = i0.GeneratedColumn<String>(
|
||||||
'name', aliasedName, false,
|
'name', aliasedName, false,
|
||||||
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
||||||
static const i0.VerificationMeta _isAdminMeta =
|
|
||||||
const i0.VerificationMeta('isAdmin');
|
|
||||||
@override
|
|
||||||
late final i0.GeneratedColumn<bool> isAdmin = i0.GeneratedColumn<bool>(
|
|
||||||
'is_admin', aliasedName, false,
|
|
||||||
type: i0.DriftSqlType.bool,
|
|
||||||
requiredDuringInsert: false,
|
|
||||||
defaultConstraints:
|
|
||||||
i0.GeneratedColumn.constraintIsAlways('CHECK ("is_admin" IN (0, 1))'),
|
|
||||||
defaultValue: const i3.Constant(false));
|
|
||||||
static const i0.VerificationMeta _emailMeta =
|
static const i0.VerificationMeta _emailMeta =
|
||||||
const i0.VerificationMeta('email');
|
const i0.VerificationMeta('email');
|
||||||
@override
|
@override
|
||||||
late final i0.GeneratedColumn<String> email = i0.GeneratedColumn<String>(
|
late final i0.GeneratedColumn<String> email = i0.GeneratedColumn<String>(
|
||||||
'email', aliasedName, false,
|
'email', aliasedName, false,
|
||||||
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
||||||
static const i0.VerificationMeta _profileImagePathMeta =
|
static const i0.VerificationMeta _deletedAtMeta =
|
||||||
const i0.VerificationMeta('profileImagePath');
|
const i0.VerificationMeta('deletedAt');
|
||||||
@override
|
@override
|
||||||
late final i0.GeneratedColumn<String> profileImagePath =
|
late final i0.GeneratedColumn<DateTime> deletedAt =
|
||||||
i0.GeneratedColumn<String>('profile_image_path', aliasedName, true,
|
i0.GeneratedColumn<DateTime>('deleted_at', aliasedName, true,
|
||||||
type: i0.DriftSqlType.string, requiredDuringInsert: false);
|
type: i0.DriftSqlType.dateTime, requiredDuringInsert: false);
|
||||||
static const i0.VerificationMeta _updatedAtMeta =
|
|
||||||
const i0.VerificationMeta('updatedAt');
|
|
||||||
@override
|
@override
|
||||||
late final i0.GeneratedColumn<DateTime> updatedAt =
|
late final i0.GeneratedColumnWithTypeConverter<i2.AvatarColor?, int>
|
||||||
i0.GeneratedColumn<DateTime>('updated_at', aliasedName, false,
|
avatarColor = i0.GeneratedColumn<int>('avatar_color', aliasedName, true,
|
||||||
type: i0.DriftSqlType.dateTime,
|
type: i0.DriftSqlType.int, requiredDuringInsert: false)
|
||||||
requiredDuringInsert: false,
|
.withConverter<i2.AvatarColor?>(
|
||||||
defaultValue: i3.currentDateAndTime);
|
i1.$UserEntityTable.$converteravatarColorn);
|
||||||
static const i0.VerificationMeta _quotaSizeInBytesMeta =
|
|
||||||
const i0.VerificationMeta('quotaSizeInBytes');
|
|
||||||
@override
|
@override
|
||||||
late final i0.GeneratedColumn<int> quotaSizeInBytes = i0.GeneratedColumn<int>(
|
List<i0.GeneratedColumn> get $columns =>
|
||||||
'quota_size_in_bytes', aliasedName, true,
|
[id, name, email, deletedAt, avatarColor];
|
||||||
type: i0.DriftSqlType.int, requiredDuringInsert: false);
|
|
||||||
static const i0.VerificationMeta _quotaUsageInBytesMeta =
|
|
||||||
const i0.VerificationMeta('quotaUsageInBytes');
|
|
||||||
@override
|
|
||||||
late final i0.GeneratedColumn<int> quotaUsageInBytes =
|
|
||||||
i0.GeneratedColumn<int>('quota_usage_in_bytes', aliasedName, false,
|
|
||||||
type: i0.DriftSqlType.int,
|
|
||||||
requiredDuringInsert: false,
|
|
||||||
defaultValue: const i3.Constant(0));
|
|
||||||
@override
|
|
||||||
List<i0.GeneratedColumn> get $columns => [
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
isAdmin,
|
|
||||||
email,
|
|
||||||
profileImagePath,
|
|
||||||
updatedAt,
|
|
||||||
quotaSizeInBytes,
|
|
||||||
quotaUsageInBytes
|
|
||||||
];
|
|
||||||
@override
|
@override
|
||||||
String get aliasedName => _alias ?? actualTableName;
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
@override
|
@override
|
||||||
@@ -323,37 +242,15 @@ class $UserEntityTable extends i2.UserEntity
|
|||||||
} else if (isInserting) {
|
} else if (isInserting) {
|
||||||
context.missing(_nameMeta);
|
context.missing(_nameMeta);
|
||||||
}
|
}
|
||||||
if (data.containsKey('is_admin')) {
|
|
||||||
context.handle(_isAdminMeta,
|
|
||||||
isAdmin.isAcceptableOrUnknown(data['is_admin']!, _isAdminMeta));
|
|
||||||
}
|
|
||||||
if (data.containsKey('email')) {
|
if (data.containsKey('email')) {
|
||||||
context.handle(
|
context.handle(
|
||||||
_emailMeta, email.isAcceptableOrUnknown(data['email']!, _emailMeta));
|
_emailMeta, email.isAcceptableOrUnknown(data['email']!, _emailMeta));
|
||||||
} else if (isInserting) {
|
} else if (isInserting) {
|
||||||
context.missing(_emailMeta);
|
context.missing(_emailMeta);
|
||||||
}
|
}
|
||||||
if (data.containsKey('profile_image_path')) {
|
if (data.containsKey('deleted_at')) {
|
||||||
context.handle(
|
context.handle(_deletedAtMeta,
|
||||||
_profileImagePathMeta,
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta));
|
||||||
profileImagePath.isAcceptableOrUnknown(
|
|
||||||
data['profile_image_path']!, _profileImagePathMeta));
|
|
||||||
}
|
|
||||||
if (data.containsKey('updated_at')) {
|
|
||||||
context.handle(_updatedAtMeta,
|
|
||||||
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta));
|
|
||||||
}
|
|
||||||
if (data.containsKey('quota_size_in_bytes')) {
|
|
||||||
context.handle(
|
|
||||||
_quotaSizeInBytesMeta,
|
|
||||||
quotaSizeInBytes.isAcceptableOrUnknown(
|
|
||||||
data['quota_size_in_bytes']!, _quotaSizeInBytesMeta));
|
|
||||||
}
|
|
||||||
if (data.containsKey('quota_usage_in_bytes')) {
|
|
||||||
context.handle(
|
|
||||||
_quotaUsageInBytesMeta,
|
|
||||||
quotaUsageInBytes.isAcceptableOrUnknown(
|
|
||||||
data['quota_usage_in_bytes']!, _quotaUsageInBytesMeta));
|
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
@@ -368,18 +265,13 @@ class $UserEntityTable extends i2.UserEntity
|
|||||||
.read(i0.DriftSqlType.string, data['${effectivePrefix}id'])!,
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}id'])!,
|
||||||
name: attachedDatabase.typeMapping
|
name: attachedDatabase.typeMapping
|
||||||
.read(i0.DriftSqlType.string, data['${effectivePrefix}name'])!,
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
isAdmin: attachedDatabase.typeMapping
|
|
||||||
.read(i0.DriftSqlType.bool, data['${effectivePrefix}is_admin'])!,
|
|
||||||
email: attachedDatabase.typeMapping
|
email: attachedDatabase.typeMapping
|
||||||
.read(i0.DriftSqlType.string, data['${effectivePrefix}email'])!,
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}email'])!,
|
||||||
profileImagePath: attachedDatabase.typeMapping.read(
|
deletedAt: attachedDatabase.typeMapping
|
||||||
i0.DriftSqlType.string, data['${effectivePrefix}profile_image_path']),
|
.read(i0.DriftSqlType.dateTime, data['${effectivePrefix}deleted_at']),
|
||||||
updatedAt: attachedDatabase.typeMapping.read(
|
avatarColor: i1.$UserEntityTable.$converteravatarColorn.fromSql(
|
||||||
i0.DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!,
|
attachedDatabase.typeMapping.read(
|
||||||
quotaSizeInBytes: attachedDatabase.typeMapping.read(
|
i0.DriftSqlType.int, data['${effectivePrefix}avatar_color'])),
|
||||||
i0.DriftSqlType.int, data['${effectivePrefix}quota_size_in_bytes']),
|
|
||||||
quotaUsageInBytes: attachedDatabase.typeMapping.read(
|
|
||||||
i0.DriftSqlType.int, data['${effectivePrefix}quota_usage_in_bytes'])!,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +280,11 @@ class $UserEntityTable extends i2.UserEntity
|
|||||||
return $UserEntityTable(attachedDatabase, alias);
|
return $UserEntityTable(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static i0.JsonTypeConverter2<i2.AvatarColor, int, int> $converteravatarColor =
|
||||||
|
const i0.EnumIndexConverter<i2.AvatarColor>(i2.AvatarColor.values);
|
||||||
|
static i0.JsonTypeConverter2<i2.AvatarColor?, int?, int?>
|
||||||
|
$converteravatarColorn =
|
||||||
|
i0.JsonTypeConverter2.asNullable($converteravatarColor);
|
||||||
@override
|
@override
|
||||||
bool get withoutRowId => true;
|
bool get withoutRowId => true;
|
||||||
@override
|
@override
|
||||||
@@ -398,36 +295,28 @@ class UserEntityData extends i0.DataClass
|
|||||||
implements i0.Insertable<i1.UserEntityData> {
|
implements i0.Insertable<i1.UserEntityData> {
|
||||||
final String id;
|
final String id;
|
||||||
final String name;
|
final String name;
|
||||||
final bool isAdmin;
|
|
||||||
final String email;
|
final String email;
|
||||||
final String? profileImagePath;
|
final DateTime? deletedAt;
|
||||||
final DateTime updatedAt;
|
final i2.AvatarColor? avatarColor;
|
||||||
final int? quotaSizeInBytes;
|
|
||||||
final int quotaUsageInBytes;
|
|
||||||
const UserEntityData(
|
const UserEntityData(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.isAdmin,
|
|
||||||
required this.email,
|
required this.email,
|
||||||
this.profileImagePath,
|
this.deletedAt,
|
||||||
required this.updatedAt,
|
this.avatarColor});
|
||||||
this.quotaSizeInBytes,
|
|
||||||
required this.quotaUsageInBytes});
|
|
||||||
@override
|
@override
|
||||||
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, i0.Expression>{};
|
final map = <String, i0.Expression>{};
|
||||||
map['id'] = i0.Variable<String>(id);
|
map['id'] = i0.Variable<String>(id);
|
||||||
map['name'] = i0.Variable<String>(name);
|
map['name'] = i0.Variable<String>(name);
|
||||||
map['is_admin'] = i0.Variable<bool>(isAdmin);
|
|
||||||
map['email'] = i0.Variable<String>(email);
|
map['email'] = i0.Variable<String>(email);
|
||||||
if (!nullToAbsent || profileImagePath != null) {
|
if (!nullToAbsent || deletedAt != null) {
|
||||||
map['profile_image_path'] = i0.Variable<String>(profileImagePath);
|
map['deleted_at'] = i0.Variable<DateTime>(deletedAt);
|
||||||
}
|
}
|
||||||
map['updated_at'] = i0.Variable<DateTime>(updatedAt);
|
if (!nullToAbsent || avatarColor != null) {
|
||||||
if (!nullToAbsent || quotaSizeInBytes != null) {
|
map['avatar_color'] = i0.Variable<int>(
|
||||||
map['quota_size_in_bytes'] = i0.Variable<int>(quotaSizeInBytes);
|
i1.$UserEntityTable.$converteravatarColorn.toSql(avatarColor));
|
||||||
}
|
}
|
||||||
map['quota_usage_in_bytes'] = i0.Variable<int>(quotaUsageInBytes);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,12 +326,10 @@ class UserEntityData extends i0.DataClass
|
|||||||
return UserEntityData(
|
return UserEntityData(
|
||||||
id: serializer.fromJson<String>(json['id']),
|
id: serializer.fromJson<String>(json['id']),
|
||||||
name: serializer.fromJson<String>(json['name']),
|
name: serializer.fromJson<String>(json['name']),
|
||||||
isAdmin: serializer.fromJson<bool>(json['isAdmin']),
|
|
||||||
email: serializer.fromJson<String>(json['email']),
|
email: serializer.fromJson<String>(json['email']),
|
||||||
profileImagePath: serializer.fromJson<String?>(json['profileImagePath']),
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
||||||
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
avatarColor: i1.$UserEntityTable.$converteravatarColorn
|
||||||
quotaSizeInBytes: serializer.fromJson<int?>(json['quotaSizeInBytes']),
|
.fromJson(serializer.fromJson<int?>(json['avatarColor'])),
|
||||||
quotaUsageInBytes: serializer.fromJson<int>(json['quotaUsageInBytes']),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@@ -451,54 +338,34 @@ class UserEntityData extends i0.DataClass
|
|||||||
return <String, dynamic>{
|
return <String, dynamic>{
|
||||||
'id': serializer.toJson<String>(id),
|
'id': serializer.toJson<String>(id),
|
||||||
'name': serializer.toJson<String>(name),
|
'name': serializer.toJson<String>(name),
|
||||||
'isAdmin': serializer.toJson<bool>(isAdmin),
|
|
||||||
'email': serializer.toJson<String>(email),
|
'email': serializer.toJson<String>(email),
|
||||||
'profileImagePath': serializer.toJson<String?>(profileImagePath),
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
||||||
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
'avatarColor': serializer.toJson<int?>(
|
||||||
'quotaSizeInBytes': serializer.toJson<int?>(quotaSizeInBytes),
|
i1.$UserEntityTable.$converteravatarColorn.toJson(avatarColor)),
|
||||||
'quotaUsageInBytes': serializer.toJson<int>(quotaUsageInBytes),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
i1.UserEntityData copyWith(
|
i1.UserEntityData copyWith(
|
||||||
{String? id,
|
{String? id,
|
||||||
String? name,
|
String? name,
|
||||||
bool? isAdmin,
|
|
||||||
String? email,
|
String? email,
|
||||||
i0.Value<String?> profileImagePath = const i0.Value.absent(),
|
i0.Value<DateTime?> deletedAt = const i0.Value.absent(),
|
||||||
DateTime? updatedAt,
|
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent()}) =>
|
||||||
i0.Value<int?> quotaSizeInBytes = const i0.Value.absent(),
|
|
||||||
int? quotaUsageInBytes}) =>
|
|
||||||
i1.UserEntityData(
|
i1.UserEntityData(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
isAdmin: isAdmin ?? this.isAdmin,
|
|
||||||
email: email ?? this.email,
|
email: email ?? this.email,
|
||||||
profileImagePath: profileImagePath.present
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
||||||
? profileImagePath.value
|
avatarColor: avatarColor.present ? avatarColor.value : this.avatarColor,
|
||||||
: this.profileImagePath,
|
|
||||||
updatedAt: updatedAt ?? this.updatedAt,
|
|
||||||
quotaSizeInBytes: quotaSizeInBytes.present
|
|
||||||
? quotaSizeInBytes.value
|
|
||||||
: this.quotaSizeInBytes,
|
|
||||||
quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,
|
|
||||||
);
|
);
|
||||||
UserEntityData copyWithCompanion(i1.UserEntityCompanion data) {
|
UserEntityData copyWithCompanion(i1.UserEntityCompanion data) {
|
||||||
return UserEntityData(
|
return UserEntityData(
|
||||||
id: data.id.present ? data.id.value : this.id,
|
id: data.id.present ? data.id.value : this.id,
|
||||||
name: data.name.present ? data.name.value : this.name,
|
name: data.name.present ? data.name.value : this.name,
|
||||||
isAdmin: data.isAdmin.present ? data.isAdmin.value : this.isAdmin,
|
|
||||||
email: data.email.present ? data.email.value : this.email,
|
email: data.email.present ? data.email.value : this.email,
|
||||||
profileImagePath: data.profileImagePath.present
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
||||||
? data.profileImagePath.value
|
avatarColor:
|
||||||
: this.profileImagePath,
|
data.avatarColor.present ? data.avatarColor.value : this.avatarColor,
|
||||||
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
||||||
quotaSizeInBytes: data.quotaSizeInBytes.present
|
|
||||||
? data.quotaSizeInBytes.value
|
|
||||||
: this.quotaSizeInBytes,
|
|
||||||
quotaUsageInBytes: data.quotaUsageInBytes.present
|
|
||||||
? data.quotaUsageInBytes.value
|
|
||||||
: this.quotaUsageInBytes,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,104 +374,76 @@ class UserEntityData extends i0.DataClass
|
|||||||
return (StringBuffer('UserEntityData(')
|
return (StringBuffer('UserEntityData(')
|
||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('name: $name, ')
|
..write('name: $name, ')
|
||||||
..write('isAdmin: $isAdmin, ')
|
|
||||||
..write('email: $email, ')
|
..write('email: $email, ')
|
||||||
..write('profileImagePath: $profileImagePath, ')
|
..write('deletedAt: $deletedAt, ')
|
||||||
..write('updatedAt: $updatedAt, ')
|
..write('avatarColor: $avatarColor')
|
||||||
..write('quotaSizeInBytes: $quotaSizeInBytes, ')
|
|
||||||
..write('quotaUsageInBytes: $quotaUsageInBytes')
|
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(id, name, isAdmin, email, profileImagePath,
|
int get hashCode => Object.hash(id, name, email, deletedAt, avatarColor);
|
||||||
updatedAt, quotaSizeInBytes, quotaUsageInBytes);
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
(other is i1.UserEntityData &&
|
(other is i1.UserEntityData &&
|
||||||
other.id == this.id &&
|
other.id == this.id &&
|
||||||
other.name == this.name &&
|
other.name == this.name &&
|
||||||
other.isAdmin == this.isAdmin &&
|
|
||||||
other.email == this.email &&
|
other.email == this.email &&
|
||||||
other.profileImagePath == this.profileImagePath &&
|
other.deletedAt == this.deletedAt &&
|
||||||
other.updatedAt == this.updatedAt &&
|
other.avatarColor == this.avatarColor);
|
||||||
other.quotaSizeInBytes == this.quotaSizeInBytes &&
|
|
||||||
other.quotaUsageInBytes == this.quotaUsageInBytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserEntityCompanion extends i0.UpdateCompanion<i1.UserEntityData> {
|
class UserEntityCompanion extends i0.UpdateCompanion<i1.UserEntityData> {
|
||||||
final i0.Value<String> id;
|
final i0.Value<String> id;
|
||||||
final i0.Value<String> name;
|
final i0.Value<String> name;
|
||||||
final i0.Value<bool> isAdmin;
|
|
||||||
final i0.Value<String> email;
|
final i0.Value<String> email;
|
||||||
final i0.Value<String?> profileImagePath;
|
final i0.Value<DateTime?> deletedAt;
|
||||||
final i0.Value<DateTime> updatedAt;
|
final i0.Value<i2.AvatarColor?> avatarColor;
|
||||||
final i0.Value<int?> quotaSizeInBytes;
|
|
||||||
final i0.Value<int> quotaUsageInBytes;
|
|
||||||
const UserEntityCompanion({
|
const UserEntityCompanion({
|
||||||
this.id = const i0.Value.absent(),
|
this.id = const i0.Value.absent(),
|
||||||
this.name = const i0.Value.absent(),
|
this.name = const i0.Value.absent(),
|
||||||
this.isAdmin = const i0.Value.absent(),
|
|
||||||
this.email = const i0.Value.absent(),
|
this.email = const i0.Value.absent(),
|
||||||
this.profileImagePath = const i0.Value.absent(),
|
this.deletedAt = const i0.Value.absent(),
|
||||||
this.updatedAt = const i0.Value.absent(),
|
this.avatarColor = const i0.Value.absent(),
|
||||||
this.quotaSizeInBytes = const i0.Value.absent(),
|
|
||||||
this.quotaUsageInBytes = const i0.Value.absent(),
|
|
||||||
});
|
});
|
||||||
UserEntityCompanion.insert({
|
UserEntityCompanion.insert({
|
||||||
required String id,
|
required String id,
|
||||||
required String name,
|
required String name,
|
||||||
this.isAdmin = const i0.Value.absent(),
|
|
||||||
required String email,
|
required String email,
|
||||||
this.profileImagePath = const i0.Value.absent(),
|
this.deletedAt = const i0.Value.absent(),
|
||||||
this.updatedAt = const i0.Value.absent(),
|
this.avatarColor = const i0.Value.absent(),
|
||||||
this.quotaSizeInBytes = const i0.Value.absent(),
|
|
||||||
this.quotaUsageInBytes = const i0.Value.absent(),
|
|
||||||
}) : id = i0.Value(id),
|
}) : id = i0.Value(id),
|
||||||
name = i0.Value(name),
|
name = i0.Value(name),
|
||||||
email = i0.Value(email);
|
email = i0.Value(email);
|
||||||
static i0.Insertable<i1.UserEntityData> custom({
|
static i0.Insertable<i1.UserEntityData> custom({
|
||||||
i0.Expression<String>? id,
|
i0.Expression<String>? id,
|
||||||
i0.Expression<String>? name,
|
i0.Expression<String>? name,
|
||||||
i0.Expression<bool>? isAdmin,
|
|
||||||
i0.Expression<String>? email,
|
i0.Expression<String>? email,
|
||||||
i0.Expression<String>? profileImagePath,
|
i0.Expression<DateTime>? deletedAt,
|
||||||
i0.Expression<DateTime>? updatedAt,
|
i0.Expression<int>? avatarColor,
|
||||||
i0.Expression<int>? quotaSizeInBytes,
|
|
||||||
i0.Expression<int>? quotaUsageInBytes,
|
|
||||||
}) {
|
}) {
|
||||||
return i0.RawValuesInsertable({
|
return i0.RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
if (name != null) 'name': name,
|
if (name != null) 'name': name,
|
||||||
if (isAdmin != null) 'is_admin': isAdmin,
|
|
||||||
if (email != null) 'email': email,
|
if (email != null) 'email': email,
|
||||||
if (profileImagePath != null) 'profile_image_path': profileImagePath,
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
||||||
if (updatedAt != null) 'updated_at': updatedAt,
|
if (avatarColor != null) 'avatar_color': avatarColor,
|
||||||
if (quotaSizeInBytes != null) 'quota_size_in_bytes': quotaSizeInBytes,
|
|
||||||
if (quotaUsageInBytes != null) 'quota_usage_in_bytes': quotaUsageInBytes,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
i1.UserEntityCompanion copyWith(
|
i1.UserEntityCompanion copyWith(
|
||||||
{i0.Value<String>? id,
|
{i0.Value<String>? id,
|
||||||
i0.Value<String>? name,
|
i0.Value<String>? name,
|
||||||
i0.Value<bool>? isAdmin,
|
|
||||||
i0.Value<String>? email,
|
i0.Value<String>? email,
|
||||||
i0.Value<String?>? profileImagePath,
|
i0.Value<DateTime?>? deletedAt,
|
||||||
i0.Value<DateTime>? updatedAt,
|
i0.Value<i2.AvatarColor?>? avatarColor}) {
|
||||||
i0.Value<int?>? quotaSizeInBytes,
|
|
||||||
i0.Value<int>? quotaUsageInBytes}) {
|
|
||||||
return i1.UserEntityCompanion(
|
return i1.UserEntityCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
isAdmin: isAdmin ?? this.isAdmin,
|
|
||||||
email: email ?? this.email,
|
email: email ?? this.email,
|
||||||
profileImagePath: profileImagePath ?? this.profileImagePath,
|
deletedAt: deletedAt ?? this.deletedAt,
|
||||||
updatedAt: updatedAt ?? this.updatedAt,
|
avatarColor: avatarColor ?? this.avatarColor,
|
||||||
quotaSizeInBytes: quotaSizeInBytes ?? this.quotaSizeInBytes,
|
|
||||||
quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,23 +456,15 @@ class UserEntityCompanion extends i0.UpdateCompanion<i1.UserEntityData> {
|
|||||||
if (name.present) {
|
if (name.present) {
|
||||||
map['name'] = i0.Variable<String>(name.value);
|
map['name'] = i0.Variable<String>(name.value);
|
||||||
}
|
}
|
||||||
if (isAdmin.present) {
|
|
||||||
map['is_admin'] = i0.Variable<bool>(isAdmin.value);
|
|
||||||
}
|
|
||||||
if (email.present) {
|
if (email.present) {
|
||||||
map['email'] = i0.Variable<String>(email.value);
|
map['email'] = i0.Variable<String>(email.value);
|
||||||
}
|
}
|
||||||
if (profileImagePath.present) {
|
if (deletedAt.present) {
|
||||||
map['profile_image_path'] = i0.Variable<String>(profileImagePath.value);
|
map['deleted_at'] = i0.Variable<DateTime>(deletedAt.value);
|
||||||
}
|
}
|
||||||
if (updatedAt.present) {
|
if (avatarColor.present) {
|
||||||
map['updated_at'] = i0.Variable<DateTime>(updatedAt.value);
|
map['avatar_color'] = i0.Variable<int>(
|
||||||
}
|
i1.$UserEntityTable.$converteravatarColorn.toSql(avatarColor.value));
|
||||||
if (quotaSizeInBytes.present) {
|
|
||||||
map['quota_size_in_bytes'] = i0.Variable<int>(quotaSizeInBytes.value);
|
|
||||||
}
|
|
||||||
if (quotaUsageInBytes.present) {
|
|
||||||
map['quota_usage_in_bytes'] = i0.Variable<int>(quotaUsageInBytes.value);
|
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -643,12 +474,9 @@ class UserEntityCompanion extends i0.UpdateCompanion<i1.UserEntityData> {
|
|||||||
return (StringBuffer('UserEntityCompanion(')
|
return (StringBuffer('UserEntityCompanion(')
|
||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('name: $name, ')
|
..write('name: $name, ')
|
||||||
..write('isAdmin: $isAdmin, ')
|
|
||||||
..write('email: $email, ')
|
..write('email: $email, ')
|
||||||
..write('profileImagePath: $profileImagePath, ')
|
..write('deletedAt: $deletedAt, ')
|
||||||
..write('updatedAt: $updatedAt, ')
|
..write('avatarColor: $avatarColor')
|
||||||
..write('quotaSizeInBytes: $quotaSizeInBytes, ')
|
|
||||||
..write('quotaUsageInBytes: $quotaUsageInBytes')
|
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
677
mobile/lib/infrastructure/entities/user.entity.g.dart
generated
677
mobile/lib/infrastructure/entities/user.entity.g.dart
generated
File diff suppressed because it is too large
Load Diff
@@ -6,8 +6,7 @@ import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
|||||||
class UserMetadataEntity extends Table with DriftDefaultsMixin {
|
class UserMetadataEntity extends Table with DriftDefaultsMixin {
|
||||||
const UserMetadataEntity();
|
const UserMetadataEntity();
|
||||||
|
|
||||||
TextColumn get userId =>
|
TextColumn get userId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
IntColumn get key => intEnum<UserMetadataKey>()();
|
IntColumn get key => intEnum<UserMetadataKey>()();
|
||||||
|
|
||||||
@@ -17,7 +16,6 @@ class UserMetadataEntity extends Table with DriftDefaultsMixin {
|
|||||||
Set<Column> get primaryKey => {userId, key};
|
Set<Column> get primaryKey => {userId, key};
|
||||||
}
|
}
|
||||||
|
|
||||||
final JsonTypeConverter2<Map<String, Object?>, Uint8List, Object?>
|
final JsonTypeConverter2<Map<String, Object?>, Uint8List, Object?> userMetadataConverter = TypeConverter.jsonb(
|
||||||
userMetadataConverter = TypeConverter.jsonb(
|
|
||||||
fromJson: (json) => json as Map<String, Object?>,
|
fromJson: (json) => json as Map<String, Object?>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ class DriftAssetFaceRepository extends DriftDatabaseRepository {
|
|||||||
const DriftAssetFaceRepository(this._db) : super(_db);
|
const DriftAssetFaceRepository(this._db) : super(_db);
|
||||||
|
|
||||||
Future<List<AssetFace>> getAll() {
|
Future<List<AssetFace>> getAll() {
|
||||||
return _db.assetFaceEntity
|
return _db.assetFaceEntity.select().map((assetFace) => assetFace.toDto()).get();
|
||||||
.select()
|
|
||||||
.map((assetFace) => assetFace.toDto())
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection
|
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.excluded),
|
||||||
.equalsValue(BackupSelection.excluded),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,10 +40,8 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection
|
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
||||||
.equalsValue(BackupSelection.selected) &
|
_db.localAlbumAssetEntity.assetId.isNotInQuery(_getExcludedSubquery()),
|
||||||
_db.localAlbumAssetEntity.assetId
|
|
||||||
.isNotInQuery(_getExcludedSubquery()),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.get().then((rows) => rows.length);
|
return query.get().then((rows) => rows.length);
|
||||||
@@ -66,18 +63,14 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
.equalsExp(_db.remoteAssetEntity.checksum),
|
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection
|
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
||||||
.equalsValue(BackupSelection.selected) &
|
(_db.remoteAssetEntity.id.isNull() | _db.remoteAssetEntity.ownerId.equals(userId).not()) &
|
||||||
(_db.remoteAssetEntity.id.isNull() |
|
_db.localAlbumAssetEntity.assetId.isNotInQuery(_getExcludedSubquery()),
|
||||||
_db.remoteAssetEntity.ownerId.equals(userId).not()) &
|
|
||||||
_db.localAlbumAssetEntity.assetId
|
|
||||||
.isNotInQuery(_getExcludedSubquery()),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.get().then((rows) => rows.length);
|
return query.get().then((rows) => rows.length);
|
||||||
@@ -101,18 +94,15 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
.equalsExp(_db.remoteAssetEntity.checksum),
|
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection
|
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
||||||
.equalsValue(BackupSelection.selected) &
|
|
||||||
_db.remoteAssetEntity.id.isNotNull() &
|
_db.remoteAssetEntity.id.isNotNull() &
|
||||||
_db.remoteAssetEntity.ownerId.equals(userId) &
|
_db.remoteAssetEntity.ownerId.equals(userId) &
|
||||||
_db.localAlbumAssetEntity.assetId
|
_db.localAlbumAssetEntity.assetId.isNotInQuery(_getExcludedSubquery()),
|
||||||
.isNotInQuery(_getExcludedSubquery()),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.get().then((rows) => rows.length);
|
return query.get().then((rows) => rows.length);
|
||||||
@@ -122,8 +112,7 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
final selectedAlbumIds = _db.localAlbumEntity.selectOnly(distinct: true)
|
final selectedAlbumIds = _db.localAlbumEntity.selectOnly(distinct: true)
|
||||||
..addColumns([_db.localAlbumEntity.id])
|
..addColumns([_db.localAlbumEntity.id])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection
|
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected),
|
||||||
.equalsValue(BackupSelection.selected),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final query = _db.localAssetEntity.select()
|
final query = _db.localAssetEntity.select()
|
||||||
@@ -133,8 +122,7 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
_db.localAlbumAssetEntity.selectOnly()
|
_db.localAlbumAssetEntity.selectOnly()
|
||||||
..addColumns([_db.localAlbumAssetEntity.assetId])
|
..addColumns([_db.localAlbumAssetEntity.assetId])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumAssetEntity.albumId
|
_db.localAlbumAssetEntity.albumId.isInQuery(selectedAlbumIds) &
|
||||||
.isInQuery(selectedAlbumIds) &
|
|
||||||
_db.localAlbumAssetEntity.assetId.equalsExp(lae.id),
|
_db.localAlbumAssetEntity.assetId.equalsExp(lae.id),
|
||||||
),
|
),
|
||||||
) &
|
) &
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import 'package:drift/drift.dart';
|
|||||||
import 'package:drift_flutter/drift_flutter.dart';
|
import 'package:drift_flutter/drift_flutter.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:immich_mobile/domain/interfaces/db.interface.dart';
|
import 'package:immich_mobile/domain/interfaces/db.interface.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';
|
||||||
@@ -43,6 +44,7 @@ class IsarDatabaseRepository implements IDatabaseRepository {
|
|||||||
@DriftDatabase(
|
@DriftDatabase(
|
||||||
tables: [
|
tables: [
|
||||||
UserEntity,
|
UserEntity,
|
||||||
|
AuthUserEntity,
|
||||||
UserMetadataEntity,
|
UserMetadataEntity,
|
||||||
PartnerEntity,
|
PartnerEntity,
|
||||||
LocalAlbumEntity,
|
LocalAlbumEntity,
|
||||||
@@ -74,7 +76,7 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 4;
|
int get schemaVersion => 5;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
@@ -102,13 +104,18 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
// asset_face_entity is added
|
// asset_face_entity is added
|
||||||
await m.create(v4.assetFaceEntity);
|
await m.create(v4.assetFaceEntity);
|
||||||
},
|
},
|
||||||
|
from4To5: (m, v5) async {
|
||||||
|
// Some column got moved from user_entity to auth_user_entity
|
||||||
|
await m.alterTable(TableMigration(v5.userEntity));
|
||||||
|
// auth_user_entity is added
|
||||||
|
await m.create(v5.authUserEntity);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
// Fail if the migration broke foreign keys
|
// Fail if the migration broke foreign keys
|
||||||
final wrongFKs =
|
final wrongFKs = await customSelect('PRAGMA foreign_key_check').get();
|
||||||
await customSelect('PRAGMA foreign_key_check').get();
|
|
||||||
assert(wrongFKs.isEmpty, '${wrongFKs.map((e) => e.data)}');
|
assert(wrongFKs.isEmpty, '${wrongFKs.map((e) => e.data)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +134,5 @@ class DriftDatabaseRepository implements IDatabaseRepository {
|
|||||||
const DriftDatabaseRepository(this._db);
|
const DriftDatabaseRepository(this._db);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<T> transaction<T>(Future<T> Function() callback) =>
|
Future<T> transaction<T>(Future<T> Function() callback) => _db.transaction(callback);
|
||||||
_db.transaction(callback);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,29 +13,31 @@ import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.d
|
|||||||
as i5;
|
as i5;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart'
|
||||||
as i6;
|
as i6;
|
||||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart'
|
||||||
as i7;
|
as i7;
|
||||||
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart'
|
||||||
as i8;
|
as i8;
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart'
|
||||||
as i9;
|
as i9;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
||||||
as i10;
|
as i10;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
||||||
as i11;
|
as i11;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
||||||
as i12;
|
as i12;
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
||||||
as i13;
|
as i13;
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart'
|
||||||
as i14;
|
as i14;
|
||||||
import 'package:immich_mobile/infrastructure/entities/person.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart'
|
||||||
as i15;
|
as i15;
|
||||||
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/person.entity.drift.dart'
|
||||||
as i16;
|
as i16;
|
||||||
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart'
|
||||||
as i17;
|
as i17;
|
||||||
import 'package:drift/internal/modular.dart' as i18;
|
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
||||||
|
as i18;
|
||||||
|
import 'package:drift/internal/modular.dart' as i19;
|
||||||
|
|
||||||
abstract class $Drift extends i0.GeneratedDatabase {
|
abstract class $Drift extends i0.GeneratedDatabase {
|
||||||
$Drift(i0.QueryExecutor e) : super(e);
|
$Drift(i0.QueryExecutor e) : super(e);
|
||||||
@@ -50,26 +52,28 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
i5.$LocalAlbumEntityTable(this);
|
i5.$LocalAlbumEntityTable(this);
|
||||||
late final i6.$LocalAlbumAssetEntityTable localAlbumAssetEntity =
|
late final i6.$LocalAlbumAssetEntityTable localAlbumAssetEntity =
|
||||||
i6.$LocalAlbumAssetEntityTable(this);
|
i6.$LocalAlbumAssetEntityTable(this);
|
||||||
late final i7.$UserMetadataEntityTable userMetadataEntity =
|
late final i7.$AuthUserEntityTable authUserEntity =
|
||||||
i7.$UserMetadataEntityTable(this);
|
i7.$AuthUserEntityTable(this);
|
||||||
late final i8.$PartnerEntityTable partnerEntity =
|
late final i8.$UserMetadataEntityTable userMetadataEntity =
|
||||||
i8.$PartnerEntityTable(this);
|
i8.$UserMetadataEntityTable(this);
|
||||||
late final i9.$RemoteExifEntityTable remoteExifEntity =
|
late final i9.$PartnerEntityTable partnerEntity =
|
||||||
i9.$RemoteExifEntityTable(this);
|
i9.$PartnerEntityTable(this);
|
||||||
late final i10.$RemoteAlbumEntityTable remoteAlbumEntity =
|
late final i10.$RemoteExifEntityTable remoteExifEntity =
|
||||||
i10.$RemoteAlbumEntityTable(this);
|
i10.$RemoteExifEntityTable(this);
|
||||||
late final i11.$RemoteAlbumAssetEntityTable remoteAlbumAssetEntity =
|
late final i11.$RemoteAlbumEntityTable remoteAlbumEntity =
|
||||||
i11.$RemoteAlbumAssetEntityTable(this);
|
i11.$RemoteAlbumEntityTable(this);
|
||||||
late final i12.$RemoteAlbumUserEntityTable remoteAlbumUserEntity =
|
late final i12.$RemoteAlbumAssetEntityTable remoteAlbumAssetEntity =
|
||||||
i12.$RemoteAlbumUserEntityTable(this);
|
i12.$RemoteAlbumAssetEntityTable(this);
|
||||||
late final i13.$MemoryEntityTable memoryEntity = i13.$MemoryEntityTable(this);
|
late final i13.$RemoteAlbumUserEntityTable remoteAlbumUserEntity =
|
||||||
late final i14.$MemoryAssetEntityTable memoryAssetEntity =
|
i13.$RemoteAlbumUserEntityTable(this);
|
||||||
i14.$MemoryAssetEntityTable(this);
|
late final i14.$MemoryEntityTable memoryEntity = i14.$MemoryEntityTable(this);
|
||||||
late final i15.$PersonEntityTable personEntity = i15.$PersonEntityTable(this);
|
late final i15.$MemoryAssetEntityTable memoryAssetEntity =
|
||||||
late final i16.$AssetFaceEntityTable assetFaceEntity =
|
i15.$MemoryAssetEntityTable(this);
|
||||||
i16.$AssetFaceEntityTable(this);
|
late final i16.$PersonEntityTable personEntity = i16.$PersonEntityTable(this);
|
||||||
i17.MergedAssetDrift get mergedAssetDrift => i18.ReadDatabaseContainer(this)
|
late final i17.$AssetFaceEntityTable assetFaceEntity =
|
||||||
.accessor<i17.MergedAssetDrift>(i17.MergedAssetDrift.new);
|
i17.$AssetFaceEntityTable(this);
|
||||||
|
i18.MergedAssetDrift get mergedAssetDrift => i19.ReadDatabaseContainer(this)
|
||||||
|
.accessor<i18.MergedAssetDrift>(i18.MergedAssetDrift.new);
|
||||||
@override
|
@override
|
||||||
Iterable<i0.TableInfo<i0.Table, Object?>> get allTables =>
|
Iterable<i0.TableInfo<i0.Table, Object?>> get allTables =>
|
||||||
allSchemaEntities.whereType<i0.TableInfo<i0.Table, Object?>>();
|
allSchemaEntities.whereType<i0.TableInfo<i0.Table, Object?>>();
|
||||||
@@ -84,6 +88,7 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
i4.idxLocalAssetChecksum,
|
i4.idxLocalAssetChecksum,
|
||||||
i2.uQRemoteAssetOwnerChecksum,
|
i2.uQRemoteAssetOwnerChecksum,
|
||||||
i2.idxRemoteAssetChecksum,
|
i2.idxRemoteAssetChecksum,
|
||||||
|
authUserEntity,
|
||||||
userMetadataEntity,
|
userMetadataEntity,
|
||||||
partnerEntity,
|
partnerEntity,
|
||||||
remoteExifEntity,
|
remoteExifEntity,
|
||||||
@@ -268,25 +273,27 @@ class $DriftManager {
|
|||||||
i5.$$LocalAlbumEntityTableTableManager(_db, _db.localAlbumEntity);
|
i5.$$LocalAlbumEntityTableTableManager(_db, _db.localAlbumEntity);
|
||||||
i6.$$LocalAlbumAssetEntityTableTableManager get localAlbumAssetEntity => i6
|
i6.$$LocalAlbumAssetEntityTableTableManager get localAlbumAssetEntity => i6
|
||||||
.$$LocalAlbumAssetEntityTableTableManager(_db, _db.localAlbumAssetEntity);
|
.$$LocalAlbumAssetEntityTableTableManager(_db, _db.localAlbumAssetEntity);
|
||||||
i7.$$UserMetadataEntityTableTableManager get userMetadataEntity =>
|
i7.$$AuthUserEntityTableTableManager get authUserEntity =>
|
||||||
i7.$$UserMetadataEntityTableTableManager(_db, _db.userMetadataEntity);
|
i7.$$AuthUserEntityTableTableManager(_db, _db.authUserEntity);
|
||||||
i8.$$PartnerEntityTableTableManager get partnerEntity =>
|
i8.$$UserMetadataEntityTableTableManager get userMetadataEntity =>
|
||||||
i8.$$PartnerEntityTableTableManager(_db, _db.partnerEntity);
|
i8.$$UserMetadataEntityTableTableManager(_db, _db.userMetadataEntity);
|
||||||
i9.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
i9.$$PartnerEntityTableTableManager get partnerEntity =>
|
||||||
i9.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
i9.$$PartnerEntityTableTableManager(_db, _db.partnerEntity);
|
||||||
i10.$$RemoteAlbumEntityTableTableManager get remoteAlbumEntity =>
|
i10.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
||||||
i10.$$RemoteAlbumEntityTableTableManager(_db, _db.remoteAlbumEntity);
|
i10.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
||||||
i11.$$RemoteAlbumAssetEntityTableTableManager get remoteAlbumAssetEntity =>
|
i11.$$RemoteAlbumEntityTableTableManager get remoteAlbumEntity =>
|
||||||
i11.$$RemoteAlbumAssetEntityTableTableManager(
|
i11.$$RemoteAlbumEntityTableTableManager(_db, _db.remoteAlbumEntity);
|
||||||
|
i12.$$RemoteAlbumAssetEntityTableTableManager get remoteAlbumAssetEntity =>
|
||||||
|
i12.$$RemoteAlbumAssetEntityTableTableManager(
|
||||||
_db, _db.remoteAlbumAssetEntity);
|
_db, _db.remoteAlbumAssetEntity);
|
||||||
i12.$$RemoteAlbumUserEntityTableTableManager get remoteAlbumUserEntity => i12
|
i13.$$RemoteAlbumUserEntityTableTableManager get remoteAlbumUserEntity => i13
|
||||||
.$$RemoteAlbumUserEntityTableTableManager(_db, _db.remoteAlbumUserEntity);
|
.$$RemoteAlbumUserEntityTableTableManager(_db, _db.remoteAlbumUserEntity);
|
||||||
i13.$$MemoryEntityTableTableManager get memoryEntity =>
|
i14.$$MemoryEntityTableTableManager get memoryEntity =>
|
||||||
i13.$$MemoryEntityTableTableManager(_db, _db.memoryEntity);
|
i14.$$MemoryEntityTableTableManager(_db, _db.memoryEntity);
|
||||||
i14.$$MemoryAssetEntityTableTableManager get memoryAssetEntity =>
|
i15.$$MemoryAssetEntityTableTableManager get memoryAssetEntity =>
|
||||||
i14.$$MemoryAssetEntityTableTableManager(_db, _db.memoryAssetEntity);
|
i15.$$MemoryAssetEntityTableTableManager(_db, _db.memoryAssetEntity);
|
||||||
i15.$$PersonEntityTableTableManager get personEntity =>
|
i16.$$PersonEntityTableTableManager get personEntity =>
|
||||||
i15.$$PersonEntityTableTableManager(_db, _db.personEntity);
|
i16.$$PersonEntityTableTableManager(_db, _db.personEntity);
|
||||||
i16.$$AssetFaceEntityTableTableManager get assetFaceEntity =>
|
i17.$$AssetFaceEntityTableTableManager get assetFaceEntity =>
|
||||||
i16.$$AssetFaceEntityTableTableManager(_db, _db.assetFaceEntity);
|
i17.$$AssetFaceEntityTableTableManager(_db, _db.assetFaceEntity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1707,10 +1707,470 @@ i1.GeneratedColumn<int> _column_82(String aliasedName) =>
|
|||||||
i1.GeneratedColumn<String> _column_83(String aliasedName) =>
|
i1.GeneratedColumn<String> _column_83(String aliasedName) =>
|
||||||
i1.GeneratedColumn<String>('source_type', aliasedName, false,
|
i1.GeneratedColumn<String>('source_type', aliasedName, false,
|
||||||
type: i1.DriftSqlType.string);
|
type: i1.DriftSqlType.string);
|
||||||
|
|
||||||
|
final class Schema5 extends i0.VersionedSchema {
|
||||||
|
Schema5({required super.database}) : super(version: 5);
|
||||||
|
@override
|
||||||
|
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||||
|
userEntity,
|
||||||
|
remoteAssetEntity,
|
||||||
|
stackEntity,
|
||||||
|
localAssetEntity,
|
||||||
|
localAlbumEntity,
|
||||||
|
localAlbumAssetEntity,
|
||||||
|
idxLocalAssetChecksum,
|
||||||
|
uQRemoteAssetOwnerChecksum,
|
||||||
|
idxRemoteAssetChecksum,
|
||||||
|
authUserEntity,
|
||||||
|
userMetadataEntity,
|
||||||
|
partnerEntity,
|
||||||
|
remoteExifEntity,
|
||||||
|
remoteAlbumEntity,
|
||||||
|
remoteAlbumAssetEntity,
|
||||||
|
remoteAlbumUserEntity,
|
||||||
|
memoryEntity,
|
||||||
|
memoryAssetEntity,
|
||||||
|
personEntity,
|
||||||
|
assetFaceEntity,
|
||||||
|
];
|
||||||
|
late final Shape16 userEntity = Shape16(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_3,
|
||||||
|
_column_18,
|
||||||
|
_column_84,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape1 remoteAssetEntity = Shape1(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_1,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_12,
|
||||||
|
_column_0,
|
||||||
|
_column_13,
|
||||||
|
_column_14,
|
||||||
|
_column_15,
|
||||||
|
_column_16,
|
||||||
|
_column_17,
|
||||||
|
_column_18,
|
||||||
|
_column_19,
|
||||||
|
_column_20,
|
||||||
|
_column_21,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape3 stackEntity = Shape3(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'stack_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_15,
|
||||||
|
_column_75,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape2 localAssetEntity = Shape2(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_1,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_12,
|
||||||
|
_column_0,
|
||||||
|
_column_22,
|
||||||
|
_column_14,
|
||||||
|
_column_23,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape6 localAlbumEntity = Shape6(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_album_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_5,
|
||||||
|
_column_31,
|
||||||
|
_column_32,
|
||||||
|
_column_33,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape7 localAlbumAssetEntity = Shape7(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_album_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(asset_id, album_id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_34,
|
||||||
|
_column_35,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
final i1.Index idxLocalAssetChecksum = i1.Index('idx_local_asset_checksum',
|
||||||
|
'CREATE INDEX idx_local_asset_checksum ON local_asset_entity (checksum)');
|
||||||
|
final i1.Index uQRemoteAssetOwnerChecksum = i1.Index(
|
||||||
|
'UQ_remote_asset_owner_checksum',
|
||||||
|
'CREATE UNIQUE INDEX UQ_remote_asset_owner_checksum ON remote_asset_entity (checksum, owner_id)');
|
||||||
|
final i1.Index idxRemoteAssetChecksum = i1.Index('idx_remote_asset_checksum',
|
||||||
|
'CREATE INDEX idx_remote_asset_checksum ON remote_asset_entity (checksum)');
|
||||||
|
late final Shape17 authUserEntity = Shape17(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'auth_user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_3,
|
||||||
|
_column_18,
|
||||||
|
_column_84,
|
||||||
|
_column_2,
|
||||||
|
_column_85,
|
||||||
|
_column_86,
|
||||||
|
_column_87,
|
||||||
|
_column_88,
|
||||||
|
_column_6,
|
||||||
|
_column_7,
|
||||||
|
_column_89,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape4 userMetadataEntity = Shape4(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'user_metadata_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(user_id, "key")',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_25,
|
||||||
|
_column_26,
|
||||||
|
_column_27,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape5 partnerEntity = Shape5(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'partner_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(shared_by_id, shared_with_id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_28,
|
||||||
|
_column_29,
|
||||||
|
_column_30,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape8 remoteExifEntity = Shape8(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_exif_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(asset_id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_36,
|
||||||
|
_column_37,
|
||||||
|
_column_38,
|
||||||
|
_column_39,
|
||||||
|
_column_40,
|
||||||
|
_column_41,
|
||||||
|
_column_11,
|
||||||
|
_column_10,
|
||||||
|
_column_42,
|
||||||
|
_column_43,
|
||||||
|
_column_44,
|
||||||
|
_column_45,
|
||||||
|
_column_46,
|
||||||
|
_column_47,
|
||||||
|
_column_48,
|
||||||
|
_column_49,
|
||||||
|
_column_50,
|
||||||
|
_column_51,
|
||||||
|
_column_52,
|
||||||
|
_column_53,
|
||||||
|
_column_54,
|
||||||
|
_column_55,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape9 remoteAlbumEntity = Shape9(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_56,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_15,
|
||||||
|
_column_57,
|
||||||
|
_column_58,
|
||||||
|
_column_59,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape7 remoteAlbumAssetEntity = Shape7(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(asset_id, album_id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_36,
|
||||||
|
_column_60,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape10 remoteAlbumUserEntity = Shape10(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(album_id, user_id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_60,
|
||||||
|
_column_25,
|
||||||
|
_column_61,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape11 memoryEntity = Shape11(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'memory_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_18,
|
||||||
|
_column_15,
|
||||||
|
_column_8,
|
||||||
|
_column_62,
|
||||||
|
_column_63,
|
||||||
|
_column_64,
|
||||||
|
_column_65,
|
||||||
|
_column_66,
|
||||||
|
_column_67,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape12 memoryAssetEntity = Shape12(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'memory_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(asset_id, memory_id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_36,
|
||||||
|
_column_68,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape14 personEntity = Shape14(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'person_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_15,
|
||||||
|
_column_1,
|
||||||
|
_column_69,
|
||||||
|
_column_71,
|
||||||
|
_column_72,
|
||||||
|
_column_73,
|
||||||
|
_column_74,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape15 assetFaceEntity = Shape15(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'asset_face_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: [
|
||||||
|
'PRIMARY KEY(id)',
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_36,
|
||||||
|
_column_76,
|
||||||
|
_column_77,
|
||||||
|
_column_78,
|
||||||
|
_column_79,
|
||||||
|
_column_80,
|
||||||
|
_column_81,
|
||||||
|
_column_82,
|
||||||
|
_column_83,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Shape16 extends i0.VersionedTable {
|
||||||
|
Shape16({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<String> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get name =>
|
||||||
|
columnsByName['name']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get email =>
|
||||||
|
columnsByName['email']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<DateTime> get deletedAt =>
|
||||||
|
columnsByName['deleted_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
i1.GeneratedColumn<int> get avatarColor =>
|
||||||
|
columnsByName['avatar_color']! as i1.GeneratedColumn<int>;
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.GeneratedColumn<int> _column_84(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<int>('avatar_color', aliasedName, true,
|
||||||
|
type: i1.DriftSqlType.int);
|
||||||
|
|
||||||
|
class Shape17 extends i0.VersionedTable {
|
||||||
|
Shape17({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<String> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get name =>
|
||||||
|
columnsByName['name']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get email =>
|
||||||
|
columnsByName['email']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<DateTime> get deletedAt =>
|
||||||
|
columnsByName['deleted_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
i1.GeneratedColumn<int> get avatarColor =>
|
||||||
|
columnsByName['avatar_color']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<bool> get isAdmin =>
|
||||||
|
columnsByName['is_admin']! as i1.GeneratedColumn<bool>;
|
||||||
|
i1.GeneratedColumn<String> get oauthId =>
|
||||||
|
columnsByName['oauth_id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get pinCode =>
|
||||||
|
columnsByName['pin_code']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<bool> get hasProfileImage =>
|
||||||
|
columnsByName['has_profile_image']! as i1.GeneratedColumn<bool>;
|
||||||
|
i1.GeneratedColumn<DateTime> get profileChangedAt =>
|
||||||
|
columnsByName['profile_changed_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
i1.GeneratedColumn<int> get quotaSizeInBytes =>
|
||||||
|
columnsByName['quota_size_in_bytes']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get quotaUsageInBytes =>
|
||||||
|
columnsByName['quota_usage_in_bytes']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<String> get storageLabel =>
|
||||||
|
columnsByName['storage_label']! as i1.GeneratedColumn<String>;
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.GeneratedColumn<String> _column_85(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<String>('oauth_id', aliasedName, false,
|
||||||
|
type: i1.DriftSqlType.string,
|
||||||
|
defaultValue: const CustomExpression('\'\''));
|
||||||
|
i1.GeneratedColumn<String> _column_86(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<String>('pin_code', aliasedName, true,
|
||||||
|
type: i1.DriftSqlType.string);
|
||||||
|
i1.GeneratedColumn<bool> _column_87(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<bool>('has_profile_image', aliasedName, false,
|
||||||
|
type: i1.DriftSqlType.bool,
|
||||||
|
defaultConstraints: i1.GeneratedColumn.constraintIsAlways(
|
||||||
|
'CHECK ("has_profile_image" IN (0, 1))'),
|
||||||
|
defaultValue: const CustomExpression('0'));
|
||||||
|
i1.GeneratedColumn<DateTime> _column_88(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<DateTime>('profile_changed_at', aliasedName, false,
|
||||||
|
type: i1.DriftSqlType.dateTime,
|
||||||
|
defaultValue: const CustomExpression('CURRENT_TIMESTAMP'));
|
||||||
|
i1.GeneratedColumn<String> _column_89(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<String>('storage_label', aliasedName, true,
|
||||||
|
type: i1.DriftSqlType.string);
|
||||||
i0.MigrationStepWithVersion migrationSteps({
|
i0.MigrationStepWithVersion migrationSteps({
|
||||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||||
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||||
}) {
|
}) {
|
||||||
return (currentVersion, database) async {
|
return (currentVersion, database) async {
|
||||||
switch (currentVersion) {
|
switch (currentVersion) {
|
||||||
@@ -1729,6 +2189,11 @@ i0.MigrationStepWithVersion migrationSteps({
|
|||||||
final migrator = i1.Migrator(database, schema);
|
final migrator = i1.Migrator(database, schema);
|
||||||
await from3To4(migrator, schema);
|
await from3To4(migrator, schema);
|
||||||
return 4;
|
return 4;
|
||||||
|
case 4:
|
||||||
|
final schema = Schema5(database: database);
|
||||||
|
final migrator = i1.Migrator(database, schema);
|
||||||
|
await from4To5(migrator, schema);
|
||||||
|
return 5;
|
||||||
default:
|
default:
|
||||||
throw ArgumentError.value('Unknown migration from $currentVersion');
|
throw ArgumentError.value('Unknown migration from $currentVersion');
|
||||||
}
|
}
|
||||||
@@ -1739,10 +2204,12 @@ i1.OnUpgrade stepByStep({
|
|||||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||||
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||||
}) =>
|
}) =>
|
||||||
i0.VersionedSchema.stepByStepHelper(
|
i0.VersionedSchema.stepByStepHelper(
|
||||||
step: migrationSteps(
|
step: migrationSteps(
|
||||||
from1To2: from1To2,
|
from1To2: from1To2,
|
||||||
from2To3: from2To3,
|
from2To3: from2To3,
|
||||||
from3To4: from3To4,
|
from3To4: from3To4,
|
||||||
|
from4To5: from4To5,
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ class IsarDeviceAssetRepository extends IsarDatabaseRepository {
|
|||||||
|
|
||||||
Future<bool> updateAll(List<DeviceAsset> assetHash) {
|
Future<bool> updateAll(List<DeviceAsset> assetHash) {
|
||||||
return transaction(() async {
|
return transaction(() async {
|
||||||
await _db.deviceAssetEntitys
|
await _db.deviceAssetEntitys.putAll(assetHash.map(DeviceAssetEntity.fromDto).toList());
|
||||||
.putAll(assetHash.map(DeviceAssetEntity.fromDto).toList());
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:immich_mobile/domain/models/exif.model.dart';
|
import 'package:immich_mobile/domain/models/exif.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart'
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart' as entity;
|
||||||
as entity;
|
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,7 @@ import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
|||||||
import 'package:immich_mobile/utils/database.utils.dart';
|
import 'package:immich_mobile/utils/database.utils.dart';
|
||||||
import 'package:platform/platform.dart';
|
import 'package:platform/platform.dart';
|
||||||
|
|
||||||
enum SortLocalAlbumsBy {
|
enum SortLocalAlbumsBy { id, backupSelection, isIosSharedAlbum, name, assetCount }
|
||||||
id,
|
|
||||||
backupSelection,
|
|
||||||
isIosSharedAlbum,
|
|
||||||
name,
|
|
||||||
assetCount
|
|
||||||
}
|
|
||||||
|
|
||||||
class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
||||||
final Drift _db;
|
final Drift _db;
|
||||||
@@ -43,12 +37,9 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
orderings.add(
|
orderings.add(
|
||||||
switch (sort) {
|
switch (sort) {
|
||||||
SortLocalAlbumsBy.id => OrderingTerm.asc(_db.localAlbumEntity.id),
|
SortLocalAlbumsBy.id => OrderingTerm.asc(_db.localAlbumEntity.id),
|
||||||
SortLocalAlbumsBy.backupSelection =>
|
SortLocalAlbumsBy.backupSelection => OrderingTerm.asc(_db.localAlbumEntity.backupSelection),
|
||||||
OrderingTerm.asc(_db.localAlbumEntity.backupSelection),
|
SortLocalAlbumsBy.isIosSharedAlbum => OrderingTerm.asc(_db.localAlbumEntity.isIosSharedAlbum),
|
||||||
SortLocalAlbumsBy.isIosSharedAlbum =>
|
SortLocalAlbumsBy.name => OrderingTerm.asc(_db.localAlbumEntity.name),
|
||||||
OrderingTerm.asc(_db.localAlbumEntity.isIosSharedAlbum),
|
|
||||||
SortLocalAlbumsBy.name =>
|
|
||||||
OrderingTerm.asc(_db.localAlbumEntity.name),
|
|
||||||
SortLocalAlbumsBy.assetCount => OrderingTerm.desc(assetCount),
|
SortLocalAlbumsBy.assetCount => OrderingTerm.desc(assetCount),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -58,9 +49,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
return query
|
return query
|
||||||
.map(
|
.map(
|
||||||
(row) => row
|
(row) => row.readTable(_db.localAlbumEntity).toDto(assetCount: row.read(assetCount) ?? 0),
|
||||||
.readTable(_db.localAlbumEntity)
|
|
||||||
.toDto(assetCount: row.read(assetCount) ?? 0),
|
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
@@ -69,15 +58,11 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
// Remove all assets that are only in this particular album
|
// Remove all assets that are only in this particular album
|
||||||
// We cannot remove all assets in the album because they might be in other albums in iOS
|
// We cannot remove all assets in the album because they might be in other albums in iOS
|
||||||
// That is not the case on Android since asset <-> album has one:one mapping
|
// That is not the case on Android since asset <-> album has one:one mapping
|
||||||
final assetsToDelete = _platform.isIOS
|
final assetsToDelete = _platform.isIOS ? await _getUniqueAssetsInAlbum(albumId) : await getAssetIds(albumId);
|
||||||
? await _getUniqueAssetsInAlbum(albumId)
|
|
||||||
: await getAssetIds(albumId);
|
|
||||||
await _deleteAssets(assetsToDelete);
|
await _deleteAssets(assetsToDelete);
|
||||||
|
|
||||||
// All the other assets that are still associated will be unlinked automatically on-cascade
|
// All the other assets that are still associated will be unlinked automatically on-cascade
|
||||||
await _db.managers.localAlbumEntity
|
await _db.managers.localAlbumEntity.filter((a) => a.id.equals(albumId)).delete();
|
||||||
.filter((a) => a.id.equals(albumId))
|
|
||||||
.delete();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<void> syncDeletes(
|
Future<void> syncDeletes(
|
||||||
@@ -95,13 +80,11 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.localAlbumEntity,
|
_db.localAlbumEntity,
|
||||||
_db.localAlbumAssetEntity.albumId
|
_db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id),
|
||||||
.equalsExp(_db.localAlbumEntity.id),
|
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
subQuery.where(
|
subQuery.where(
|
||||||
_db.localAlbumEntity.id.equals(albumId) &
|
_db.localAlbumEntity.id.equals(albumId) & _db.localAlbumAssetEntity.assetId.isNotIn(assetIdsToKeep),
|
||||||
_db.localAlbumAssetEntity.assetId.isNotIn(assetIdsToKeep),
|
|
||||||
);
|
);
|
||||||
return localAsset.id.isInQuery(subQuery);
|
return localAsset.id.isInQuery(subQuery);
|
||||||
});
|
});
|
||||||
@@ -122,8 +105,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return _db.transaction(() async {
|
return _db.transaction(() async {
|
||||||
await _db.localAlbumEntity
|
await _db.localAlbumEntity.insertOne(companion, onConflict: DoUpdate((_) => companion));
|
||||||
.insertOne(companion, onConflict: DoUpdate((_) => companion));
|
|
||||||
if (toUpsert.isNotEmpty) {
|
if (toUpsert.isNotEmpty) {
|
||||||
await _upsertAssets(toUpsert);
|
await _upsertAssets(toUpsert);
|
||||||
await _db.localAlbumAssetEntity.insertAll(
|
await _db.localAlbumAssetEntity.insertAll(
|
||||||
@@ -142,9 +124,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
Future<void> updateAll(Iterable<LocalAlbum> albums) {
|
Future<void> updateAll(Iterable<LocalAlbum> albums) {
|
||||||
return _db.transaction(() async {
|
return _db.transaction(() async {
|
||||||
await _db.localAlbumEntity
|
await _db.localAlbumEntity.update().write(const LocalAlbumEntityCompanion(marker_: Value(true)));
|
||||||
.update()
|
|
||||||
.write(const LocalAlbumEntityCompanion(marker_: Value(true)));
|
|
||||||
|
|
||||||
await _db.batch((batch) {
|
await _db.batch((batch) {
|
||||||
for (final album in albums) {
|
for (final album in albums) {
|
||||||
@@ -184,8 +164,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.localAlbumEntity,
|
_db.localAlbumEntity,
|
||||||
_db.localAlbumAssetEntity.albumId
|
_db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id),
|
||||||
.equalsExp(_db.localAlbumEntity.id),
|
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
subQuery.where(_db.localAlbumEntity.marker_.isNotNull());
|
subQuery.where(_db.localAlbumEntity.marker_.isNotNull());
|
||||||
@@ -209,18 +188,14 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
)
|
)
|
||||||
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
||||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
||||||
return query
|
return query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
||||||
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<String>> getAssetIds(String albumId) {
|
Future<List<String>> getAssetIds(String albumId) {
|
||||||
final query = _db.localAlbumAssetEntity.selectOnly()
|
final query = _db.localAlbumAssetEntity.selectOnly()
|
||||||
..addColumns([_db.localAlbumAssetEntity.assetId])
|
..addColumns([_db.localAlbumAssetEntity.assetId])
|
||||||
..where(_db.localAlbumAssetEntity.albumId.equals(albumId));
|
..where(_db.localAlbumAssetEntity.albumId.equals(albumId));
|
||||||
return query
|
return query.map((row) => row.read(_db.localAlbumAssetEntity.assetId)!).get();
|
||||||
.map((row) => row.read(_db.localAlbumAssetEntity.assetId)!)
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> processDelta({
|
Future<void> processDelta({
|
||||||
@@ -240,9 +215,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
assetAlbums.cast<String, List<Object?>>().forEach((assetId, albumIds) {
|
assetAlbums.cast<String, List<Object?>>().forEach((assetId, albumIds) {
|
||||||
batch.deleteWhere(
|
batch.deleteWhere(
|
||||||
_db.localAlbumAssetEntity,
|
_db.localAlbumAssetEntity,
|
||||||
(f) =>
|
(f) => f.albumId.isNotIn(albumIds.cast<String?>().nonNulls) & f.assetId.equals(assetId),
|
||||||
f.albumId.isNotIn(albumIds.cast<String?>().nonNulls) &
|
|
||||||
f.assetId.equals(assetId),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -273,14 +246,11 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumAssetEntity.albumId.equals(albumId) &
|
_db.localAlbumAssetEntity.albumId.equals(albumId) & _db.localAssetEntity.checksum.isNull(),
|
||||||
_db.localAssetEntity.checksum.isNull(),
|
|
||||||
)
|
)
|
||||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
||||||
|
|
||||||
return query
|
return query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
||||||
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _upsertAssets(Iterable<LocalAsset> localAssets) {
|
Future<void> _upsertAssets(Iterable<LocalAsset> localAssets) {
|
||||||
@@ -364,8 +334,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..addColumns([assetId])
|
..addColumns([assetId])
|
||||||
..groupBy(
|
..groupBy(
|
||||||
[assetId],
|
[assetId],
|
||||||
having: _db.localAlbumAssetEntity.albumId.count().equals(1) &
|
having: _db.localAlbumAssetEntity.albumId.count().equals(1) & _db.localAlbumAssetEntity.albumId.equals(albumId),
|
||||||
_db.localAlbumAssetEntity.albumId.equals(albumId),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.map((row) => row.read(assetId)!).get();
|
return query.map((row) => row.read(assetId)!).get();
|
||||||
@@ -392,9 +361,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)])
|
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)])
|
||||||
..limit(1);
|
..limit(1);
|
||||||
|
|
||||||
final results = await query
|
final results = await query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
||||||
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
|
||||||
.get();
|
|
||||||
|
|
||||||
return results.isNotEmpty ? results.first : null;
|
return results.isNotEmpty ? results.first : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
const DriftLocalAssetRepository(this._db) : super(_db);
|
const DriftLocalAssetRepository(this._db) : super(_db);
|
||||||
|
|
||||||
Stream<LocalAsset?> watchAsset(String id) {
|
Stream<LocalAsset?> watchAsset(String id) {
|
||||||
final query = _db.localAssetEntity
|
final query = _db.localAssetEntity.select().addColumns([_db.remoteAssetEntity.id]).join([
|
||||||
.select()
|
|
||||||
.addColumns([_db.remoteAssetEntity.id]).join([
|
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
@@ -58,8 +56,7 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<LocalAsset?> getById(String id) {
|
Future<LocalAsset?> getById(String id) {
|
||||||
final query = _db.localAssetEntity.select()
|
final query = _db.localAssetEntity.select()..where((lae) => lae.id.equals(id));
|
||||||
..where((lae) => lae.id.equals(id));
|
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).getSingleOrNull();
|
return query.map((row) => row.toDto()).getSingleOrNull();
|
||||||
}
|
}
|
||||||
@@ -69,8 +66,6 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getHashedCount() {
|
Future<int> getHashedCount() {
|
||||||
return _db.managers.localAssetEntity
|
return _db.managers.localAssetEntity.filter((e) => e.checksum.isNull().not()).count();
|
||||||
.filter((e) => e.checksum.isNull().not())
|
|
||||||
.count();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ class IsarLogRepository extends IsarDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<LogMessage>> getAll() async {
|
Future<List<LogMessage>> getAll() async {
|
||||||
final logs =
|
final logs = await _db.loggerMessages.where().sortByCreatedAtDesc().findAll();
|
||||||
await _db.loggerMessages.where().sortByCreatedAtDesc().findAll();
|
|
||||||
return logs.map((l) => l.toDto()).toList();
|
return logs.map((l) => l.toDto()).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,8 +27,7 @@ class IsarLogRepository extends IsarDatabaseRepository {
|
|||||||
|
|
||||||
Future<bool> insertAll(Iterable<LogMessage> logs) async {
|
Future<bool> insertAll(Iterable<LogMessage> logs) async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
final logEntities =
|
final logEntities = logs.map((log) => LoggerMessage.fromDto(log)).toList();
|
||||||
logs.map((log) => LoggerMessage.fromDto(log)).toList();
|
|
||||||
await _db.loggerMessages.putAll(logEntities);
|
await _db.loggerMessages.putAll(logEntities);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.remoteAssetEntity.id.equalsExp(_db.memoryAssetEntity.assetId) &
|
_db.remoteAssetEntity.id.equalsExp(_db.memoryAssetEntity.assetId) &
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
||||||
.equalsValue(AssetVisibility.timeline),
|
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(_db.memoryEntity.ownerId.equals(ownerId))
|
..where(_db.memoryEntity.ownerId.equals(ownerId))
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
final Drift _db;
|
final Drift _db;
|
||||||
const DriftPartnerRepository(this._db) : super(_db);
|
const DriftPartnerRepository(this._db) : super(_db);
|
||||||
|
|
||||||
Future<List<PartnerUserDto>> getPartners(String userId) {
|
Future<List<PartnerUser>> getPartners(String userId) {
|
||||||
final query = _db.select(_db.partnerEntity).join([
|
final query = _db.select(_db.partnerEntity).join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.userEntity,
|
_db.userEntity,
|
||||||
@@ -21,7 +21,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
return query.map((row) {
|
return query.map((row) {
|
||||||
final user = row.readTable(_db.userEntity);
|
final user = row.readTable(_db.userEntity);
|
||||||
final partner = row.readTable(_db.partnerEntity);
|
final partner = row.readTable(_db.partnerEntity);
|
||||||
return PartnerUserDto(
|
return PartnerUser(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -31,12 +31,11 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get users who we can share our library with
|
// Get users who we can share our library with
|
||||||
Future<List<PartnerUserDto>> getAvailablePartners(String currentUserId) {
|
Future<List<PartnerUser>> getAvailablePartners(String currentUserId) {
|
||||||
final query = _db.select(_db.userEntity)
|
final query = _db.select(_db.userEntity)..where((row) => row.id.equals(currentUserId).not());
|
||||||
..where((row) => row.id.equals(currentUserId).not());
|
|
||||||
|
|
||||||
return query.map((user) {
|
return query.map((user) {
|
||||||
return PartnerUserDto(
|
return PartnerUser(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -46,7 +45,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get users who are sharing their photos WITH the current user
|
// Get users who are sharing their photos WITH the current user
|
||||||
Future<List<PartnerUserDto>> getSharedWith(String partnerId) {
|
Future<List<PartnerUser>> getSharedWith(String partnerId) {
|
||||||
final query = _db.select(_db.partnerEntity).join([
|
final query = _db.select(_db.partnerEntity).join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.userEntity,
|
_db.userEntity,
|
||||||
@@ -60,7 +59,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
return query.map((row) {
|
return query.map((row) {
|
||||||
final user = row.readTable(_db.userEntity);
|
final user = row.readTable(_db.userEntity);
|
||||||
final partner = row.readTable(_db.partnerEntity);
|
final partner = row.readTable(_db.partnerEntity);
|
||||||
return PartnerUserDto(
|
return PartnerUser(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -70,7 +69,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get users who the current user is sharing their photos TO
|
// Get users who the current user is sharing their photos TO
|
||||||
Future<List<PartnerUserDto>> getSharedBy(String userId) {
|
Future<List<PartnerUser>> getSharedBy(String userId) {
|
||||||
final query = _db.select(_db.partnerEntity).join([
|
final query = _db.select(_db.partnerEntity).join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.userEntity,
|
_db.userEntity,
|
||||||
@@ -84,7 +83,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
return query.map((row) {
|
return query.map((row) {
|
||||||
final user = row.readTable(_db.userEntity);
|
final user = row.readTable(_db.userEntity);
|
||||||
final partner = row.readTable(_db.partnerEntity);
|
final partner = row.readTable(_db.partnerEntity);
|
||||||
return PartnerUserDto(
|
return PartnerUser(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -95,24 +94,19 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
Future<List<String>> getAllPartnerIds(String userId) async {
|
Future<List<String>> getAllPartnerIds(String userId) async {
|
||||||
// Get users who are sharing with me (sharedWithId = userId)
|
// Get users who are sharing with me (sharedWithId = userId)
|
||||||
final sharingWithMeQuery = _db.select(_db.partnerEntity)
|
final sharingWithMeQuery = _db.select(_db.partnerEntity)..where((tbl) => tbl.sharedWithId.equals(userId));
|
||||||
..where((tbl) => tbl.sharedWithId.equals(userId));
|
final sharingWithMe = await sharingWithMeQuery.map((row) => row.sharedById).get();
|
||||||
final sharingWithMe =
|
|
||||||
await sharingWithMeQuery.map((row) => row.sharedById).get();
|
|
||||||
|
|
||||||
// Get users who I am sharing with (sharedById = userId)
|
// Get users who I am sharing with (sharedById = userId)
|
||||||
final sharingWithThemQuery = _db.select(_db.partnerEntity)
|
final sharingWithThemQuery = _db.select(_db.partnerEntity)..where((tbl) => tbl.sharedById.equals(userId));
|
||||||
..where((tbl) => tbl.sharedById.equals(userId));
|
final sharingWithThem = await sharingWithThemQuery.map((row) => row.sharedWithId).get();
|
||||||
final sharingWithThem =
|
|
||||||
await sharingWithThemQuery.map((row) => row.sharedWithId).get();
|
|
||||||
|
|
||||||
// Combine both lists and remove duplicates
|
// Combine both lists and remove duplicates
|
||||||
final allPartnerIds =
|
final allPartnerIds = <String>{...sharingWithMe, ...sharingWithThem}.toList();
|
||||||
<String>{...sharingWithMe, ...sharingWithThem}.toList();
|
|
||||||
return allPartnerIds;
|
return allPartnerIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<PartnerUserDto?> getPartner(String partnerId, String userId) {
|
Future<PartnerUser?> getPartner(String partnerId, String userId) {
|
||||||
final query = _db.select(_db.partnerEntity).join([
|
final query = _db.select(_db.partnerEntity).join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.userEntity,
|
_db.userEntity,
|
||||||
@@ -120,14 +114,13 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.partnerEntity.sharedById.equals(partnerId) &
|
_db.partnerEntity.sharedById.equals(partnerId) & _db.partnerEntity.sharedWithId.equals(userId),
|
||||||
_db.partnerEntity.sharedWithId.equals(userId),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.map((row) {
|
return query.map((row) {
|
||||||
final user = row.readTable(_db.userEntity);
|
final user = row.readTable(_db.userEntity);
|
||||||
final partner = row.readTable(_db.partnerEntity);
|
final partner = row.readTable(_db.partnerEntity);
|
||||||
return PartnerUserDto(
|
return PartnerUser(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -136,7 +129,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
}).getSingleOrNull();
|
}).getSingleOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> toggleShowInTimeline(PartnerUserDto partner, String userId) {
|
Future<bool> toggleShowInTimeline(PartnerUser partner, String userId) {
|
||||||
return _db.partnerEntity.update().replace(
|
return _db.partnerEntity.update().replace(
|
||||||
PartnerEntityCompanion(
|
PartnerEntityCompanion(
|
||||||
sharedById: Value(partner.id),
|
sharedById: Value(partner.id),
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ class DriftPersonRepository extends DriftDatabaseRepository {
|
|||||||
const DriftPersonRepository(this._db) : super(_db);
|
const DriftPersonRepository(this._db) : super(_db);
|
||||||
|
|
||||||
Future<List<Person>> getAll(String userId) {
|
Future<List<Person>> getAll(String userId) {
|
||||||
final query = _db.personEntity.select()
|
final query = _db.personEntity.select()..where((e) => e.ownerId.equals(userId));
|
||||||
..where((e) => e.ownerId.equals(userId));
|
|
||||||
|
|
||||||
return query.map((person) {
|
return query.map((person) {
|
||||||
return person.toDto();
|
return person.toDto();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.
|
|||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
|
|
||||||
enum SortRemoteAlbumsBy { id, updatedAt }
|
enum SortRemoteAlbumsBy { id, updatedAt }
|
||||||
@@ -40,8 +41,7 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
]);
|
]);
|
||||||
query
|
query
|
||||||
..where(_db.remoteAssetEntity.deletedAt.isNull())
|
..where(_db.remoteAssetEntity.deletedAt.isNull())
|
||||||
..addColumns([assetCount])
|
..addColumns([assetCount, _db.userEntity.name])
|
||||||
..addColumns([_db.userEntity.name])
|
|
||||||
..groupBy([_db.remoteAlbumEntity.id]);
|
..groupBy([_db.remoteAlbumEntity.id]);
|
||||||
|
|
||||||
if (sortBy.isNotEmpty) {
|
if (sortBy.isNotEmpty) {
|
||||||
@@ -50,8 +50,7 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
orderings.add(
|
orderings.add(
|
||||||
switch (sort) {
|
switch (sort) {
|
||||||
SortRemoteAlbumsBy.id => OrderingTerm.asc(_db.remoteAlbumEntity.id),
|
SortRemoteAlbumsBy.id => OrderingTerm.asc(_db.remoteAlbumEntity.id),
|
||||||
SortRemoteAlbumsBy.updatedAt =>
|
SortRemoteAlbumsBy.updatedAt => OrderingTerm.desc(_db.remoteAlbumEntity.updatedAt),
|
||||||
OrderingTerm.desc(_db.remoteAlbumEntity.updatedAt),
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -137,8 +136,7 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.remoteAssetEntity.id
|
_db.remoteAssetEntity.id.equalsExp(_db.remoteAlbumAssetEntity.assetId),
|
||||||
.equalsExp(_db.remoteAlbumAssetEntity.assetId),
|
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -149,37 +147,18 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
}).getSingle();
|
}).getSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<UserDto>> getSharedUsers(String albumId) async {
|
Future<List<User>> getSharedUsers(String albumId) async {
|
||||||
final albumUserRows = await (_db.select(_db.remoteAlbumUserEntity)
|
final query = _db.remoteAlbumUserEntity.selectOnly()
|
||||||
..where((row) => row.albumId.equals(albumId)))
|
..join([
|
||||||
.get();
|
innerJoin(
|
||||||
|
_db.userEntity,
|
||||||
|
_db.userEntity.id.equalsExp(_db.remoteAlbumUserEntity.userId),
|
||||||
|
useColumns: true,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..where(_db.remoteAlbumUserEntity.albumId.equals(albumId));
|
||||||
|
|
||||||
if (albumUserRows.isEmpty) {
|
return query.map((row) => row.readTable(_db.userEntity).toDto()).get();
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
final userIds = albumUserRows.map((row) => row.userId);
|
|
||||||
|
|
||||||
return (_db.select(_db.userEntity)..where((row) => row.id.isIn(userIds)))
|
|
||||||
.map(
|
|
||||||
(user) => UserDto(
|
|
||||||
id: user.id,
|
|
||||||
email: user.email,
|
|
||||||
name: user.name,
|
|
||||||
profileImagePath: user.profileImagePath?.isEmpty == true
|
|
||||||
? null
|
|
||||||
: user.profileImagePath,
|
|
||||||
isAdmin: user.isAdmin,
|
|
||||||
updatedAt: user.updatedAt,
|
|
||||||
quotaSizeInBytes: user.quotaSizeInBytes ?? 0,
|
|
||||||
quotaUsageInBytes: user.quotaUsageInBytes,
|
|
||||||
memoryEnabled: true,
|
|
||||||
inTimeline: false,
|
|
||||||
isPartnerSharedBy: false,
|
|
||||||
isPartnerSharedWith: false,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<RemoteAsset>> getAssets(String albumId) {
|
Future<List<RemoteAsset>> getAssets(String albumId) {
|
||||||
@@ -191,9 +170,7 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
])
|
])
|
||||||
..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
||||||
|
|
||||||
return query
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
||||||
.map((row) => row.readTable(_db.remoteAssetEntity).toDto())
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> addAssets(String albumId, List<String> assetIds) async {
|
Future<int> addAssets(String albumId, List<String> assetIds) async {
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import 'package:drift/drift.dart';
|
|||||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.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/domain/models/exif.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/stack.model.dart';
|
import 'package:immich_mobile/domain/models/stack.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart'
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart' hide ExifInfo;
|
||||||
hide ExifInfo;
|
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart';
|
||||||
@@ -22,8 +21,7 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
(row) =>
|
(row) =>
|
||||||
_db.remoteAssetEntity.ownerId.equals(userId) &
|
_db.remoteAssetEntity.ownerId.equals(userId) &
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
||||||
.equalsValue(AssetVisibility.timeline),
|
|
||||||
)
|
)
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)])
|
..orderBy([(row) => OrderingTerm.desc(row.createdAt)])
|
||||||
..limit(10);
|
..limit(10);
|
||||||
@@ -57,8 +55,7 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
final query = _db.remoteAssetEntity.select()
|
final query = _db.remoteAssetEntity.select()
|
||||||
..where(
|
..where(
|
||||||
(row) =>
|
(row) => row.stackId.equals(asset.stackId!) & row.id.equals(asset.id).not(),
|
||||||
row.stackId.equals(asset.stackId!) & row.id.equals(asset.id).not(),
|
|
||||||
)
|
)
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)]);
|
..orderBy([(row) => OrderingTerm.desc(row.createdAt)]);
|
||||||
|
|
||||||
@@ -74,16 +71,14 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
Future<List<(String, String)>> getPlaces() {
|
Future<List<(String, String)>> getPlaces() {
|
||||||
final asset = Subquery(
|
final asset = Subquery(
|
||||||
_db.remoteAssetEntity.select()
|
_db.remoteAssetEntity.select()..orderBy([(row) => OrderingTerm.desc(row.createdAt)]),
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)]),
|
|
||||||
"asset",
|
"asset",
|
||||||
);
|
);
|
||||||
|
|
||||||
final query = asset.selectOnly().join([
|
final query = asset.selectOnly().join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteExifEntity,
|
_db.remoteExifEntity,
|
||||||
_db.remoteExifEntity.assetId
|
_db.remoteExifEntity.assetId.equalsExp(asset.ref(_db.remoteAssetEntity.id)),
|
||||||
.equalsExp(asset.ref(_db.remoteAssetEntity.id)),
|
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
@@ -94,9 +89,7 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
..where(
|
..where(
|
||||||
_db.remoteExifEntity.city.isNotNull() &
|
_db.remoteExifEntity.city.isNotNull() &
|
||||||
asset.ref(_db.remoteAssetEntity.deletedAt).isNull() &
|
asset.ref(_db.remoteAssetEntity.deletedAt).isNull() &
|
||||||
asset
|
asset.ref(_db.remoteAssetEntity.visibility).equals(AssetVisibility.timeline.index),
|
||||||
.ref(_db.remoteAssetEntity.visibility)
|
|
||||||
.equals(AssetVisibility.timeline.index),
|
|
||||||
)
|
)
|
||||||
..groupBy([_db.remoteExifEntity.city])
|
..groupBy([_db.remoteExifEntity.city])
|
||||||
..orderBy([OrderingTerm.asc(_db.remoteExifEntity.city)]);
|
..orderBy([OrderingTerm.asc(_db.remoteExifEntity.city)]);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart'
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart' hide AssetVisibility;
|
||||||
hide AssetVisibility;
|
|
||||||
import 'package:immich_mobile/infrastructure/repositories/api.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/api.repository.dart';
|
||||||
import 'package:immich_mobile/models/search/search_filter.model.dart';
|
import 'package:immich_mobile/models/search/search_filter.model.dart';
|
||||||
import 'package:openapi/api.dart';
|
import 'package:openapi/api.dart';
|
||||||
@@ -28,9 +27,7 @@ class SearchApiRepository extends ApiRepository {
|
|||||||
model: filter.camera.model,
|
model: filter.camera.model,
|
||||||
takenAfter: filter.date.takenAfter,
|
takenAfter: filter.date.takenAfter,
|
||||||
takenBefore: filter.date.takenBefore,
|
takenBefore: filter.date.takenBefore,
|
||||||
visibility: filter.display.isArchive
|
visibility: filter.display.isArchive ? AssetVisibility.archive : AssetVisibility.timeline,
|
||||||
? AssetVisibility.archive
|
|
||||||
: AssetVisibility.timeline,
|
|
||||||
isFavorite: filter.display.isFavorite ? true : null,
|
isFavorite: filter.display.isFavorite ? true : null,
|
||||||
isNotInAlbum: filter.display.isNotInAlbum ? true : null,
|
isNotInAlbum: filter.display.isNotInAlbum ? true : null,
|
||||||
personIds: filter.people.map((e) => e.id).toList(),
|
personIds: filter.people.map((e) => e.id).toList(),
|
||||||
@@ -43,23 +40,16 @@ class SearchApiRepository extends ApiRepository {
|
|||||||
|
|
||||||
return _api.searchAssets(
|
return _api.searchAssets(
|
||||||
MetadataSearchDto(
|
MetadataSearchDto(
|
||||||
originalFileName: filter.filename != null && filter.filename!.isNotEmpty
|
originalFileName: filter.filename != null && filter.filename!.isNotEmpty ? filter.filename : null,
|
||||||
? filter.filename
|
|
||||||
: null,
|
|
||||||
country: filter.location.country,
|
country: filter.location.country,
|
||||||
description:
|
description: filter.description != null && filter.description!.isNotEmpty ? filter.description : null,
|
||||||
filter.description != null && filter.description!.isNotEmpty
|
|
||||||
? filter.description
|
|
||||||
: null,
|
|
||||||
state: filter.location.state,
|
state: filter.location.state,
|
||||||
city: filter.location.city,
|
city: filter.location.city,
|
||||||
make: filter.camera.make,
|
make: filter.camera.make,
|
||||||
model: filter.camera.model,
|
model: filter.camera.model,
|
||||||
takenAfter: filter.date.takenAfter,
|
takenAfter: filter.date.takenAfter,
|
||||||
takenBefore: filter.date.takenBefore,
|
takenBefore: filter.date.takenBefore,
|
||||||
visibility: filter.display.isArchive
|
visibility: filter.display.isArchive ? AssetVisibility.archive : AssetVisibility.timeline,
|
||||||
? AssetVisibility.archive
|
|
||||||
: AssetVisibility.timeline,
|
|
||||||
isFavorite: filter.display.isFavorite ? true : null,
|
isFavorite: filter.display.isFavorite ? true : null,
|
||||||
isNotInAlbum: filter.display.isNotInAlbum ? true : null,
|
isNotInAlbum: filter.display.isNotInAlbum ? true : null,
|
||||||
personIds: filter.people.map((e) => e.id).toList(),
|
personIds: filter.people.map((e) => e.id).toList(),
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ class DriftStackRepository extends DriftDatabaseRepository {
|
|||||||
const DriftStackRepository(this._db) : super(_db);
|
const DriftStackRepository(this._db) : super(_db);
|
||||||
|
|
||||||
Future<List<Stack>> getAll(String userId) {
|
Future<List<Stack>> getAll(String userId) {
|
||||||
final query = _db.stackEntity.select()
|
final query = _db.stackEntity.select()..where((e) => e.ownerId.equals(userId));
|
||||||
..where((e) => e.ownerId.equals(userId));
|
|
||||||
|
|
||||||
return query.map((stack) {
|
return query.map((stack) {
|
||||||
return stack.toDto();
|
return stack.toDto();
|
||||||
|
|||||||
@@ -63,23 +63,17 @@ class IsarStoreRepository extends IsarDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<StoreDto<Object>> _toUpdateEvent(StoreValue entity) async {
|
Future<StoreDto<Object>> _toUpdateEvent(StoreValue entity) async {
|
||||||
final key = StoreKey.values.firstWhere((e) => e.id == entity.id)
|
final key = StoreKey.values.firstWhere((e) => e.id == entity.id) as StoreKey<Object>;
|
||||||
as StoreKey<Object>;
|
|
||||||
final value = await _toValue(key, entity);
|
final value = await _toValue(key, entity);
|
||||||
return StoreDto(key, value);
|
return StoreDto(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<T?> _toValue<T>(StoreKey<T> key, StoreValue entity) async =>
|
Future<T?> _toValue<T>(StoreKey<T> key, StoreValue entity) async => switch (key.type) {
|
||||||
switch (key.type) {
|
|
||||||
const (int) => entity.intValue,
|
const (int) => entity.intValue,
|
||||||
const (String) => entity.strValue,
|
const (String) => entity.strValue,
|
||||||
const (bool) => entity.intValue == 1,
|
const (bool) => entity.intValue == 1,
|
||||||
const (DateTime) => entity.intValue == null
|
const (DateTime) => entity.intValue == null ? null : DateTime.fromMillisecondsSinceEpoch(entity.intValue!),
|
||||||
? null
|
const (UserDto) => entity.strValue == null ? null : await IsarUserRepository(_db).getByUserId(entity.strValue!),
|
||||||
: DateTime.fromMillisecondsSinceEpoch(entity.intValue!),
|
|
||||||
const (UserDto) => entity.strValue == null
|
|
||||||
? null
|
|
||||||
: await IsarUserRepository(_db).getByUserId(entity.strValue!),
|
|
||||||
_ => null,
|
_ => null,
|
||||||
} as T?;
|
} as T?;
|
||||||
|
|
||||||
@@ -101,10 +95,7 @@ class IsarStoreRepository extends IsarDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<StoreDto<Object>>> getAll() async {
|
Future<List<StoreDto<Object>>> getAll() async {
|
||||||
final entities = await _db.storeValues
|
final entities = await _db.storeValues.filter().anyOf(validStoreKeys, (query, id) => query.idEqualTo(id)).findAll();
|
||||||
.filter()
|
|
||||||
.anyOf(validStoreKeys, (query, id) => query.idEqualTo(id))
|
|
||||||
.findAll();
|
|
||||||
return Future.wait(entities.map((e) => _toUpdateEvent(e)).toList());
|
return Future.wait(entities.map((e) => _toUpdateEvent(e)).toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class SyncApiRepository {
|
|||||||
request.body = jsonEncode(
|
request.body = jsonEncode(
|
||||||
SyncStreamDto(
|
SyncStreamDto(
|
||||||
types: [
|
types: [
|
||||||
|
SyncRequestType.authUsersV1,
|
||||||
SyncRequestType.usersV1,
|
SyncRequestType.usersV1,
|
||||||
SyncRequestType.assetsV1,
|
SyncRequestType.assetsV1,
|
||||||
SyncRequestType.assetExifsV1,
|
SyncRequestType.assetExifsV1,
|
||||||
@@ -112,8 +113,7 @@ class SyncApiRepository {
|
|||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
stopwatch.stop();
|
stopwatch.stop();
|
||||||
_logger
|
_logger.info("Remote Sync completed in ${stopwatch.elapsed.inMilliseconds}ms");
|
||||||
.info("Remote Sync completed in ${stopwatch.elapsed.inMilliseconds}ms");
|
|
||||||
DLog.log("Remote Sync completed in ${stopwatch.elapsed.inMilliseconds}ms");
|
DLog.log("Remote Sync completed in ${stopwatch.elapsed.inMilliseconds}ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +139,7 @@ class SyncApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const _kResponseMap = <SyncEntityType, Function(Object)>{
|
const _kResponseMap = <SyncEntityType, Function(Object)>{
|
||||||
|
SyncEntityType.authUserV1: SyncAuthUserV1.fromJson,
|
||||||
SyncEntityType.userV1: SyncUserV1.fromJson,
|
SyncEntityType.userV1: SyncUserV1.fromJson,
|
||||||
SyncEntityType.userDeleteV1: SyncUserDeleteV1.fromJson,
|
SyncEntityType.userDeleteV1: SyncUserDeleteV1.fromJson,
|
||||||
SyncEntityType.partnerV1: SyncPartnerV1.fromJson,
|
SyncEntityType.partnerV1: SyncPartnerV1.fromJson,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
|||||||
import 'package:immich_mobile/domain/models/memory.model.dart';
|
import 'package:immich_mobile/domain/models/memory.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart';
|
||||||
@@ -29,10 +30,41 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
SyncStreamRepository(super.db) : _db = db;
|
SyncStreamRepository(super.db) : _db = db;
|
||||||
|
|
||||||
|
Future<void> updateAuthUsersV1(Iterable<SyncAuthUserV1> data) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final authUser in data) {
|
||||||
|
final companion = AuthUserEntityCompanion(
|
||||||
|
name: Value(authUser.name),
|
||||||
|
email: Value(authUser.email),
|
||||||
|
deletedAt: Value(authUser.deletedAt),
|
||||||
|
avatarColor: Value(authUser.avatarColor?.toAvatarColor()),
|
||||||
|
isAdmin: Value(authUser.isAdmin),
|
||||||
|
oauthId: Value(authUser.oauthId),
|
||||||
|
pinCode: Value(authUser.pinCode),
|
||||||
|
hasProfileImage: Value(authUser.hasProfileImage),
|
||||||
|
profileChangedAt: Value(authUser.profileChangedAt),
|
||||||
|
quotaSizeInBytes: Value(authUser.quotaSizeInBytes),
|
||||||
|
quotaUsageInBytes: Value(authUser.quotaUsageInBytes),
|
||||||
|
storageLabel: Value(authUser.storageLabel),
|
||||||
|
);
|
||||||
|
|
||||||
|
batch.insert(
|
||||||
|
_db.authUserEntity,
|
||||||
|
companion.copyWith(id: Value(authUser.id)),
|
||||||
|
onConflict: DoUpdate((_) => companion),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error, stack) {
|
||||||
|
_logger.severe('Error: SyncAuthUserV1', error, stack);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> deleteUsersV1(Iterable<SyncUserDeleteV1> data) async {
|
Future<void> deleteUsersV1(Iterable<SyncUserDeleteV1> data) async {
|
||||||
try {
|
try {
|
||||||
await _db.userEntity
|
await _db.userEntity.deleteWhere((row) => row.id.isIn(data.map((e) => e.userId)));
|
||||||
.deleteWhere((row) => row.id.isIn(data.map((e) => e.userId)));
|
|
||||||
} catch (error, stack) {
|
} catch (error, stack) {
|
||||||
_logger.severe('Error: SyncUserDeleteV1', error, stack);
|
_logger.severe('Error: SyncUserDeleteV1', error, stack);
|
||||||
rethrow;
|
rethrow;
|
||||||
@@ -46,6 +78,8 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
final companion = UserEntityCompanion(
|
final companion = UserEntityCompanion(
|
||||||
name: Value(user.name),
|
name: Value(user.name),
|
||||||
email: Value(user.email),
|
email: Value(user.email),
|
||||||
|
deletedAt: Value(user.deletedAt),
|
||||||
|
avatarColor: Value(user.avatarColor?.toAvatarColor()),
|
||||||
);
|
);
|
||||||
|
|
||||||
batch.insert(
|
batch.insert(
|
||||||
@@ -84,8 +118,7 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
try {
|
try {
|
||||||
await _db.batch((batch) {
|
await _db.batch((batch) {
|
||||||
for (final partner in data) {
|
for (final partner in data) {
|
||||||
final companion =
|
final companion = PartnerEntityCompanion(inTimeline: Value(partner.inTimeline));
|
||||||
PartnerEntityCompanion(inTimeline: Value(partner.inTimeline));
|
|
||||||
|
|
||||||
batch.insert(
|
batch.insert(
|
||||||
_db.partnerEntity,
|
_db.partnerEntity,
|
||||||
@@ -129,8 +162,7 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
type: Value(asset.type.toAssetType()),
|
type: Value(asset.type.toAssetType()),
|
||||||
createdAt: Value.absentIfNull(asset.fileCreatedAt),
|
createdAt: Value.absentIfNull(asset.fileCreatedAt),
|
||||||
updatedAt: Value.absentIfNull(asset.fileModifiedAt),
|
updatedAt: Value.absentIfNull(asset.fileModifiedAt),
|
||||||
durationInSeconds:
|
durationInSeconds: Value(asset.duration?.toDuration()?.inSeconds ?? 0),
|
||||||
Value(asset.duration?.toDuration()?.inSeconds ?? 0),
|
|
||||||
checksum: Value(asset.checksum),
|
checksum: Value(asset.checksum),
|
||||||
isFavorite: Value(asset.isFavorite),
|
isFavorite: Value(asset.isFavorite),
|
||||||
ownerId: Value(asset.ownerId),
|
ownerId: Value(asset.ownerId),
|
||||||
@@ -607,6 +639,22 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension on UserAvatarColor {
|
||||||
|
AvatarColor toAvatarColor() => switch (this) {
|
||||||
|
UserAvatarColor.amber => AvatarColor.amber,
|
||||||
|
UserAvatarColor.blue => AvatarColor.blue,
|
||||||
|
UserAvatarColor.gray => AvatarColor.gray,
|
||||||
|
UserAvatarColor.green => AvatarColor.green,
|
||||||
|
UserAvatarColor.orange => AvatarColor.orange,
|
||||||
|
UserAvatarColor.pink => AvatarColor.pink,
|
||||||
|
UserAvatarColor.primary => AvatarColor.primary,
|
||||||
|
UserAvatarColor.purple => AvatarColor.purple,
|
||||||
|
UserAvatarColor.red => AvatarColor.red,
|
||||||
|
UserAvatarColor.yellow => AvatarColor.yellow,
|
||||||
|
_ => throw Exception('Unknown AvatarColor value: $this'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
extension on AssetTypeEnum {
|
extension on AssetTypeEnum {
|
||||||
AssetType toAssetType() => switch (this) {
|
AssetType toAssetType() => switch (this) {
|
||||||
AssetTypeEnum.IMAGE => AssetType.image,
|
AssetTypeEnum.IMAGE => AssetType.image,
|
||||||
@@ -662,9 +710,7 @@ extension on String {
|
|||||||
extension on String {
|
extension on String {
|
||||||
Duration? toDuration() {
|
Duration? toDuration() {
|
||||||
try {
|
try {
|
||||||
final parts = split(':')
|
final parts = split(':').map((e) => double.parse(e).toInt()).toList(growable: false);
|
||||||
.map((e) => double.parse(e).toInt())
|
|
||||||
.toList(growable: false);
|
|
||||||
|
|
||||||
return Duration(hours: parts[0], minutes: parts[1], seconds: parts[2]);
|
return Duration(hours: parts[0], minutes: parts[1], seconds: parts[2]);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
final query = _db.partnerEntity.selectOnly()
|
final query = _db.partnerEntity.selectOnly()
|
||||||
..addColumns([_db.partnerEntity.sharedById])
|
..addColumns([_db.partnerEntity.sharedById])
|
||||||
..where(
|
..where(
|
||||||
_db.partnerEntity.inTimeline.equals(true) &
|
_db.partnerEntity.inTimeline.equals(true) & _db.partnerEntity.sharedWithId.equals(userId),
|
||||||
_db.partnerEntity.sharedWithId.equals(userId),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return query
|
return query
|
||||||
@@ -173,8 +172,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
.equalsExp(_db.remoteAssetEntity.checksum),
|
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -219,10 +217,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (_db.remoteAlbumEntity.select()
|
return (_db.remoteAlbumEntity.select()..where((row) => row.id.equals(albumId))).watch().switchMap((albums) {
|
||||||
..where((row) => row.id.equals(albumId)))
|
|
||||||
.watch()
|
|
||||||
.switchMap((albums) {
|
|
||||||
if (albums.isEmpty) {
|
if (albums.isEmpty) {
|
||||||
return Stream.value(<Bucket>[]);
|
return Stream.value(<Bucket>[]);
|
||||||
}
|
}
|
||||||
@@ -237,14 +232,12 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAlbumAssetEntity,
|
_db.remoteAlbumAssetEntity,
|
||||||
_db.remoteAlbumAssetEntity.assetId
|
_db.remoteAlbumAssetEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
.equalsExp(_db.remoteAssetEntity.id),
|
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() & _db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
||||||
_db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
|
||||||
)
|
)
|
||||||
..groupBy([dateExp]);
|
..groupBy([dateExp]);
|
||||||
|
|
||||||
@@ -270,9 +263,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
required int offset,
|
required int offset,
|
||||||
required int count,
|
required int count,
|
||||||
}) async {
|
}) async {
|
||||||
final albumData = await (_db.remoteAlbumEntity.select()
|
final albumData = await _db.managers.remoteAlbumEntity.filter((row) => row.id.equals(albumId)).getSingleOrNull();
|
||||||
..where((row) => row.id.equals(albumId)))
|
|
||||||
.getSingleOrNull();
|
|
||||||
|
|
||||||
// If album doesn't exist (was deleted), return empty list
|
// If album doesn't exist (was deleted), return empty list
|
||||||
if (albumData == null) {
|
if (albumData == null) {
|
||||||
@@ -285,14 +276,12 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
[
|
[
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAlbumAssetEntity,
|
_db.remoteAlbumAssetEntity,
|
||||||
_db.remoteAlbumAssetEntity.assetId
|
_db.remoteAlbumAssetEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
.equalsExp(_db.remoteAssetEntity.id),
|
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)..where(
|
)..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() & _db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
||||||
_db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isAscending) {
|
if (isAscending) {
|
||||||
@@ -303,62 +292,44 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
query.limit(count, offset: offset);
|
query.limit(count, offset: offset);
|
||||||
|
|
||||||
return query
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
||||||
.map((row) => row.readTable(_db.remoteAssetEntity).toDto())
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineQuery fromAssets(List<BaseAsset> assets) => (
|
TimelineQuery fromAssets(List<BaseAsset> assets) => (
|
||||||
bucketSource: () => Stream.value(_generateBuckets(assets.length)),
|
bucketSource: () => Stream.value(_generateBuckets(assets.length)),
|
||||||
assetSource: (offset, count) =>
|
assetSource: (offset, count) => Future.value(assets.skip(offset).take(count).toList()),
|
||||||
Future.value(assets.skip(offset).take(count).toList()),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery remote(String ownerId, GroupAssetsBy groupBy) =>
|
TimelineQuery remote(String ownerId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
||||||
_remoteQueryBuilder(
|
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() &
|
row.deletedAt.isNull() & row.visibility.equalsValue(AssetVisibility.timeline) & row.ownerId.equals(ownerId),
|
||||||
row.visibility.equalsValue(AssetVisibility.timeline) &
|
|
||||||
row.ownerId.equals(ownerId),
|
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery favorite(String userId, GroupAssetsBy groupBy) =>
|
TimelineQuery favorite(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
||||||
_remoteQueryBuilder(
|
filter: (row) => row.deletedAt.isNull() & row.isFavorite.equals(true) & row.ownerId.equals(userId),
|
||||||
filter: (row) =>
|
|
||||||
row.deletedAt.isNull() &
|
|
||||||
row.isFavorite.equals(true) &
|
|
||||||
row.ownerId.equals(userId),
|
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery trash(String userId, GroupAssetsBy groupBy) =>
|
TimelineQuery trash(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
||||||
_remoteQueryBuilder(
|
|
||||||
filter: (row) => row.deletedAt.isNotNull() & row.ownerId.equals(userId),
|
filter: (row) => row.deletedAt.isNotNull() & row.ownerId.equals(userId),
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
joinLocal: true,
|
joinLocal: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery archived(String userId, GroupAssetsBy groupBy) =>
|
TimelineQuery archived(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
||||||
_remoteQueryBuilder(
|
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() &
|
row.deletedAt.isNull() & row.ownerId.equals(userId) & row.visibility.equalsValue(AssetVisibility.archive),
|
||||||
row.ownerId.equals(userId) &
|
|
||||||
row.visibility.equalsValue(AssetVisibility.archive),
|
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery locked(String userId, GroupAssetsBy groupBy) =>
|
TimelineQuery locked(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
||||||
_remoteQueryBuilder(
|
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() &
|
row.deletedAt.isNull() & row.visibility.equalsValue(AssetVisibility.locked) & row.ownerId.equals(userId),
|
||||||
row.visibility.equalsValue(AssetVisibility.locked) &
|
|
||||||
row.ownerId.equals(userId),
|
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery video(String userId, GroupAssetsBy groupBy) =>
|
TimelineQuery video(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
||||||
_remoteQueryBuilder(
|
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() &
|
row.deletedAt.isNull() &
|
||||||
row.type.equalsValue(AssetType.video) &
|
row.type.equalsValue(AssetType.video) &
|
||||||
@@ -405,8 +376,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
..where(
|
..where(
|
||||||
_db.remoteExifEntity.city.equals(place) &
|
_db.remoteExifEntity.city.equals(place) &
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
||||||
.equalsValue(AssetVisibility.timeline),
|
|
||||||
)
|
)
|
||||||
..groupBy([dateExp])
|
..groupBy([dateExp])
|
||||||
..orderBy([OrderingTerm.desc(dateExp)]);
|
..orderBy([OrderingTerm.desc(dateExp)]);
|
||||||
@@ -434,15 +404,12 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
)
|
)
|
||||||
..where(
|
..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
||||||
.equalsValue(AssetVisibility.timeline) &
|
|
||||||
_db.remoteExifEntity.city.equals(place),
|
_db.remoteExifEntity.city.equals(place),
|
||||||
)
|
)
|
||||||
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
..limit(count, offset: offset);
|
..limit(count, offset: offset);
|
||||||
return query
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
||||||
.map((row) => row.readTable(_db.remoteAssetEntity).toDto())
|
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineQuery _remoteQueryBuilder({
|
TimelineQuery _remoteQueryBuilder({
|
||||||
@@ -496,8 +463,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
final query = _db.remoteAssetEntity.select().join([
|
final query = _db.remoteAssetEntity.select().join([
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.localAssetEntity,
|
_db.localAssetEntity,
|
||||||
_db.remoteAssetEntity.checksum
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
.equalsExp(_db.localAssetEntity.checksum),
|
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
@@ -539,7 +505,7 @@ extension on Expression<DateTime> {
|
|||||||
// to create the correct time bucket
|
// to create the correct time bucket
|
||||||
final localTimeExp = modify(const DateTimeModifier.localTime());
|
final localTimeExp = modify(const DateTimeModifier.localTime());
|
||||||
return switch (groupBy) {
|
return switch (groupBy) {
|
||||||
GroupAssetsBy.day => localTimeExp.date,
|
GroupAssetsBy.day || GroupAssetsBy.auto => localTimeExp.date,
|
||||||
GroupAssetsBy.month => localTimeExp.strftime("%Y-%m"),
|
GroupAssetsBy.month => localTimeExp.strftime("%Y-%m"),
|
||||||
GroupAssetsBy.none => throw ArgumentError(
|
GroupAssetsBy.none => throw ArgumentError(
|
||||||
"GroupAssetsBy.none is not supported for date formatting",
|
"GroupAssetsBy.none is not supported for date formatting",
|
||||||
@@ -551,7 +517,7 @@ extension on Expression<DateTime> {
|
|||||||
extension on String {
|
extension on String {
|
||||||
DateTime dateFmt(GroupAssetsBy groupBy) {
|
DateTime dateFmt(GroupAssetsBy groupBy) {
|
||||||
final format = switch (groupBy) {
|
final format = switch (groupBy) {
|
||||||
GroupAssetsBy.day => "y-M-d",
|
GroupAssetsBy.day || GroupAssetsBy.auto => "y-M-d",
|
||||||
GroupAssetsBy.month => "y-M",
|
GroupAssetsBy.month => "y-M",
|
||||||
GroupAssetsBy.none => throw ArgumentError(
|
GroupAssetsBy.none => throw ArgumentError(
|
||||||
"GroupAssetsBy.none is not supported for date formatting",
|
"GroupAssetsBy.none is not supported for date formatting",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:immich_mobile/constants/enums.dart';
|
import 'package:immich_mobile/constants/enums.dart';
|
||||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.dart'
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart' as entity;
|
||||||
as entity;
|
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
@@ -11,18 +10,18 @@ class IsarUserRepository extends IsarDatabaseRepository {
|
|||||||
|
|
||||||
Future<void> delete(List<String> ids) async {
|
Future<void> delete(List<String> ids) async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
await _db.users.deleteAllById(ids);
|
await _db.isarUsers.deleteAllById(ids);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteAll() async {
|
Future<void> deleteAll() async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
await _db.users.clear();
|
await _db.isarUsers.clear();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<UserDto>> getAll({SortUserBy? sortBy}) async {
|
Future<List<UserDto>> getAll({SortUserBy? sortBy}) async {
|
||||||
return (await _db.users
|
return (await _db.isarUsers
|
||||||
.where()
|
.where()
|
||||||
.optional(
|
.optional(
|
||||||
sortBy != null,
|
sortBy != null,
|
||||||
@@ -36,31 +35,44 @@ class IsarUserRepository extends IsarDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<UserDto?> getByUserId(String id) async {
|
Future<UserDto?> getByUserId(String id) async {
|
||||||
return (await _db.users.getById(id))?.toDto();
|
return (await _db.isarUsers.getById(id))?.toDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<UserDto?>> getByUserIds(List<String> ids) async {
|
Future<List<UserDto?>> getByUserIds(List<String> ids) async {
|
||||||
return (await _db.users.getAllById(ids)).map((u) => u?.toDto()).toList();
|
return (await _db.isarUsers.getAllById(ids)).map((u) => u?.toDto()).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> insert(UserDto user) async {
|
Future<bool> insert(UserDto user) async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
await _db.users.put(entity.User.fromDto(user));
|
await _db.isarUsers.put(entity.IsarUser.fromDto(user));
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<UserDto> update(UserDto user) async {
|
Future<UserDto> update(UserDto user) async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
await _db.users.put(entity.User.fromDto(user));
|
await _db.isarUsers.put(entity.IsarUser.fromDto(user));
|
||||||
});
|
});
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> updateAll(List<UserDto> users) async {
|
Future<bool> updateAll(List<UserDto> users) async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
await _db.users.putAll(users.map(entity.User.fromDto).toList());
|
await _db.isarUsers.putAll(users.map(entity.IsarUser.fromDto).toList());
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DriftUserRepository extends DriftDatabaseRepository {
|
||||||
|
final Drift _db;
|
||||||
|
const DriftUserRepository(this._db) : super(_db);
|
||||||
|
|
||||||
|
Future<List<User>> getAll() {
|
||||||
|
return _db.managers.userEntity.orderBy((row) => row.id.asc()).map((row) => row.toDto()).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<User?> getById(String id) {
|
||||||
|
return _db.managers.userEntity.filter((row) => row.id.equals(id)).map((row) => row.toDto()).getSingleOrNull();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ class UserApiRepository extends ApiRepository {
|
|||||||
const UserApiRepository(this._api);
|
const UserApiRepository(this._api);
|
||||||
|
|
||||||
Future<UserDto?> getMyUser() async {
|
Future<UserDto?> getMyUser() async {
|
||||||
final (adminDto, preferenceDto) =
|
final (adminDto, preferenceDto) = await (_api.getMyUser(), _api.getMyPreferences()).wait;
|
||||||
await (_api.getMyUser(), _api.getMyPreferences()).wait;
|
|
||||||
if (adminDto == null) return null;
|
if (adminDto == null) return null;
|
||||||
|
|
||||||
return UserConverter.fromAdminDto(adminDto, preferenceDto);
|
return UserConverter.fromAdminDto(adminDto, preferenceDto);
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ class DriftUserMetadataRepository extends DriftDatabaseRepository {
|
|||||||
const DriftUserMetadataRepository(this._db) : super(_db);
|
const DriftUserMetadataRepository(this._db) : super(_db);
|
||||||
|
|
||||||
Future<List<UserMetadata>> getUserMetadata(String userId) {
|
Future<List<UserMetadata>> getUserMetadata(String userId) {
|
||||||
final query = _db.userMetadataEntity.select()
|
final query = _db.userMetadataEntity.select()..where((e) => e.userId.equals(userId));
|
||||||
..where((e) => e.userId.equals(userId));
|
|
||||||
|
|
||||||
return query.map((userMetadata) {
|
return query.map((userMetadata) {
|
||||||
return userMetadata.toDto();
|
return userMetadata.toDto();
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ class ImmichApp extends ConsumerStatefulWidget {
|
|||||||
ImmichAppState createState() => ImmichAppState();
|
ImmichAppState createState() => ImmichAppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImmichAppState extends ConsumerState<ImmichApp>
|
class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserver {
|
||||||
with WidgetsBindingObserver {
|
|
||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@@ -168,9 +167,7 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
// Android 8 does not support transparent app bars
|
// Android 8 does not support transparent app bars
|
||||||
final info = await DeviceInfoPlugin().androidInfo;
|
final info = await DeviceInfoPlugin().androidInfo;
|
||||||
if (info.version.sdkInt <= 26) {
|
if (info.version.sdkInt <= 26) {
|
||||||
overlayStyle = context.isDarkTheme
|
overlayStyle = context.isDarkTheme ? SystemUiOverlayStyle.dark : SystemUiOverlayStyle.light;
|
||||||
? SystemUiOverlayStyle.dark
|
|
||||||
: SystemUiOverlayStyle.light;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemChrome.setSystemUIOverlayStyle(overlayStyle);
|
SystemChrome.setSystemUIOverlayStyle(overlayStyle);
|
||||||
@@ -222,8 +219,7 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
final deepLinkHandler = ref.read(deepLinkServiceProvider);
|
final deepLinkHandler = ref.read(deepLinkServiceProvider);
|
||||||
final currentRouteName = ref.read(currentRouteNameProvider.notifier).state;
|
final currentRouteName = ref.read(currentRouteNameProvider.notifier).state;
|
||||||
|
|
||||||
final isColdStart =
|
final isColdStart = currentRouteName == null || currentRouteName == SplashScreenRoute.name;
|
||||||
currentRouteName == null || currentRouteName == SplashScreenRoute.name;
|
|
||||||
|
|
||||||
if (deepLink.uri.scheme == "immich") {
|
if (deepLink.uri.scheme == "immich") {
|
||||||
final proposedRoute = await deepLinkHandler.handleScheme(
|
final proposedRoute = await deepLinkHandler.handleScheme(
|
||||||
@@ -299,8 +295,7 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
),
|
),
|
||||||
routerConfig: router.config(
|
routerConfig: router.config(
|
||||||
deepLinkBuilder: _deepLinkBuilder,
|
deepLinkBuilder: _deepLinkBuilder,
|
||||||
navigatorObservers: () =>
|
navigatorObservers: () => [AppNavigationObserver(ref: ref), HeroController()],
|
||||||
[AppNavigationObserver(ref: ref), HeroController()],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -56,12 +56,7 @@ class Activity {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return id.hashCode ^
|
return id.hashCode ^ assetId.hashCode ^ comment.hashCode ^ createdAt.hashCode ^ type.hashCode ^ user.hashCode;
|
||||||
assetId.hashCode ^
|
|
||||||
comment.hashCode ^
|
|
||||||
createdAt.hashCode ^
|
|
||||||
type.hashCode ^
|
|
||||||
user.hashCode;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,16 +32,14 @@ class AlbumAddAssetsResponse {
|
|||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() => 'AddAssetsResponse(alreadyInAlbum: $alreadyInAlbum, successfullyAdded: $successfullyAdded)';
|
||||||
'AddAssetsResponse(alreadyInAlbum: $alreadyInAlbum, successfullyAdded: $successfullyAdded)';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(covariant AlbumAddAssetsResponse other) {
|
bool operator ==(covariant AlbumAddAssetsResponse other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
final listEquals = const DeepCollectionEquality().equals;
|
final listEquals = const DeepCollectionEquality().equals;
|
||||||
|
|
||||||
return listEquals(other.alreadyInAlbum, alreadyInAlbum) &&
|
return listEquals(other.alreadyInAlbum, alreadyInAlbum) && other.successfullyAdded == successfullyAdded;
|
||||||
other.successfullyAdded == successfullyAdded;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ class AlbumViewerPageState {
|
|||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory AlbumViewerPageState.fromJson(String source) =>
|
factory AlbumViewerPageState.fromJson(String source) => AlbumViewerPageState.fromMap(json.decode(source));
|
||||||
AlbumViewerPageState.fromMap(json.decode(source));
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() =>
|
||||||
@@ -61,8 +60,5 @@ class AlbumViewerPageState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => isEditAlbum.hashCode ^ editTitleText.hashCode ^ editDescriptionText.hashCode;
|
||||||
isEditAlbum.hashCode ^
|
|
||||||
editTitleText.hashCode ^
|
|
||||||
editDescriptionText.hashCode;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ class AssetSelectionPageResult {
|
|||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
final setEquals = const DeepCollectionEquality().equals;
|
final setEquals = const DeepCollectionEquality().equals;
|
||||||
|
|
||||||
return other is AssetSelectionPageResult &&
|
return other is AssetSelectionPageResult && setEquals(other.selectedAssets, selectedAssets);
|
||||||
setEquals(other.selectedAssets, selectedAssets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -48,9 +48,5 @@ class AssetSelectionState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => hasRemote.hashCode ^ hasLocal.hashCode ^ hasMerged.hashCode ^ selectedCount.hashCode;
|
||||||
hasRemote.hashCode ^
|
|
||||||
hasLocal.hashCode ^
|
|
||||||
hasMerged.hashCode ^
|
|
||||||
selectedCount.hashCode;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,8 +97,7 @@ class AuxCheckStatus {
|
|||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory AuxCheckStatus.fromJson(String source) =>
|
factory AuxCheckStatus.fromJson(String source) => AuxCheckStatus.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||||
AuxCheckStatus.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'AuxCheckStatus(name: $name)';
|
String toString() => 'AuxCheckStatus(name: $name)';
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ class BiometricStatus {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() => 'BiometricStatus(availableBiometrics: $availableBiometrics, canAuthenticate: $canAuthenticate)';
|
||||||
'BiometricStatus(availableBiometrics: $availableBiometrics, canAuthenticate: $canAuthenticate)';
|
|
||||||
|
|
||||||
BiometricStatus copyWith({
|
BiometricStatus copyWith({
|
||||||
List<BiometricType>? availableBiometrics,
|
List<BiometricType>? availableBiometrics,
|
||||||
@@ -29,8 +28,7 @@ class BiometricStatus {
|
|||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
final listEquals = const DeepCollectionEquality().equals;
|
final listEquals = const DeepCollectionEquality().equals;
|
||||||
|
|
||||||
return listEquals(other.availableBiometrics, availableBiometrics) &&
|
return listEquals(other.availableBiometrics, availableBiometrics) && other.canAuthenticate == canAuthenticate;
|
||||||
other.canAuthenticate == canAuthenticate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ class AvailableAlbum {
|
|||||||
bool get isAll => album.isAll;
|
bool get isAll => album.isAll;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() => 'AvailableAlbum(albumEntity: $album, lastBackup: $lastBackup)';
|
||||||
'AvailableAlbum(albumEntity: $album, lastBackup: $lastBackup)';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
|
|||||||
@@ -8,13 +8,7 @@ import 'package:immich_mobile/models/backup/available_album.model.dart';
|
|||||||
import 'package:immich_mobile/models/backup/current_upload_asset.model.dart';
|
import 'package:immich_mobile/models/backup/current_upload_asset.model.dart';
|
||||||
import 'package:immich_mobile/models/server_info/server_disk_info.model.dart';
|
import 'package:immich_mobile/models/server_info/server_disk_info.model.dart';
|
||||||
|
|
||||||
enum BackUpProgressEnum {
|
enum BackUpProgressEnum { idle, inProgress, manualInProgress, inBackground, done }
|
||||||
idle,
|
|
||||||
inProgress,
|
|
||||||
manualInProgress,
|
|
||||||
inBackground,
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
class BackUpState {
|
class BackUpState {
|
||||||
// enum
|
// enum
|
||||||
@@ -105,26 +99,21 @@ class BackUpState {
|
|||||||
progressInFileSize: progressInFileSize ?? this.progressInFileSize,
|
progressInFileSize: progressInFileSize ?? this.progressInFileSize,
|
||||||
progressInFileSpeed: progressInFileSpeed ?? this.progressInFileSpeed,
|
progressInFileSpeed: progressInFileSpeed ?? this.progressInFileSpeed,
|
||||||
progressInFileSpeeds: progressInFileSpeeds ?? this.progressInFileSpeeds,
|
progressInFileSpeeds: progressInFileSpeeds ?? this.progressInFileSpeeds,
|
||||||
progressInFileSpeedUpdateTime:
|
progressInFileSpeedUpdateTime: progressInFileSpeedUpdateTime ?? this.progressInFileSpeedUpdateTime,
|
||||||
progressInFileSpeedUpdateTime ?? this.progressInFileSpeedUpdateTime,
|
progressInFileSpeedUpdateSentBytes: progressInFileSpeedUpdateSentBytes ?? this.progressInFileSpeedUpdateSentBytes,
|
||||||
progressInFileSpeedUpdateSentBytes: progressInFileSpeedUpdateSentBytes ??
|
iCloudDownloadProgress: iCloudDownloadProgress ?? this.iCloudDownloadProgress,
|
||||||
this.progressInFileSpeedUpdateSentBytes,
|
|
||||||
iCloudDownloadProgress:
|
|
||||||
iCloudDownloadProgress ?? this.iCloudDownloadProgress,
|
|
||||||
cancelToken: cancelToken ?? this.cancelToken,
|
cancelToken: cancelToken ?? this.cancelToken,
|
||||||
serverInfo: serverInfo ?? this.serverInfo,
|
serverInfo: serverInfo ?? this.serverInfo,
|
||||||
autoBackup: autoBackup ?? this.autoBackup,
|
autoBackup: autoBackup ?? this.autoBackup,
|
||||||
backgroundBackup: backgroundBackup ?? this.backgroundBackup,
|
backgroundBackup: backgroundBackup ?? this.backgroundBackup,
|
||||||
backupRequireWifi: backupRequireWifi ?? this.backupRequireWifi,
|
backupRequireWifi: backupRequireWifi ?? this.backupRequireWifi,
|
||||||
backupRequireCharging:
|
backupRequireCharging: backupRequireCharging ?? this.backupRequireCharging,
|
||||||
backupRequireCharging ?? this.backupRequireCharging,
|
|
||||||
backupTriggerDelay: backupTriggerDelay ?? this.backupTriggerDelay,
|
backupTriggerDelay: backupTriggerDelay ?? this.backupTriggerDelay,
|
||||||
availableAlbums: availableAlbums ?? this.availableAlbums,
|
availableAlbums: availableAlbums ?? this.availableAlbums,
|
||||||
selectedBackupAlbums: selectedBackupAlbums ?? this.selectedBackupAlbums,
|
selectedBackupAlbums: selectedBackupAlbums ?? this.selectedBackupAlbums,
|
||||||
excludedBackupAlbums: excludedBackupAlbums ?? this.excludedBackupAlbums,
|
excludedBackupAlbums: excludedBackupAlbums ?? this.excludedBackupAlbums,
|
||||||
allUniqueAssets: allUniqueAssets ?? this.allUniqueAssets,
|
allUniqueAssets: allUniqueAssets ?? this.allUniqueAssets,
|
||||||
selectedAlbumsBackupAssetsIds:
|
selectedAlbumsBackupAssetsIds: selectedAlbumsBackupAssetsIds ?? this.selectedAlbumsBackupAssetsIds,
|
||||||
selectedAlbumsBackupAssetsIds ?? this.selectedAlbumsBackupAssetsIds,
|
|
||||||
currentUploadAsset: currentUploadAsset ?? this.currentUploadAsset,
|
currentUploadAsset: currentUploadAsset ?? this.currentUploadAsset,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -146,8 +135,7 @@ class BackUpState {
|
|||||||
other.progressInFileSpeed == progressInFileSpeed &&
|
other.progressInFileSpeed == progressInFileSpeed &&
|
||||||
collectionEquals(other.progressInFileSpeeds, progressInFileSpeeds) &&
|
collectionEquals(other.progressInFileSpeeds, progressInFileSpeeds) &&
|
||||||
other.progressInFileSpeedUpdateTime == progressInFileSpeedUpdateTime &&
|
other.progressInFileSpeedUpdateTime == progressInFileSpeedUpdateTime &&
|
||||||
other.progressInFileSpeedUpdateSentBytes ==
|
other.progressInFileSpeedUpdateSentBytes == progressInFileSpeedUpdateSentBytes &&
|
||||||
progressInFileSpeedUpdateSentBytes &&
|
|
||||||
other.iCloudDownloadProgress == iCloudDownloadProgress &&
|
other.iCloudDownloadProgress == iCloudDownloadProgress &&
|
||||||
other.cancelToken == cancelToken &&
|
other.cancelToken == cancelToken &&
|
||||||
other.serverInfo == serverInfo &&
|
other.serverInfo == serverInfo &&
|
||||||
|
|||||||
@@ -53,13 +53,11 @@ class CurrentUploadAsset {
|
|||||||
factory CurrentUploadAsset.fromMap(Map<String, dynamic> map) {
|
factory CurrentUploadAsset.fromMap(Map<String, dynamic> map) {
|
||||||
return CurrentUploadAsset(
|
return CurrentUploadAsset(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
fileCreatedAt:
|
fileCreatedAt: DateTime.fromMillisecondsSinceEpoch(map['fileCreatedAt'] as int),
|
||||||
DateTime.fromMillisecondsSinceEpoch(map['fileCreatedAt'] as int),
|
|
||||||
fileName: map['fileName'] as String,
|
fileName: map['fileName'] as String,
|
||||||
fileType: map['fileType'] as String,
|
fileType: map['fileType'] as String,
|
||||||
fileSize: map['fileSize'] as int,
|
fileSize: map['fileSize'] as int,
|
||||||
iCloudAsset:
|
iCloudAsset: map['iCloudAsset'] != null ? map['iCloudAsset'] as bool : null,
|
||||||
map['iCloudAsset'] != null ? map['iCloudAsset'] as bool : null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user