Compare commits
3 Commits
fix/disabl
...
edit-date-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be2eae79ca | ||
|
|
c580c13e3e | ||
|
|
d0e0c24690 |
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
|
flutter build apk --release --flavor production
|
||||||
flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64,android-x64
|
flutter build apk --release --flavor production --split-per-abi --target-platform android-arm,android-arm64,android-x64
|
||||||
else
|
else
|
||||||
flutter build apk --debug --split-per-abi --target-platform android-arm64
|
flutter build apk --debug --flavor production --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,8 +98,7 @@ jobs:
|
|||||||
run: dart analyze --fatal-infos
|
run: dart analyze --fatal-infos
|
||||||
|
|
||||||
- name: Run dart format
|
- name: Run dart format
|
||||||
# Ignore generated files manually until https://github.com/dart-lang/dart_style/issues/864 is resolved
|
run: dart format lib/ --set-exit-if-changed
|
||||||
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,6 +18,25 @@
|
|||||||
"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"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
6
cli/package-lock.json
generated
6
cli/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@immich/cli",
|
"name": "@immich/cli",
|
||||||
"version": "2.2.73",
|
"version": "2.2.72",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@immich/cli",
|
"name": "@immich/cli",
|
||||||
"version": "2.2.73",
|
"version": "2.2.72",
|
||||||
"license": "GNU Affero General Public License version 3",
|
"license": "GNU Affero General Public License version 3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": "^4.0.3",
|
"chokidar": "^4.0.3",
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
},
|
},
|
||||||
"../open-api/typescript-sdk": {
|
"../open-api/typescript-sdk": {
|
||||||
"name": "@immich/sdk",
|
"name": "@immich/sdk",
|
||||||
"version": "1.136.0",
|
"version": "1.135.3",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "GNU Affero General Public License version 3",
|
"license": "GNU Affero General Public License version 3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@immich/cli",
|
"name": "@immich/cli",
|
||||||
"version": "2.2.73",
|
"version": "2.2.72",
|
||||||
"description": "Command Line Interface (CLI) for Immich",
|
"description": "Command Line Interface (CLI) for Immich",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": "./dist/index.js",
|
"exports": "./dist/index.js",
|
||||||
|
|||||||
@@ -29,26 +29,29 @@ These environment variables are used by the `docker-compose.yml` file and do **N
|
|||||||
|
|
||||||
## General
|
## General
|
||||||
|
|
||||||
| Variable | Description | Default | Containers | Workers |
|
| Variable | Description | Default | Containers | Workers |
|
||||||
| :---------------------------------- | :---------------------------------------------------------------------------------------- | :--------------------------: | :----------------------- | :----------------- |
|
| :---------------------------------- | :---------------------------------------------------------------------------------------- | :---------------------------------: | :----------------------- | :----------------- |
|
||||||
| `TZ` | Timezone | <sup>\*1</sup> | server | microservices |
|
| `TZ` | Timezone | <sup>\*1</sup> | server | microservices |
|
||||||
| `IMMICH_ENV` | Environment (production, development) | `production` | server, machine learning | api, microservices |
|
| `IMMICH_ENV` | Environment (production, development) | `production` | server, machine learning | api, microservices |
|
||||||
| `IMMICH_LOG_LEVEL` | Log level (verbose, debug, log, warn, error) | `log` | server, machine learning | api, microservices |
|
| `IMMICH_LOG_LEVEL` | Log level (verbose, debug, log, warn, error) | `log` | server, machine learning | api, microservices |
|
||||||
| `IMMICH_MEDIA_LOCATION` | Media location inside the container ⚠️**You probably shouldn't set this**<sup>\*2</sup>⚠️ | `/usr/src/app/upload` | server | api, microservices |
|
| `IMMICH_MEDIA_LOCATION` | Media location inside the container ⚠️**You probably shouldn't set this**<sup>\*2</sup>⚠️ | `/usr/src/app/upload`<sup>\*3</sup> | server | api, microservices |
|
||||||
| `IMMICH_CONFIG_FILE` | Path to config file | | server | api, microservices |
|
| `IMMICH_CONFIG_FILE` | Path to config file | | server | api, microservices |
|
||||||
| `NO_COLOR` | Set to `true` to disable color-coded log output | `false` | server, machine learning | |
|
| `NO_COLOR` | Set to `true` to disable color-coded log output | `false` | server, machine learning | |
|
||||||
| `CPU_CORES` | Number of cores available to the Immich server | auto-detected CPU core count | server | |
|
| `CPU_CORES` | Number of cores available to the Immich server | auto-detected CPU core count | server | |
|
||||||
| `IMMICH_API_METRICS_PORT` | Port for the OTEL metrics | `8081` | server | api |
|
| `IMMICH_API_METRICS_PORT` | Port for the OTEL metrics | `8081` | server | api |
|
||||||
| `IMMICH_MICROSERVICES_METRICS_PORT` | Port for the OTEL metrics | `8082` | server | microservices |
|
| `IMMICH_MICROSERVICES_METRICS_PORT` | Port for the OTEL metrics | `8082` | server | microservices |
|
||||||
| `IMMICH_PROCESS_INVALID_IMAGES` | When `true`, generate thumbnails for invalid images | | server | microservices |
|
| `IMMICH_PROCESS_INVALID_IMAGES` | When `true`, generate thumbnails for invalid images | | server | microservices |
|
||||||
| `IMMICH_TRUSTED_PROXIES` | List of comma-separated IPs set as trusted proxies | | server | api |
|
| `IMMICH_TRUSTED_PROXIES` | List of comma-separated IPs set as trusted proxies | | server | api |
|
||||||
| `IMMICH_IGNORE_MOUNT_CHECK_ERRORS` | See [System Integrity](/docs/administration/system-integrity) | | server | api, microservices |
|
| `IMMICH_IGNORE_MOUNT_CHECK_ERRORS` | See [System Integrity](/docs/administration/system-integrity) | | server | api, microservices |
|
||||||
|
|
||||||
\*1: `TZ` should be set to a `TZ identifier` from [this list][tz-list]. For example, `TZ="Etc/UTC"`.
|
\*1: `TZ` should be set to a `TZ identifier` from [this list][tz-list]. For example, `TZ="Etc/UTC"`.
|
||||||
`TZ` is used by `exiftool` as a fallback in case the timezone cannot be determined from the image metadata. It is also used for logfile timestamps and cron job execution.
|
`TZ` is used by `exiftool` as a fallback in case the timezone cannot be determined from the image metadata. It is also used for logfile timestamps and cron job execution.
|
||||||
|
|
||||||
\*2: This path is where the Immich code looks for the files, which is internal to the docker container. Setting it to a path on your host will certainly break things, you should use the `UPLOAD_LOCATION` variable instead.
|
\*2: This path is where the Immich code looks for the files, which is internal to the docker container. Setting it to a path on your host will certainly break things, you should use the `UPLOAD_LOCATION` variable instead.
|
||||||
|
|
||||||
|
\*3: With the default `WORKDIR` of `/usr/src/app`, this path will resolve to `/usr/src/app/upload`.
|
||||||
|
It only needs to be set if the Immich deployment method is changing.
|
||||||
|
|
||||||
## Workers
|
## Workers
|
||||||
|
|
||||||
| Variable | Description | Default | Containers |
|
| Variable | Description | Default | Containers |
|
||||||
|
|||||||
4
docs/static/archived-versions.json
vendored
4
docs/static/archived-versions.json
vendored
@@ -1,8 +1,4 @@
|
|||||||
[
|
[
|
||||||
{
|
|
||||||
"label": "v1.136.0",
|
|
||||||
"url": "https://v1.136.0.archive.immich.app"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "v1.135.3",
|
"label": "v1.135.3",
|
||||||
"url": "https://v1.135.3.archive.immich.app"
|
"url": "https://v1.135.3.archive.immich.app"
|
||||||
|
|||||||
8
e2e/package-lock.json
generated
8
e2e/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "immich-e2e",
|
"name": "immich-e2e",
|
||||||
"version": "1.136.0",
|
"version": "1.135.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "immich-e2e",
|
"name": "immich-e2e",
|
||||||
"version": "1.136.0",
|
"version": "1.135.3",
|
||||||
"license": "GNU Affero General Public License version 3",
|
"license": "GNU Affero General Public License version 3",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.1.0",
|
"@eslint/eslintrc": "^3.1.0",
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
},
|
},
|
||||||
"../cli": {
|
"../cli": {
|
||||||
"name": "@immich/cli",
|
"name": "@immich/cli",
|
||||||
"version": "2.2.73",
|
"version": "2.2.72",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "GNU Affero General Public License version 3",
|
"license": "GNU Affero General Public License version 3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
},
|
},
|
||||||
"../open-api/typescript-sdk": {
|
"../open-api/typescript-sdk": {
|
||||||
"name": "@immich/sdk",
|
"name": "@immich/sdk",
|
||||||
"version": "1.136.0",
|
"version": "1.135.3",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "GNU Affero General Public License version 3",
|
"license": "GNU Affero General Public License version 3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "immich-e2e",
|
"name": "immich-e2e",
|
||||||
"version": "1.136.0",
|
"version": "1.135.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -397,7 +397,6 @@
|
|||||||
"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",
|
||||||
@@ -818,6 +817,7 @@
|
|||||||
"edit_avatar": "Edit avatar",
|
"edit_avatar": "Edit avatar",
|
||||||
"edit_date": "Edit date",
|
"edit_date": "Edit date",
|
||||||
"edit_date_and_time": "Edit date and time",
|
"edit_date_and_time": "Edit date and time",
|
||||||
|
"edit_date_time_action_prompt": "{count} date and time edited",
|
||||||
"edit_description": "Edit description",
|
"edit_description": "Edit description",
|
||||||
"edit_description_prompt": "Please select a new description:",
|
"edit_description_prompt": "Please select a new description:",
|
||||||
"edit_exclusion_pattern": "Edit exclusion pattern",
|
"edit_exclusion_pattern": "Edit exclusion pattern",
|
||||||
|
|||||||
4
mobile/.vscode/settings.json
vendored
4
mobile/.vscode/settings.json
vendored
@@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"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,9 +9,6 @@
|
|||||||
# 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,6 +72,20 @@ 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'
|
||||||
|
|||||||
5
mobile/android/app/src/beta/AndroidManifest.xml
Normal file
5
mobile/android/app/src/beta/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?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>
|
||||||
@@ -35,8 +35,8 @@ platform :android do
|
|||||||
task: 'bundle',
|
task: 'bundle',
|
||||||
build_type: 'Release',
|
build_type: 'Release',
|
||||||
properties: {
|
properties: {
|
||||||
"android.injected.version.code" => 205,
|
"android.injected.version.code" => 204,
|
||||||
"android.injected.version.name" => "1.136.0",
|
"android.injected.version.name" => "1.135.3",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
upload_to_play_store(skip_upload_apk: true, skip_upload_images: true, skip_upload_screenshots: true, aab: '../build/app/outputs/bundle/release/app-release.aab')
|
upload_to_play_store(skip_upload_apk: true, skip_upload_images: true, skip_upload_screenshots: true, aab: '../build/app/outputs/bundle/release/app-release.aab')
|
||||||
|
|||||||
1
mobile/drift_schemas/main/drift_schema_v5.json
generated
1
mobile/drift_schemas/main/drift_schema_v5.json
generated
File diff suppressed because one or more lines are too long
@@ -22,7 +22,7 @@ platform :ios do
|
|||||||
path: "./Runner.xcodeproj",
|
path: "./Runner.xcodeproj",
|
||||||
)
|
)
|
||||||
increment_version_number(
|
increment_version_number(
|
||||||
version_number: "1.136.0"
|
version_number: "1.135.3"
|
||||||
)
|
)
|
||||||
increment_build_number(
|
increment_build_number(
|
||||||
build_number: latest_testflight_build_number + 1,
|
build_number: latest_testflight_build_number + 1,
|
||||||
|
|||||||
@@ -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,8 +7,10 @@ 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)': Locale.fromSubtags(languageCode: 'zh', scriptCode: 'SIMPLIFIED'),
|
'Chinese Simplified (zh_CN)':
|
||||||
'Chinese Traditional (zh_TW)': Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
|
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'SIMPLIFIED'),
|
||||||
|
'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'),
|
||||||
@@ -35,8 +37,10 @@ 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)': Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl'),
|
'Serbian Cyrillic (sr_Cyrl)':
|
||||||
'Serbian Latin (sr_Latn)': Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn'),
|
Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl'),
|
||||||
|
'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,8 +53,10 @@ sealed class BaseAsset {
|
|||||||
return const Duration();
|
return const Duration();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get hasRemote => storage == AssetState.remote || storage == AssetState.merged;
|
bool get hasRemote =>
|
||||||
bool get hasLocal => storage == AssetState.local || storage == AssetState.merged;
|
storage == AssetState.remote || 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,7 +22,8 @@ class LocalAsset extends BaseAsset {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AssetState get storage => remoteId == null ? AssetState.local : AssetState.merged;
|
AssetState get storage =>
|
||||||
|
remoteId == null ? AssetState.local : AssetState.merged;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get heroTag => '${id}_${remoteId ?? checksum}';
|
String get heroTag => '${id}_${remoteId ?? checksum}';
|
||||||
@@ -53,7 +54,8 @@ class LocalAsset extends BaseAsset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => super.hashCode ^ id.hashCode ^ remoteId.hashCode ^ orientation.hashCode;
|
int get hashCode =>
|
||||||
|
super.hashCode ^ id.hashCode ^ remoteId.hashCode ^ orientation.hashCode;
|
||||||
|
|
||||||
LocalAsset copyWith({
|
LocalAsset copyWith({
|
||||||
String? id,
|
String? id,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
final String? localId;
|
final String? localId;
|
||||||
final String? thumbHash;
|
final String? thumbHash;
|
||||||
final AssetVisibility visibility;
|
final AssetVisibility visibility;
|
||||||
|
final DateTime? localDateTime;
|
||||||
final String ownerId;
|
final String ownerId;
|
||||||
final String? stackId;
|
final String? stackId;
|
||||||
|
|
||||||
@@ -31,12 +32,14 @@ class RemoteAsset extends BaseAsset {
|
|||||||
super.isFavorite = false,
|
super.isFavorite = false,
|
||||||
this.thumbHash,
|
this.thumbHash,
|
||||||
this.visibility = AssetVisibility.timeline,
|
this.visibility = AssetVisibility.timeline,
|
||||||
|
this.localDateTime,
|
||||||
super.livePhotoVideoId,
|
super.livePhotoVideoId,
|
||||||
this.stackId,
|
this.stackId,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AssetState get storage => localId == null ? AssetState.remote : AssetState.merged;
|
AssetState get storage =>
|
||||||
|
localId == null ? AssetState.remote : AssetState.merged;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get heroTag => '${localId ?? checksum}_$id';
|
String get heroTag => '${localId ?? checksum}_$id';
|
||||||
@@ -57,6 +60,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
isFavorite: $isFavorite,
|
isFavorite: $isFavorite,
|
||||||
thumbHash: ${thumbHash ?? "<NA>"},
|
thumbHash: ${thumbHash ?? "<NA>"},
|
||||||
visibility: $visibility,
|
visibility: $visibility,
|
||||||
|
localDateTime: ${localDateTime ?? "<NA>"},
|
||||||
stackId: ${stackId ?? "<NA>"},
|
stackId: ${stackId ?? "<NA>"},
|
||||||
checksum: $checksum,
|
checksum: $checksum,
|
||||||
livePhotoVideoId: ${livePhotoVideoId ?? "<NA>"},
|
livePhotoVideoId: ${livePhotoVideoId ?? "<NA>"},
|
||||||
@@ -73,6 +77,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
ownerId == other.ownerId &&
|
ownerId == other.ownerId &&
|
||||||
thumbHash == other.thumbHash &&
|
thumbHash == other.thumbHash &&
|
||||||
visibility == other.visibility &&
|
visibility == other.visibility &&
|
||||||
|
localDateTime == other.localDateTime &&
|
||||||
stackId == other.stackId;
|
stackId == other.stackId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +89,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
localId.hashCode ^
|
localId.hashCode ^
|
||||||
thumbHash.hashCode ^
|
thumbHash.hashCode ^
|
||||||
visibility.hashCode ^
|
visibility.hashCode ^
|
||||||
|
localDateTime.hashCode ^
|
||||||
stackId.hashCode;
|
stackId.hashCode;
|
||||||
|
|
||||||
RemoteAsset copyWith({
|
RemoteAsset copyWith({
|
||||||
@@ -101,6 +107,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
bool? isFavorite,
|
bool? isFavorite,
|
||||||
String? thumbHash,
|
String? thumbHash,
|
||||||
AssetVisibility? visibility,
|
AssetVisibility? visibility,
|
||||||
|
DateTime? localDateTime,
|
||||||
String? livePhotoVideoId,
|
String? livePhotoVideoId,
|
||||||
String? stackId,
|
String? stackId,
|
||||||
}) {
|
}) {
|
||||||
@@ -119,6 +126,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
isFavorite: isFavorite ?? this.isFavorite,
|
isFavorite: isFavorite ?? this.isFavorite,
|
||||||
thumbHash: thumbHash ?? this.thumbHash,
|
thumbHash: thumbHash ?? this.thumbHash,
|
||||||
visibility: visibility ?? this.visibility,
|
visibility: visibility ?? this.visibility,
|
||||||
|
localDateTime: localDateTime ?? this.localDateTime,
|
||||||
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
||||||
stackId: stackId ?? this.stackId,
|
stackId: stackId ?? this.stackId,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ 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 && other.hash == hash && other.modifiedTime == modifiedTime;
|
return other.assetId == assetId &&
|
||||||
|
other.hash == hash &&
|
||||||
|
other.modifiedTime == modifiedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class ExifInfo {
|
|||||||
final int? iso;
|
final int? iso;
|
||||||
final double? exposureSeconds;
|
final double? exposureSeconds;
|
||||||
|
|
||||||
bool get hasCoordinates => latitude != null && longitude != null && latitude != 0 && longitude != 0;
|
bool get hasCoordinates =>
|
||||||
|
latitude != null && longitude != null && latitude != 0 && longitude != 0;
|
||||||
|
|
||||||
String get exposureTime {
|
String get exposureTime {
|
||||||
if (exposureSeconds == null) {
|
if (exposureSeconds == null) {
|
||||||
|
|||||||
@@ -43,7 +43,12 @@ class LogMessage {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return message.hashCode ^ level.hashCode ^ createdAt.hashCode ^ logger.hashCode ^ error.hashCode ^ stack.hashCode;
|
return message.hashCode ^
|
||||||
|
level.hashCode ^
|
||||||
|
createdAt.hashCode ^
|
||||||
|
logger.hashCode ^
|
||||||
|
error.hashCode ^
|
||||||
|
stack.hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ class MemoryData {
|
|||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory MemoryData.fromJson(String source) => MemoryData.fromMap(json.decode(source) as Map<String, dynamic>);
|
factory MemoryData.fromJson(String source) =>
|
||||||
|
MemoryData.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'MemoryData(year: $year)';
|
String toString() => 'MemoryData(year: $year)';
|
||||||
|
|||||||
@@ -55,17 +55,22 @@ 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 ? DateTime.fromMillisecondsSinceEpoch(map['birthDate'] as int) : null,
|
birthDate: map['birthDate'] != 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 ? DateTime.fromMillisecondsSinceEpoch(map['updatedAt'] as int) : null,
|
updatedAt: map['updatedAt'] != null
|
||||||
|
? DateTime.fromMillisecondsSinceEpoch(map['updatedAt'] as int)
|
||||||
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
factory PersonDto.fromJson(String source) => PersonDto.fromMap(json.decode(source) as Map<String, dynamic>);
|
factory PersonDto.fromJson(String source) =>
|
||||||
|
PersonDto.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(covariant PersonDto other) {
|
bool operator ==(covariant PersonDto other) {
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
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,7 +54,11 @@ class Stack {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return id.hashCode ^ createdAt.hashCode ^ updatedAt.hashCode ^ ownerId.hashCode ^ primaryAssetId.hashCode;
|
return id.hashCode ^
|
||||||
|
createdAt.hashCode ^
|
||||||
|
updatedAt.hashCode ^
|
||||||
|
ownerId.hashCode ^
|
||||||
|
primaryAssetId.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +77,9 @@ 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 && other.primaryAssetId == primaryAssetId && other.assetIds == assetIds;
|
return other.id == id &&
|
||||||
|
other.primaryAssetId == primaryAssetId &&
|
||||||
|
other.assetIds == assetIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:immich_mobile/domain/utils/event_stream.dart';
|
|||||||
enum GroupAssetsBy {
|
enum GroupAssetsBy {
|
||||||
day,
|
day,
|
||||||
month,
|
month,
|
||||||
auto,
|
|
||||||
none;
|
none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
// 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: Remove UserDto once Isar is removed
|
// TODO: Rename to User once Isar is removed
|
||||||
class UserDto {
|
class UserDto {
|
||||||
final String id;
|
final String id;
|
||||||
final String email;
|
final String email;
|
||||||
@@ -41,19 +44,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,
|
||||||
}''';
|
}''';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,229 +127,87 @@ class UserDto {
|
|||||||
quotaSizeInBytes.hashCode;
|
quotaSizeInBytes.hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
class User {
|
class PartnerUserDto {
|
||||||
final String id;
|
|
||||||
final String name;
|
|
||||||
final String email;
|
|
||||||
final DateTime? deletedAt;
|
|
||||||
final AvatarColor? avatarColor;
|
|
||||||
|
|
||||||
const User({
|
|
||||||
required this.id,
|
|
||||||
required this.name,
|
|
||||||
required this.email,
|
|
||||||
this.deletedAt,
|
|
||||||
this.avatarColor,
|
|
||||||
});
|
|
||||||
|
|
||||||
User copyWith({
|
|
||||||
String? id,
|
|
||||||
String? name,
|
|
||||||
String? email,
|
|
||||||
DateTime? deletedAt,
|
|
||||||
AvatarColor? avatarColor,
|
|
||||||
}) {
|
|
||||||
return User(
|
|
||||||
id: id ?? this.id,
|
|
||||||
name: name ?? this.name,
|
|
||||||
email: email ?? this.email,
|
|
||||||
deletedAt: deletedAt ?? this.deletedAt,
|
|
||||||
avatarColor: avatarColor ?? this.avatarColor,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return '''User {
|
|
||||||
id: $id,
|
|
||||||
name: $name,
|
|
||||||
email: $email,
|
|
||||||
deletedAt: ${deletedAt ?? "<NA>"},
|
|
||||||
avatarColor: ${avatarColor ?? "<NA>"},
|
|
||||||
}''';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(covariant User other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
|
|
||||||
return other.id == id &&
|
|
||||||
other.name == name &&
|
|
||||||
other.email == email &&
|
|
||||||
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
|
|
||||||
int get hashCode {
|
|
||||||
return id.hashCode ^
|
|
||||||
name.hashCode ^
|
|
||||||
email.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 id;
|
||||||
final String email;
|
final String email;
|
||||||
final String name;
|
final String name;
|
||||||
final bool inTimeline;
|
final bool inTimeline;
|
||||||
|
|
||||||
const PartnerUser({
|
final String? profileImagePath;
|
||||||
|
|
||||||
|
const PartnerUserDto({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.email,
|
required this.email,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.inTimeline,
|
required this.inTimeline,
|
||||||
|
this.profileImagePath,
|
||||||
});
|
});
|
||||||
|
|
||||||
PartnerUser copyWith({
|
PartnerUserDto copyWith({
|
||||||
String? id,
|
String? id,
|
||||||
String? email,
|
String? email,
|
||||||
String? name,
|
String? name,
|
||||||
bool? inTimeline,
|
bool? inTimeline,
|
||||||
|
String? profileImagePath,
|
||||||
}) {
|
}) {
|
||||||
return PartnerUser(
|
return PartnerUserDto(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
email: email ?? this.email,
|
email: email ?? this.email,
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
inTimeline: inTimeline ?? this.inTimeline,
|
inTimeline: inTimeline ?? this.inTimeline,
|
||||||
|
profileImagePath: profileImagePath ?? this.profileImagePath,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 '''PartnerUser {
|
return 'PartnerUserDto(id: $id, email: $email, name: $name, inTimeline: $inTimeline, profileImagePath: $profileImagePath)';
|
||||||
id: $id,
|
|
||||||
email: $email,
|
|
||||||
name: $name,
|
|
||||||
inTimeline: $inTimeline,
|
|
||||||
}''';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(covariant PartnerUser other) {
|
bool operator ==(covariant PartnerUserDto other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other.id == id && other.email == email && other.name == name && other.inTimeline == inTimeline;
|
return other.id == id &&
|
||||||
|
other.email == email &&
|
||||||
|
other.name == name &&
|
||||||
|
other.inTimeline == inTimeline &&
|
||||||
|
other.profileImagePath == profileImagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return id.hashCode ^ email.hashCode ^ name.hashCode ^ inTimeline.hashCode;
|
return id.hashCode ^
|
||||||
|
email.hashCode ^
|
||||||
|
name.hashCode ^
|
||||||
|
inTimeline.hashCode ^
|
||||||
|
profileImagePath.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ 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 => isDarkTheme ? const Color(0xFFABCBFA) : const Color(0xFF4250AF),
|
AvatarColor.primary =>
|
||||||
|
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),
|
||||||
@@ -240,11 +241,14 @@ 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 && activationKey == other.activationKey && licenseKey == other.licenseKey;
|
return activatedAt == other.activatedAt &&
|
||||||
|
activationKey == other.activationKey &&
|
||||||
|
licenseKey == other.licenseKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => activatedAt.hashCode ^ activationKey.hashCode ^ licenseKey.hashCode;
|
int get 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
|
||||||
@@ -306,6 +310,10 @@ license: ${license ?? "<NA>"},
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return userId.hashCode ^ key.hashCode ^ onboarding.hashCode ^ preferences.hashCode ^ license.hashCode;
|
return userId.hashCode ^
|
||||||
|
key.hashCode ^
|
||||||
|
onboarding.hashCode ^
|
||||||
|
preferences.hashCode ^
|
||||||
|
license.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ 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 ? _localAssetRepository.watchAsset(id) : _remoteAssetRepository.watchAsset(id);
|
return asset is LocalAsset
|
||||||
|
? _localAssetRepository.watchAsset(id)
|
||||||
|
: _remoteAssetRepository.watchAsset(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<RemoteAsset>> getStack(RemoteAsset asset) async {
|
Future<List<RemoteAsset>> getStack(RemoteAsset asset) async {
|
||||||
@@ -38,7 +40,8 @@ class AssetService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final id = asset is LocalAsset ? asset.remoteId! : (asset as RemoteAsset).id;
|
final id =
|
||||||
|
asset is LocalAsset ? asset.remoteId! : (asset as RemoteAsset).id;
|
||||||
return _remoteAssetRepository.getExif(id);
|
return _remoteAssetRepository.getExif(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +56,8 @@ 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 && (asset.orientation == 90 || asset.orientation == 270);
|
isFlipped = _platform.isAndroid &&
|
||||||
|
(asset.orientation == 90 || asset.orientation == 270);
|
||||||
width = asset.width?.toDouble();
|
width = asset.width?.toDouble();
|
||||||
height = asset.height?.toDouble();
|
height = asset.height?.toDouble();
|
||||||
} else {
|
} else {
|
||||||
@@ -74,7 +78,10 @@ class AssetService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<(int local, int remote)> getAssetCounts() async {
|
Future<(int local, int remote)> getAssetCounts() async {
|
||||||
return (await _localAssetRepository.getCount(), await _remoteAssetRepository.getCount());
|
return (
|
||||||
|
await _localAssetRepository.getCount(),
|
||||||
|
await _remoteAssetRepository.getCount()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getLocalHashedCount() {
|
Future<int> getLocalHashedCount() {
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ class HashService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
for (final album in localAlbums) {
|
for (final album in localAlbums) {
|
||||||
final assetsToHash = await _localAlbumRepository.getAssetsToHash(album.id);
|
final assetsToHash =
|
||||||
|
await _localAlbumRepository.getAssetsToHash(album.id);
|
||||||
if (assetsToHash.isNotEmpty) {
|
if (assetsToHash.isNotEmpty) {
|
||||||
await _hashAssets(assetsToHash);
|
await _hashAssets(assetsToHash);
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,8 @@ class HashService {
|
|||||||
_log.fine("Hashing ${toHash.length} files");
|
_log.fine("Hashing ${toHash.length} files");
|
||||||
|
|
||||||
final hashed = <LocalAsset>[];
|
final hashed = <LocalAsset>[];
|
||||||
final hashes = await _nativeSyncApi.hashPaths(toHash.map((e) => e.path).toList());
|
final hashes =
|
||||||
|
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,7 +66,8 @@ 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 = deviceAlbums.where((a) => a.isCloud).toLocalAlbums();
|
final cloudAlbums =
|
||||||
|
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) {
|
||||||
@@ -94,7 +95,8 @@ class LocalSyncService {
|
|||||||
final Stopwatch stopwatch = Stopwatch()..start();
|
final Stopwatch stopwatch = Stopwatch()..start();
|
||||||
|
|
||||||
final deviceAlbums = await _nativeSyncApi.getAlbums();
|
final deviceAlbums = await _nativeSyncApi.getAlbums();
|
||||||
final dbAlbums = await _localAlbumRepository.getAll(sortBy: {SortLocalAlbumsBy.id});
|
final dbAlbums =
|
||||||
|
await _localAlbumRepository.getAll(sortBy: {SortLocalAlbumsBy.id});
|
||||||
|
|
||||||
await diffSortedLists(
|
await diffSortedLists(
|
||||||
dbAlbums,
|
dbAlbums,
|
||||||
@@ -118,7 +120,9 @@ class LocalSyncService {
|
|||||||
try {
|
try {
|
||||||
_log.fine("Adding device album ${album.name}");
|
_log.fine("Adding device album ${album.name}");
|
||||||
|
|
||||||
final assets = album.assetCount > 0 ? await _nativeSyncApi.getAssetsForAlbum(album.id) : <PlatformAsset>[];
|
final assets = album.assetCount > 0
|
||||||
|
? await _nativeSyncApi.getAssetsForAlbum(album.id)
|
||||||
|
: <PlatformAsset>[];
|
||||||
|
|
||||||
await _localAlbumRepository.upsert(
|
await _localAlbumRepository.upsert(
|
||||||
album,
|
album,
|
||||||
@@ -184,8 +188,10 @@ class LocalSyncService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final updatedTime = (dbAlbum.updatedAt.millisecondsSinceEpoch ~/ 1000) + 1;
|
final updatedTime =
|
||||||
final newAssetsCount = await _nativeSyncApi.getAssetsCountSince(deviceAlbum.id, updatedTime);
|
(dbAlbum.updatedAt.millisecondsSinceEpoch ~/ 1000) + 1;
|
||||||
|
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) {
|
||||||
@@ -224,9 +230,13 @@ 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.getAssetsForAlbum(deviceAlbum.id).then((a) => a.toLocalAssets())
|
? await _nativeSyncApi
|
||||||
|
.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(
|
||||||
@@ -311,7 +321,9 @@ class LocalSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool _albumsEqual(LocalAlbum a, LocalAlbum b) {
|
bool _albumsEqual(LocalAlbum a, LocalAlbum b) {
|
||||||
return a.name == b.name && a.assetCount == b.assetCount && a.updatedAt.isAtSameMomentAs(b.updatedAt);
|
return a.name == b.name &&
|
||||||
|
a.assetCount == b.assetCount &&
|
||||||
|
a.updatedAt.isAtSameMomentAs(b.updatedAt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +333,9 @@ extension on Iterable<PlatformAlbum> {
|
|||||||
(e) => LocalAlbum(
|
(e) => LocalAlbum(
|
||||||
id: e.id,
|
id: e.id,
|
||||||
name: e.name,
|
name: e.name,
|
||||||
updatedAt: e.updatedAt == null ? DateTime.now() : DateTime.fromMillisecondsSinceEpoch(e.updatedAt! * 1000),
|
updatedAt: e.updatedAt == null
|
||||||
|
? DateTime.now()
|
||||||
|
: DateTime.fromMillisecondsSinceEpoch(e.updatedAt! * 1000),
|
||||||
assetCount: e.assetCount,
|
assetCount: e.assetCount,
|
||||||
),
|
),
|
||||||
).toList();
|
).toList();
|
||||||
@@ -336,8 +350,12 @@ 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 ? DateTime.now() : DateTime.fromMillisecondsSinceEpoch(e.createdAt! * 1000),
|
createdAt: e.createdAt == null
|
||||||
updatedAt: e.updatedAt == null ? DateTime.now() : DateTime.fromMillisecondsSinceEpoch(e.updatedAt! * 1000),
|
? DateTime.now()
|
||||||
|
: 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,7 +56,8 @@ 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) ?? LogLevel.info.index;
|
final level = await instance._storeRepository.tryGet(StoreKey.logLevel) ??
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
@@ -145,7 +146,9 @@ 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.values.elementAtOrNull(Level.LEVELS.indexOf(this)) ?? LogLevel.info;
|
LogLevel toLogLevel() =>
|
||||||
|
LogLevel.values.elementAtOrNull(Level.LEVELS.indexOf(this)) ??
|
||||||
|
LogLevel.info;
|
||||||
}
|
}
|
||||||
|
|
||||||
extension on LogLevel {
|
extension on LogLevel {
|
||||||
|
|||||||
@@ -12,19 +12,21 @@ class DriftPartnerService {
|
|||||||
this._partnerApiRepository,
|
this._partnerApiRepository,
|
||||||
);
|
);
|
||||||
|
|
||||||
Future<List<PartnerUser>> getSharedWith(String userId) {
|
Future<List<PartnerUserDto>> getSharedWith(String userId) {
|
||||||
return _driftPartnerRepository.getSharedWith(userId);
|
return _driftPartnerRepository.getSharedWith(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<PartnerUser>> getSharedBy(String userId) {
|
Future<List<PartnerUserDto>> getSharedBy(String userId) {
|
||||||
return _driftPartnerRepository.getSharedBy(userId);
|
return _driftPartnerRepository.getSharedBy(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<PartnerUser>> getAvailablePartners(
|
Future<List<PartnerUserDto>> getAvailablePartners(
|
||||||
String currentUserId,
|
String currentUserId,
|
||||||
) async {
|
) async {
|
||||||
final otherUsers = await _driftPartnerRepository.getAvailablePartners(currentUserId);
|
final otherUsers =
|
||||||
final currentPartners = await _driftPartnerRepository.getSharedBy(currentUserId);
|
await _driftPartnerRepository.getAvailablePartners(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,7 +44,8 @@ class RemoteAlbumService {
|
|||||||
filtered = filtered
|
filtered = filtered
|
||||||
.where(
|
.where(
|
||||||
(album) =>
|
(album) =>
|
||||||
album.name.toLowerCase().contains(lowerQuery) || album.description.toLowerCase().contains(lowerQuery),
|
album.name.toLowerCase().contains(lowerQuery) ||
|
||||||
|
album.description.toLowerCase().contains(lowerQuery),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
@@ -52,10 +53,12 @@ class RemoteAlbumService {
|
|||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
switch (filterMode) {
|
switch (filterMode) {
|
||||||
case QuickFilterMode.myAlbums:
|
case QuickFilterMode.myAlbums:
|
||||||
filtered = filtered.where((album) => album.ownerId == userId).toList();
|
filtered =
|
||||||
|
filtered.where((album) => album.ownerId == userId).toList();
|
||||||
break;
|
break;
|
||||||
case QuickFilterMode.sharedWithMe:
|
case QuickFilterMode.sharedWithMe:
|
||||||
filtered = filtered.where((album) => album.ownerId != userId).toList();
|
filtered =
|
||||||
|
filtered.where((album) => album.ownerId != userId).toList();
|
||||||
break;
|
break;
|
||||||
case QuickFilterMode.all:
|
case QuickFilterMode.all:
|
||||||
break;
|
break;
|
||||||
@@ -108,7 +111,7 @@ class RemoteAlbumService {
|
|||||||
return _repository.getDateRange(albumId);
|
return _repository.getDateRange(albumId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<User>> getSharedUsers(String albumId) {
|
Future<List<UserDto>> getSharedUsers(String albumId) {
|
||||||
return _repository.getSharedUsers(albumId);
|
return _repository.getSharedUsers(albumId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,16 @@ final AppSetting = SettingsService(storeService: StoreService.I);
|
|||||||
class SettingsService {
|
class SettingsService {
|
||||||
final StoreService _storeService;
|
final StoreService _storeService;
|
||||||
|
|
||||||
const SettingsService({required StoreService storeService}) : _storeService = storeService;
|
const SettingsService({required StoreService storeService})
|
||||||
|
: _storeService = storeService;
|
||||||
|
|
||||||
T get<T>(Setting<T> setting) => _storeService.get(setting.storeKey, setting.defaultValue);
|
T get<T>(Setting<T> setting) =>
|
||||||
|
_storeService.get(setting.storeKey, setting.defaultValue);
|
||||||
|
|
||||||
Future<void> set<T>(Setting<T> setting, T value) => _storeService.put(setting.storeKey, value);
|
Future<void> set<T>(Setting<T> setting, T value) =>
|
||||||
|
_storeService.put(setting.storeKey, value);
|
||||||
|
|
||||||
Stream<T> watch<T>(Setting<T> setting) => _storeService.watch(setting.storeKey).map((v) => v ?? setting.defaultValue);
|
Stream<T> watch<T>(Setting<T> setting) => _storeService
|
||||||
|
.watch(setting.storeKey)
|
||||||
|
.map((v) => v ?? setting.defaultValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ 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}) : _storeRepository = storeRepository;
|
StoreService._({required IsarStoreRepository 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;
|
||||||
@@ -47,7 +48,8 @@ class StoreService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamSubscription<StoreDto> _listenForChange() => _storeRepository.watchAll().listen((event) {
|
StreamSubscription<StoreDto> _listenForChange() =>
|
||||||
|
_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 user");
|
_logger.info("Remote sync request for userr");
|
||||||
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,8 +120,6 @@ 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,13 +33,11 @@ class TimelineFactory {
|
|||||||
}) : _timelineRepository = timelineRepository,
|
}) : _timelineRepository = timelineRepository,
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
|
|
||||||
GroupAssetsBy get groupBy {
|
GroupAssetsBy get groupBy =>
|
||||||
final group = GroupAssetsBy.values[_settingsService.get(Setting.groupAssetsBy)];
|
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(_timelineRepository.main(timelineUsers, groupBy));
|
TimelineService main(List<String> timelineUsers) =>
|
||||||
|
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));
|
||||||
@@ -47,21 +45,29 @@ 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(_timelineRepository.remote(userId, groupBy));
|
TimelineService remoteAssets(String userId) =>
|
||||||
|
TimelineService(_timelineRepository.remote(userId, groupBy));
|
||||||
|
|
||||||
TimelineService favorite(String userId) => TimelineService(_timelineRepository.favorite(userId, groupBy));
|
TimelineService favorite(String userId) =>
|
||||||
|
TimelineService(_timelineRepository.favorite(userId, groupBy));
|
||||||
|
|
||||||
TimelineService trash(String userId) => TimelineService(_timelineRepository.trash(userId, groupBy));
|
TimelineService trash(String userId) =>
|
||||||
|
TimelineService(_timelineRepository.trash(userId, groupBy));
|
||||||
|
|
||||||
TimelineService archive(String userId) => TimelineService(_timelineRepository.archived(userId, groupBy));
|
TimelineService archive(String userId) =>
|
||||||
|
TimelineService(_timelineRepository.archived(userId, groupBy));
|
||||||
|
|
||||||
TimelineService lockedFolder(String userId) => TimelineService(_timelineRepository.locked(userId, groupBy));
|
TimelineService lockedFolder(String userId) =>
|
||||||
|
TimelineService(_timelineRepository.locked(userId, groupBy));
|
||||||
|
|
||||||
TimelineService video(String userId) => TimelineService(_timelineRepository.video(userId, groupBy));
|
TimelineService video(String userId) =>
|
||||||
|
TimelineService(_timelineRepository.video(userId, groupBy));
|
||||||
|
|
||||||
TimelineService place(String place) => TimelineService(_timelineRepository.place(place, groupBy));
|
TimelineService place(String place) =>
|
||||||
|
TimelineService(_timelineRepository.place(place, groupBy));
|
||||||
|
|
||||||
TimelineService fromAssets(List<BaseAsset> assets) => TimelineService(_timelineRepository.fromAssets(assets));
|
TimelineService fromAssets(List<BaseAsset> assets) =>
|
||||||
|
TimelineService(_timelineRepository.fromAssets(assets));
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimelineService {
|
class TimelineService {
|
||||||
@@ -88,7 +94,8 @@ class TimelineService {
|
|||||||
_bucketSource = bucketSource {
|
_bucketSource = bucketSource {
|
||||||
_bucketSubscription = _bucketSource().listen((buckets) {
|
_bucketSubscription = _bucketSource().listen((buckets) {
|
||||||
_mutex.run(() async {
|
_mutex.run(() async {
|
||||||
final totalAssets = buckets.fold<int>(0, (acc, bucket) => acc + bucket.assetCount);
|
final totalAssets =
|
||||||
|
buckets.fold<int>(0, (acc, bucket) => acc + bucket.assetCount);
|
||||||
|
|
||||||
if (totalAssets == 0) {
|
if (totalAssets == 0) {
|
||||||
_bufferOffset = 0;
|
_bufferOffset = 0;
|
||||||
@@ -121,7 +128,8 @@ class TimelineService {
|
|||||||
|
|
||||||
Stream<List<Bucket>> Function() get watchBuckets => _bucketSource;
|
Stream<List<Bucket>> Function() get watchBuckets => _bucketSource;
|
||||||
|
|
||||||
Future<List<BaseAsset>> loadAssets(int index, int count) => _mutex.run(() => _loadAssets(index, count));
|
Future<List<BaseAsset>> loadAssets(int index, int 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)) {
|
||||||
@@ -170,9 +178,11 @@ 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) => _mutex.run(() => _loadAssets(index, math.min(5, _totalAssets - index)));
|
Future<void> preCacheAssets(int index) =>
|
||||||
|
_mutex.run(() => _loadAssets(index, math.min(5, _totalAssets - index)));
|
||||||
|
|
||||||
BaseAsset getRandomAsset() => _buffer.elementAt(math.Random().nextInt(_buffer.length));
|
BaseAsset getRandomAsset() =>
|
||||||
|
_buffer.elementAt(math.Random().nextInt(_buffer.length));
|
||||||
|
|
||||||
BaseAsset getAsset(int index) {
|
BaseAsset getAsset(int index) {
|
||||||
if (!hasRange(index, 1)) {
|
if (!hasRange(index, 1)) {
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
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';
|
||||||
@@ -68,28 +66,3 @@ 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,10 +67,12 @@ class BackgroundSyncManager {
|
|||||||
// captured by the closure passed to [runInIsolateGentle].
|
// captured by the closure passed to [runInIsolateGentle].
|
||||||
_deviceAlbumSyncTask = full
|
_deviceAlbumSyncTask = full
|
||||||
? runInIsolateGentle(
|
? runInIsolateGentle(
|
||||||
computation: (ref) => ref.read(localSyncServiceProvider).sync(full: true),
|
computation: (ref) =>
|
||||||
|
ref.read(localSyncServiceProvider).sync(full: true),
|
||||||
)
|
)
|
||||||
: runInIsolateGentle(
|
: runInIsolateGentle(
|
||||||
computation: (ref) => ref.read(localSyncServiceProvider).sync(full: false),
|
computation: (ref) =>
|
||||||
|
ref.read(localSyncServiceProvider).sync(full: false),
|
||||||
);
|
);
|
||||||
|
|
||||||
return _deviceAlbumSyncTask!.whenComplete(() {
|
return _deviceAlbumSyncTask!.whenComplete(() {
|
||||||
@@ -137,5 +139,7 @@ Cancelable<void> _handleWsAssetUploadReadyV1Batch(
|
|||||||
List<dynamic> batchData,
|
List<dynamic> batchData,
|
||||||
) =>
|
) =>
|
||||||
runInIsolateGentle(
|
runInIsolateGentle(
|
||||||
computation: (ref) => ref.read(syncStreamServiceProvider).handleWsAssetUploadReadyV1Batch(batchData),
|
computation: (ref) => ref
|
||||||
|
.read(syncStreamServiceProvider)
|
||||||
|
.handleWsAssetUploadReadyV1Batch(batchData),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ class EventStream {
|
|||||||
|
|
||||||
static final EventStream shared = EventStream._();
|
static final EventStream shared = EventStream._();
|
||||||
|
|
||||||
final StreamController<Event> _controller = StreamController<Event>.broadcast();
|
final StreamController<Event> _controller =
|
||||||
|
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<IsarUser> owner = IsarLink<IsarUser>();
|
final IsarLink<User> owner = IsarLink<User>();
|
||||||
final IsarLink<Asset> thumbnail = IsarLink<Asset>();
|
final IsarLink<Asset> thumbnail = IsarLink<Asset>();
|
||||||
final IsarLinks<IsarUser> sharedUsers = IsarLinks<IsarUser>();
|
final IsarLinks<User> sharedUsers = IsarLinks<User>();
|
||||||
final IsarLinks<Asset> assets = IsarLinks<Asset>();
|
final IsarLinks<Asset> assets = IsarLinks<Asset>();
|
||||||
|
|
||||||
// transient fields
|
// transient fields
|
||||||
@@ -95,11 +95,13 @@ 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<IsarUser> get remoteUsers =>
|
Iterable<User> get remoteUsers => sharedUsers.isEmpty
|
||||||
sharedUsers.isEmpty ? (sharedUsers as IsarLinksCommon<IsarUser>).addedObjects : sharedUsers;
|
? (sharedUsers as IsarLinksCommon<User>).addedObjects
|
||||||
|
: sharedUsers;
|
||||||
|
|
||||||
@ignore
|
@ignore
|
||||||
Iterable<Asset> get remoteAssets => assets.isEmpty ? (assets as IsarLinksCommon<Asset>).addedObjects : assets;
|
Iterable<Asset> get remoteAssets =>
|
||||||
|
assets.isEmpty ? (assets as IsarLinksCommon<Asset>).addedObjects : assets;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(other) {
|
bool operator ==(other) {
|
||||||
@@ -160,29 +162,35 @@ class Album {
|
|||||||
activityEnabled: dto.isActivityEnabled,
|
activityEnabled: dto.isActivityEnabled,
|
||||||
);
|
);
|
||||||
a.remoteAssetCount = dto.assetCount;
|
a.remoteAssetCount = dto.assetCount;
|
||||||
a.owner.value = await db.isarUsers.getById(dto.ownerId);
|
a.owner.value = await db.users.getById(dto.ownerId);
|
||||||
if (dto.order != null) {
|
if (dto.order != null) {
|
||||||
a.sortOrder = dto.order == AssetOrder.asc ? SortOrder.asc : SortOrder.desc;
|
a.sortOrder =
|
||||||
|
dto.order == AssetOrder.asc ? SortOrder.asc : SortOrder.desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dto.albumThumbnailAssetId != null) {
|
if (dto.albumThumbnailAssetId != null) {
|
||||||
a.thumbnail.value = await db.assets.where().remoteIdEqualTo(dto.albumThumbnailAssetId).findFirst();
|
a.thumbnail.value = await db.assets
|
||||||
|
.where()
|
||||||
|
.remoteIdEqualTo(dto.albumThumbnailAssetId)
|
||||||
|
.findFirst();
|
||||||
}
|
}
|
||||||
if (dto.albumUsers.isNotEmpty) {
|
if (dto.albumUsers.isNotEmpty) {
|
||||||
final users = await db.isarUsers.getAllById(
|
final users = await db.users.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 = await db.assets.getAllByRemoteId(dto.assets.map((e) => e.id));
|
final assets =
|
||||||
|
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() => 'remoteId: $remoteId name: $name description: $description';
|
String toString() =>
|
||||||
|
'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'IsarUser',
|
target: r'User',
|
||||||
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'IsarUser',
|
target: r'User',
|
||||||
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<IsarUser>(), r'owner', id);
|
object.owner.attach(col, col.isar.collection<User>(), 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<IsarUser>(), r'sharedUsers', id);
|
.attach(col, col.isar.collection<User>(), 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,8 +1500,7 @@ 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(
|
QueryBuilder<Album, Album, QAfterFilterCondition> owner(FilterQuery<User> q) {
|
||||||
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');
|
||||||
});
|
});
|
||||||
@@ -1527,7 +1526,7 @@ extension AlbumQueryLinks on QueryBuilder<Album, Album, QFilterCondition> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<Album, Album, QAfterFilterCondition> sharedUsers(
|
QueryBuilder<Album, Album, QAfterFilterCondition> sharedUsers(
|
||||||
FilterQuery<IsarUser> q) {
|
FilterQuery<User> q) {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.link(q, r'sharedUsers');
|
return query.link(q, r'sharedUsers');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ 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' as entity;
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart'
|
||||||
|
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';
|
||||||
@@ -31,14 +32,18 @@ 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 ? null : ExifDtoConverter.fromDto(remote.exifInfo!),
|
exifInfo = remote.exifInfo == null
|
||||||
|
? 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 ? null : remote.stack?.primaryAssetId,
|
stackPrimaryAssetId = remote.stack?.primaryAssetId == remote.id
|
||||||
|
? 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,
|
||||||
@@ -103,7 +108,8 @@ class Asset {
|
|||||||
throw Exception('Asset $fileName has no local data');
|
throw Exception('Asset $fileName has no local data');
|
||||||
}
|
}
|
||||||
|
|
||||||
final updatedLocal = _didUpdateLocal ? local : await local.obtainForNewProperties();
|
final updatedLocal =
|
||||||
|
_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');
|
||||||
}
|
}
|
||||||
@@ -179,7 +185,10 @@ class Asset {
|
|||||||
final orientatedWidth = this.orientatedWidth;
|
final orientatedWidth = this.orientatedWidth;
|
||||||
final orientatedHeight = this.orientatedHeight;
|
final orientatedHeight = this.orientatedHeight;
|
||||||
|
|
||||||
if (orientatedWidth != null && orientatedHeight != null && orientatedWidth > 0 && orientatedHeight > 0) {
|
if (orientatedWidth != null &&
|
||||||
|
orientatedHeight != null &&
|
||||||
|
orientatedWidth > 0 &&
|
||||||
|
orientatedHeight > 0) {
|
||||||
return orientatedWidth.toDouble() / orientatedHeight.toDouble();
|
return orientatedWidth.toDouble() / orientatedHeight.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +389,8 @@ 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 == remoteId ? null : stackPrimaryAssetId,
|
stackPrimaryAssetId:
|
||||||
|
stackPrimaryAssetId == remoteId ? null : stackPrimaryAssetId,
|
||||||
stackCount: stackCount,
|
stackCount: stackCount,
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
isArchived: isArchived,
|
isArchived: isArchived,
|
||||||
@@ -400,7 +410,9 @@ 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 ? null : a.stackPrimaryAssetId,
|
stackPrimaryAssetId: a.stackPrimaryAssetId == a.remoteId
|
||||||
|
? 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,
|
||||||
@@ -416,7 +428,8 @@ 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 ?? a.exifInfo?.copyWith(assetId: id), // updated to use assetId
|
exifInfo: exifInfo ??
|
||||||
|
a.exifInfo?.copyWith(assetId: id), // updated to use assetId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,15 +491,18 @@ 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.put(entity.ExifInfo.fromDto(exifInfo!.copyWith(assetId: id)));
|
await db.exifInfos
|
||||||
|
.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) => compareToNullable(a.localId, b.localId);
|
static int compareByLocalId(Asset a, Asset b) =>
|
||||||
|
compareToNullable(a.localId, b.localId);
|
||||||
|
|
||||||
static int compareByChecksum(Asset a, Asset b) => a.checksum.compareTo(b.checksum);
|
static int compareByChecksum(Asset a, Asset b) =>
|
||||||
|
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);
|
||||||
@@ -573,11 +589,16 @@ enum AssetState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension AssetsHelper on IsarCollection<Asset> {
|
extension AssetsHelper on IsarCollection<Asset> {
|
||||||
Future<int> deleteAllByRemoteId(Iterable<String> ids) => ids.isEmpty ? Future.value(0) : remote(ids).deleteAll();
|
Future<int> deleteAllByRemoteId(Iterable<String> ids) =>
|
||||||
Future<int> deleteAllByLocalId(Iterable<String> ids) => ids.isEmpty ? Future.value(0) : local(ids).deleteAll();
|
ids.isEmpty ? Future.value(0) : remote(ids).deleteAll();
|
||||||
Future<List<Asset>> getAllByRemoteId(Iterable<String> ids) => ids.isEmpty ? Future.value([]) : remote(ids).findAll();
|
Future<int> deleteAllByLocalId(Iterable<String> ids) =>
|
||||||
Future<List<Asset>> getAllByLocalId(Iterable<String> ids) => ids.isEmpty ? Future.value([]) : local(ids).findAll();
|
ids.isEmpty ? Future.value(0) : local(ids).deleteAll();
|
||||||
Future<Asset?> getByRemoteId(String id) => where().remoteIdEqualTo(id).findFirst();
|
Future<List<Asset>> getAllByRemoteId(Iterable<String> ids) =>
|
||||||
|
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,13 +22,15 @@ extension LogOnError<T> on AsyncValue<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
return onLoading?.call() ?? const Center(child: ImmichLoadingIndicator());
|
return onLoading?.call() ??
|
||||||
|
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) ?? ScaffoldErrorBody(errorMsg: error?.toString());
|
return onError?.call(error, stackTrace) ??
|
||||||
|
ScaffoldErrorBody(errorMsg: error?.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return onData(requireValue);
|
return onData(requireValue);
|
||||||
|
|||||||
@@ -60,5 +60,6 @@ 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) => ScaffoldMessenger.of(this).showSnackBar(snackBar);
|
void showSnackBar(SnackBar snackBar) =>
|
||||||
|
ScaffoldMessenger.of(this).showSnackBar(snackBar);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,9 @@ 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 && startDate.month == endDate.month && startDate.day == endDate.day) {
|
if (startDate.year == endDate.year &&
|
||||||
|
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,7 +12,9 @@ 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(':').map((e) => double.parse(e).toInt()).toList(growable: false);
|
final parts = split(':')
|
||||||
|
.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,7 +2,9 @@ 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 ? onSurface.darken(amount: .3) : onSurface.lighten(amount: .3);
|
Color get onSurfaceSecondary => _isDarkMode
|
||||||
|
? onSurface.darken(amount: .3)
|
||||||
|
: onSurface.lighten(amount: .3);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ColorExtensions on Color {
|
extension ColorExtensions on Color {
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ 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').format(args)
|
? MessageFormat(translatedMessage, locale: Intl.defaultLocale ?? 'en')
|
||||||
|
.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,9 +8,12 @@ class AssetFaceEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
|
|
||||||
TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get assetId =>
|
||||||
|
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get personId => text().nullable().references(PersonEntity, #id, onDelete: KeyAction.setNull)();
|
TextColumn get personId => text()
|
||||||
|
.nullable()
|
||||||
|
.references(PersonEntity, #id, onDelete: KeyAction.setNull)();
|
||||||
|
|
||||||
IntColumn get imageWidth => integer()();
|
IntColumn get imageWidth => integer()();
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,951 +0,0 @@
|
|||||||
// 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,7 +98,8 @@ class ExifInfo {
|
|||||||
class RemoteExifEntity extends Table with DriftDefaultsMixin {
|
class RemoteExifEntity extends Table with DriftDefaultsMixin {
|
||||||
const RemoteExifEntity();
|
const RemoteExifEntity();
|
||||||
|
|
||||||
TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get assetId =>
|
||||||
|
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get city => text().nullable()();
|
TextColumn get city => text().nullable()();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ 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 => boolean().withDefault(const Constant(false))();
|
BoolColumn get isIosSharedAlbum =>
|
||||||
|
boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
// Used for mark & sweep
|
// Used for mark & sweep
|
||||||
BoolColumn get marker_ => boolean().nullable()();
|
BoolColumn get marker_ => boolean().nullable()();
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ 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 => text().references(LocalAssetEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get assetId =>
|
||||||
|
text().references(LocalAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get albumId => text().references(LocalAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get albumId =>
|
||||||
|
text().references(LocalAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {assetId, albumId};
|
Set<Column> get primaryKey => {assetId, albumId};
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ class MemoryEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get deletedAt => dateTime().nullable()();
|
DateTimeColumn get deletedAt => dateTime().nullable()();
|
||||||
|
|
||||||
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get ownerId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
IntColumn get type => intEnum<MemoryTypeEnum>()();
|
IntColumn get type => intEnum<MemoryTypeEnum>()();
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ 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 => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get assetId =>
|
||||||
|
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get memoryId => text().references(MemoryEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get memoryId =>
|
||||||
|
text().references(MemoryEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {assetId, memoryId};
|
Set<Column> get primaryKey => {assetId, memoryId};
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ 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 => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get sharedById =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get sharedWithId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get sharedWithId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
BoolColumn get inTimeline => boolean().withDefault(const Constant(false))();
|
BoolColumn get inTimeline => boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ class PersonEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get ownerId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get name => text()();
|
TextColumn get name => text()();
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,15 @@ class RemoteAlbumEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get ownerId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get thumbnailAssetId =>
|
TextColumn get thumbnailAssetId => text()
|
||||||
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.setNull).nullable()();
|
.references(RemoteAssetEntity, #id, onDelete: KeyAction.setNull)
|
||||||
|
.nullable()();
|
||||||
|
|
||||||
BoolColumn get isActivityEnabled => boolean().withDefault(const Constant(true))();
|
BoolColumn get isActivityEnabled =>
|
||||||
|
boolean().withDefault(const Constant(true))();
|
||||||
|
|
||||||
IntColumn get order => intEnum<AlbumAssetOrder>()();
|
IntColumn get order => intEnum<AlbumAssetOrder>()();
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ 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 => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get assetId =>
|
||||||
|
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get albumId => text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get albumId =>
|
||||||
|
text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {assetId, albumId};
|
Set<Column> get primaryKey => {assetId, albumId};
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ 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 => text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get albumId =>
|
||||||
|
text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get userId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get userId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
IntColumn get role => intEnum<AlbumUserRole>()();
|
IntColumn get role => intEnum<AlbumUserRole>()();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ 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 with DriftDefaultsMixin, AssetEntityMixin {
|
class RemoteAssetEntity extends Table
|
||||||
|
with DriftDefaultsMixin, AssetEntityMixin {
|
||||||
const RemoteAssetEntity();
|
const RemoteAssetEntity();
|
||||||
|
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
@@ -20,7 +21,8 @@ class RemoteAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin
|
|||||||
|
|
||||||
BoolColumn get isFavorite => boolean().withDefault(const Constant(false))();
|
BoolColumn get isFavorite => boolean().withDefault(const Constant(false))();
|
||||||
|
|
||||||
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get ownerId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
DateTimeColumn get localDateTime => dateTime().nullable()();
|
DateTimeColumn get localDateTime => dateTime().nullable()();
|
||||||
|
|
||||||
@@ -51,6 +53,7 @@ extension RemoteAssetEntityDataDomainEx on RemoteAssetEntityData {
|
|||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
|
localDateTime: localDateTime,
|
||||||
thumbHash: thumbHash,
|
thumbHash: thumbHash,
|
||||||
visibility: visibility,
|
visibility: visibility,
|
||||||
livePhotoVideoId: livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId,
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ class StackEntity extends Table with DriftDefaultsMixin {
|
|||||||
|
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
TextColumn get ownerId => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get ownerId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
TextColumn get primaryAssetId => text()();
|
TextColumn get primaryAssetId => text()();
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
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 IsarUser {
|
class User {
|
||||||
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;
|
||||||
@@ -28,7 +26,7 @@ class IsarUser {
|
|||||||
final int quotaUsageInBytes;
|
final int quotaUsageInBytes;
|
||||||
final int quotaSizeInBytes;
|
final int quotaSizeInBytes;
|
||||||
|
|
||||||
const IsarUser({
|
const User({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.updatedAt,
|
required this.updatedAt,
|
||||||
required this.email,
|
required this.email,
|
||||||
@@ -44,7 +42,7 @@ class IsarUser {
|
|||||||
this.quotaSizeInBytes = 0,
|
this.quotaSizeInBytes = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
static IsarUser fromDto(UserDto dto) => IsarUser(
|
static User fromDto(UserDto dto) => User(
|
||||||
id: dto.id,
|
id: dto.id,
|
||||||
updatedAt: dto.updatedAt,
|
updatedAt: dto.updatedAt,
|
||||||
email: dto.email,
|
email: dto.email,
|
||||||
@@ -81,25 +79,15 @@ 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 deletedAt => dateTime().nullable()();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
// Quota
|
||||||
IntColumn get avatarColor => intEnum<AvatarColor>().nullable()();
|
IntColumn get quotaSizeInBytes => integer().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,24 +3,30 @@
|
|||||||
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/domain/models/user_metadata.model.dart' as i2;
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart' as i2;
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.dart' as i3;
|
import 'package:drift/src/runtime/query_builder/query_builder.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<DateTime?> deletedAt,
|
i0.Value<String?> profileImagePath,
|
||||||
i0.Value<i2.AvatarColor?> avatarColor,
|
i0.Value<DateTime> updatedAt,
|
||||||
|
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<DateTime?> deletedAt,
|
i0.Value<String?> profileImagePath,
|
||||||
i0.Value<i2.AvatarColor?> avatarColor,
|
i0.Value<DateTime> updatedAt,
|
||||||
|
i0.Value<int?> quotaSizeInBytes,
|
||||||
|
i0.Value<int> quotaUsageInBytes,
|
||||||
});
|
});
|
||||||
|
|
||||||
class $$UserEntityTableFilterComposer
|
class $$UserEntityTableFilterComposer
|
||||||
@@ -38,16 +44,26 @@ 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<DateTime> get deletedAt => $composableBuilder(
|
i0.ColumnFilters<String> get profileImagePath => $composableBuilder(
|
||||||
column: $table.deletedAt, builder: (column) => i0.ColumnFilters(column));
|
column: $table.profileImagePath,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
i0.ColumnWithTypeConverterFilters<i2.AvatarColor?, i2.AvatarColor, int>
|
i0.ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
||||||
get avatarColor => $composableBuilder(
|
column: $table.updatedAt, builder: (column) => i0.ColumnFilters(column));
|
||||||
column: $table.avatarColor,
|
|
||||||
builder: (column) => i0.ColumnWithTypeConverterFilters(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));
|
||||||
}
|
}
|
||||||
|
|
||||||
class $$UserEntityTableOrderingComposer
|
class $$UserEntityTableOrderingComposer
|
||||||
@@ -65,15 +81,26 @@ 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<DateTime> get deletedAt => $composableBuilder(
|
i0.ColumnOrderings<String> get profileImagePath => $composableBuilder(
|
||||||
column: $table.deletedAt,
|
column: $table.profileImagePath,
|
||||||
builder: (column) => i0.ColumnOrderings(column));
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
i0.ColumnOrderings<int> get avatarColor => $composableBuilder(
|
i0.ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
||||||
column: $table.avatarColor,
|
column: $table.updatedAt,
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,15 +119,23 @@ 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<DateTime> get deletedAt =>
|
i0.GeneratedColumn<String> get profileImagePath => $composableBuilder(
|
||||||
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
column: $table.profileImagePath, builder: (column) => column);
|
||||||
|
|
||||||
i0.GeneratedColumnWithTypeConverter<i2.AvatarColor?, int> get avatarColor =>
|
i0.GeneratedColumn<DateTime> get updatedAt =>
|
||||||
$composableBuilder(
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
||||||
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<
|
||||||
@@ -133,30 +168,42 @@ 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<DateTime?> deletedAt = const i0.Value.absent(),
|
i0.Value<String?> profileImagePath = const i0.Value.absent(),
|
||||||
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent(),
|
i0.Value<DateTime> updatedAt = 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,
|
||||||
deletedAt: deletedAt,
|
profileImagePath: profileImagePath,
|
||||||
avatarColor: avatarColor,
|
updatedAt: updatedAt,
|
||||||
|
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<DateTime?> deletedAt = const i0.Value.absent(),
|
i0.Value<String?> profileImagePath = const i0.Value.absent(),
|
||||||
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent(),
|
i0.Value<DateTime> updatedAt = 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,
|
||||||
deletedAt: deletedAt,
|
profileImagePath: profileImagePath,
|
||||||
avatarColor: avatarColor,
|
updatedAt: updatedAt,
|
||||||
|
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)))
|
||||||
@@ -182,7 +229,7 @@ typedef $$UserEntityTableProcessedTableManager = i0.ProcessedTableManager<
|
|||||||
i1.UserEntityData,
|
i1.UserEntityData,
|
||||||
i0.PrefetchHooks Function()>;
|
i0.PrefetchHooks Function()>;
|
||||||
|
|
||||||
class $UserEntityTable extends i3.UserEntity
|
class $UserEntityTable extends i2.UserEntity
|
||||||
with i0.TableInfo<$UserEntityTable, i1.UserEntityData> {
|
with i0.TableInfo<$UserEntityTable, i1.UserEntityData> {
|
||||||
@override
|
@override
|
||||||
final i0.GeneratedDatabase attachedDatabase;
|
final i0.GeneratedDatabase attachedDatabase;
|
||||||
@@ -199,27 +246,61 @@ class $UserEntityTable extends i3.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 _deletedAtMeta =
|
static const i0.VerificationMeta _profileImagePathMeta =
|
||||||
const i0.VerificationMeta('deletedAt');
|
const i0.VerificationMeta('profileImagePath');
|
||||||
@override
|
@override
|
||||||
late final i0.GeneratedColumn<DateTime> deletedAt =
|
late final i0.GeneratedColumn<String> profileImagePath =
|
||||||
i0.GeneratedColumn<DateTime>('deleted_at', aliasedName, true,
|
i0.GeneratedColumn<String>('profile_image_path', aliasedName, true,
|
||||||
type: i0.DriftSqlType.dateTime, requiredDuringInsert: false);
|
type: i0.DriftSqlType.string, requiredDuringInsert: false);
|
||||||
|
static const i0.VerificationMeta _updatedAtMeta =
|
||||||
|
const i0.VerificationMeta('updatedAt');
|
||||||
@override
|
@override
|
||||||
late final i0.GeneratedColumnWithTypeConverter<i2.AvatarColor?, int>
|
late final i0.GeneratedColumn<DateTime> updatedAt =
|
||||||
avatarColor = i0.GeneratedColumn<int>('avatar_color', aliasedName, true,
|
i0.GeneratedColumn<DateTime>('updated_at', aliasedName, false,
|
||||||
type: i0.DriftSqlType.int, requiredDuringInsert: false)
|
type: i0.DriftSqlType.dateTime,
|
||||||
.withConverter<i2.AvatarColor?>(
|
requiredDuringInsert: false,
|
||||||
i1.$UserEntityTable.$converteravatarColorn);
|
defaultValue: i3.currentDateAndTime);
|
||||||
|
static const i0.VerificationMeta _quotaSizeInBytesMeta =
|
||||||
|
const i0.VerificationMeta('quotaSizeInBytes');
|
||||||
@override
|
@override
|
||||||
List<i0.GeneratedColumn> get $columns =>
|
late final i0.GeneratedColumn<int> quotaSizeInBytes = i0.GeneratedColumn<int>(
|
||||||
[id, name, email, deletedAt, avatarColor];
|
'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 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
|
||||||
@@ -242,15 +323,37 @@ class $UserEntityTable extends i3.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('deleted_at')) {
|
if (data.containsKey('profile_image_path')) {
|
||||||
context.handle(_deletedAtMeta,
|
context.handle(
|
||||||
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta));
|
_profileImagePathMeta,
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
@@ -265,13 +368,18 @@ class $UserEntityTable extends i3.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'])!,
|
||||||
deletedAt: attachedDatabase.typeMapping
|
profileImagePath: attachedDatabase.typeMapping.read(
|
||||||
.read(i0.DriftSqlType.dateTime, data['${effectivePrefix}deleted_at']),
|
i0.DriftSqlType.string, data['${effectivePrefix}profile_image_path']),
|
||||||
avatarColor: i1.$UserEntityTable.$converteravatarColorn.fromSql(
|
updatedAt: attachedDatabase.typeMapping.read(
|
||||||
attachedDatabase.typeMapping.read(
|
i0.DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!,
|
||||||
i0.DriftSqlType.int, data['${effectivePrefix}avatar_color'])),
|
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'])!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,11 +388,6 @@ class $UserEntityTable extends i3.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
|
||||||
@@ -295,28 +398,36 @@ 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 DateTime? deletedAt;
|
final String? profileImagePath;
|
||||||
final i2.AvatarColor? avatarColor;
|
final DateTime updatedAt;
|
||||||
|
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.deletedAt,
|
this.profileImagePath,
|
||||||
this.avatarColor});
|
required this.updatedAt,
|
||||||
|
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 || deletedAt != null) {
|
if (!nullToAbsent || profileImagePath != null) {
|
||||||
map['deleted_at'] = i0.Variable<DateTime>(deletedAt);
|
map['profile_image_path'] = i0.Variable<String>(profileImagePath);
|
||||||
}
|
}
|
||||||
if (!nullToAbsent || avatarColor != null) {
|
map['updated_at'] = i0.Variable<DateTime>(updatedAt);
|
||||||
map['avatar_color'] = i0.Variable<int>(
|
if (!nullToAbsent || quotaSizeInBytes != null) {
|
||||||
i1.$UserEntityTable.$converteravatarColorn.toSql(avatarColor));
|
map['quota_size_in_bytes'] = i0.Variable<int>(quotaSizeInBytes);
|
||||||
}
|
}
|
||||||
|
map['quota_usage_in_bytes'] = i0.Variable<int>(quotaUsageInBytes);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,10 +437,12 @@ 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']),
|
||||||
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
profileImagePath: serializer.fromJson<String?>(json['profileImagePath']),
|
||||||
avatarColor: i1.$UserEntityTable.$converteravatarColorn
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
||||||
.fromJson(serializer.fromJson<int?>(json['avatarColor'])),
|
quotaSizeInBytes: serializer.fromJson<int?>(json['quotaSizeInBytes']),
|
||||||
|
quotaUsageInBytes: serializer.fromJson<int>(json['quotaUsageInBytes']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
@@ -338,34 +451,54 @@ 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),
|
||||||
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
'profileImagePath': serializer.toJson<String?>(profileImagePath),
|
||||||
'avatarColor': serializer.toJson<int?>(
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
||||||
i1.$UserEntityTable.$converteravatarColorn.toJson(avatarColor)),
|
'quotaSizeInBytes': serializer.toJson<int?>(quotaSizeInBytes),
|
||||||
|
'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<DateTime?> deletedAt = const i0.Value.absent(),
|
i0.Value<String?> profileImagePath = const i0.Value.absent(),
|
||||||
i0.Value<i2.AvatarColor?> avatarColor = const i0.Value.absent()}) =>
|
DateTime? updatedAt,
|
||||||
|
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,
|
||||||
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
profileImagePath: profileImagePath.present
|
||||||
avatarColor: avatarColor.present ? avatarColor.value : this.avatarColor,
|
? profileImagePath.value
|
||||||
|
: 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,
|
||||||
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
profileImagePath: data.profileImagePath.present
|
||||||
avatarColor:
|
? data.profileImagePath.value
|
||||||
data.avatarColor.present ? data.avatarColor.value : this.avatarColor,
|
: this.profileImagePath,
|
||||||
|
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,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,76 +507,104 @@ 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('deletedAt: $deletedAt, ')
|
..write('profileImagePath: $profileImagePath, ')
|
||||||
..write('avatarColor: $avatarColor')
|
..write('updatedAt: $updatedAt, ')
|
||||||
|
..write('quotaSizeInBytes: $quotaSizeInBytes, ')
|
||||||
|
..write('quotaUsageInBytes: $quotaUsageInBytes')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(id, name, email, deletedAt, avatarColor);
|
int get hashCode => Object.hash(id, name, isAdmin, email, profileImagePath,
|
||||||
|
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.deletedAt == this.deletedAt &&
|
other.profileImagePath == this.profileImagePath &&
|
||||||
other.avatarColor == this.avatarColor);
|
other.updatedAt == this.updatedAt &&
|
||||||
|
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<DateTime?> deletedAt;
|
final i0.Value<String?> profileImagePath;
|
||||||
final i0.Value<i2.AvatarColor?> avatarColor;
|
final i0.Value<DateTime> updatedAt;
|
||||||
|
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.deletedAt = const i0.Value.absent(),
|
this.profileImagePath = const i0.Value.absent(),
|
||||||
this.avatarColor = const i0.Value.absent(),
|
this.updatedAt = 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.deletedAt = const i0.Value.absent(),
|
this.profileImagePath = const i0.Value.absent(),
|
||||||
this.avatarColor = const i0.Value.absent(),
|
this.updatedAt = 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<DateTime>? deletedAt,
|
i0.Expression<String>? profileImagePath,
|
||||||
i0.Expression<int>? avatarColor,
|
i0.Expression<DateTime>? updatedAt,
|
||||||
|
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 (deletedAt != null) 'deleted_at': deletedAt,
|
if (profileImagePath != null) 'profile_image_path': profileImagePath,
|
||||||
if (avatarColor != null) 'avatar_color': avatarColor,
|
if (updatedAt != null) 'updated_at': updatedAt,
|
||||||
|
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<DateTime?>? deletedAt,
|
i0.Value<String?>? profileImagePath,
|
||||||
i0.Value<i2.AvatarColor?>? avatarColor}) {
|
i0.Value<DateTime>? updatedAt,
|
||||||
|
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,
|
||||||
deletedAt: deletedAt ?? this.deletedAt,
|
profileImagePath: profileImagePath ?? this.profileImagePath,
|
||||||
avatarColor: avatarColor ?? this.avatarColor,
|
updatedAt: updatedAt ?? this.updatedAt,
|
||||||
|
quotaSizeInBytes: quotaSizeInBytes ?? this.quotaSizeInBytes,
|
||||||
|
quotaUsageInBytes: quotaUsageInBytes ?? this.quotaUsageInBytes,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,15 +617,23 @@ 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 (deletedAt.present) {
|
if (profileImagePath.present) {
|
||||||
map['deleted_at'] = i0.Variable<DateTime>(deletedAt.value);
|
map['profile_image_path'] = i0.Variable<String>(profileImagePath.value);
|
||||||
}
|
}
|
||||||
if (avatarColor.present) {
|
if (updatedAt.present) {
|
||||||
map['avatar_color'] = i0.Variable<int>(
|
map['updated_at'] = i0.Variable<DateTime>(updatedAt.value);
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -474,9 +643,12 @@ 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('deletedAt: $deletedAt, ')
|
..write('profileImagePath: $profileImagePath, ')
|
||||||
..write('avatarColor: $avatarColor')
|
..write('updatedAt: $updatedAt, ')
|
||||||
|
..write('quotaSizeInBytes: $quotaSizeInBytes, ')
|
||||||
|
..write('quotaUsageInBytes: $quotaUsageInBytes')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
675
mobile/lib/infrastructure/entities/user.entity.g.dart
generated
675
mobile/lib/infrastructure/entities/user.entity.g.dart
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,8 @@ 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 => text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
TextColumn get userId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
IntColumn get key => intEnum<UserMetadataKey>()();
|
IntColumn get key => intEnum<UserMetadataKey>()();
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ 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?> userMetadataConverter = TypeConverter.jsonb(
|
final JsonTypeConverter2<Map<String, Object?>, Uint8List, Object?>
|
||||||
|
userMetadataConverter = TypeConverter.jsonb(
|
||||||
fromJson: (json) => json as Map<String, Object?>,
|
fromJson: (json) => json as Map<String, Object?>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ 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.select().map((assetFace) => assetFace.toDto()).get();
|
return _db.assetFaceEntity
|
||||||
|
.select()
|
||||||
|
.map((assetFace) => assetFace.toDto())
|
||||||
|
.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.excluded),
|
_db.localAlbumEntity.backupSelection
|
||||||
|
.equalsValue(BackupSelection.excluded),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,8 +41,10 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
_db.localAlbumEntity.backupSelection
|
||||||
_db.localAlbumAssetEntity.assetId.isNotInQuery(_getExcludedSubquery()),
|
.equalsValue(BackupSelection.selected) &
|
||||||
|
_db.localAlbumAssetEntity.assetId
|
||||||
|
.isNotInQuery(_getExcludedSubquery()),
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.get().then((rows) => rows.length);
|
return query.get().then((rows) => rows.length);
|
||||||
@@ -63,14 +66,18 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
_db.localAssetEntity.checksum
|
||||||
|
.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
_db.localAlbumEntity.backupSelection
|
||||||
(_db.remoteAssetEntity.id.isNull() | _db.remoteAssetEntity.ownerId.equals(userId).not()) &
|
.equalsValue(BackupSelection.selected) &
|
||||||
_db.localAlbumAssetEntity.assetId.isNotInQuery(_getExcludedSubquery()),
|
(_db.remoteAssetEntity.id.isNull() |
|
||||||
|
_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);
|
||||||
@@ -94,15 +101,18 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
_db.localAssetEntity.checksum
|
||||||
|
.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
_db.localAlbumEntity.backupSelection
|
||||||
|
.equalsValue(BackupSelection.selected) &
|
||||||
_db.remoteAssetEntity.id.isNotNull() &
|
_db.remoteAssetEntity.id.isNotNull() &
|
||||||
_db.remoteAssetEntity.ownerId.equals(userId) &
|
_db.remoteAssetEntity.ownerId.equals(userId) &
|
||||||
_db.localAlbumAssetEntity.assetId.isNotInQuery(_getExcludedSubquery()),
|
_db.localAlbumAssetEntity.assetId
|
||||||
|
.isNotInQuery(_getExcludedSubquery()),
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.get().then((rows) => rows.length);
|
return query.get().then((rows) => rows.length);
|
||||||
@@ -112,7 +122,8 @@ 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.equalsValue(BackupSelection.selected),
|
_db.localAlbumEntity.backupSelection
|
||||||
|
.equalsValue(BackupSelection.selected),
|
||||||
);
|
);
|
||||||
|
|
||||||
final query = _db.localAssetEntity.select()
|
final query = _db.localAssetEntity.select()
|
||||||
@@ -122,7 +133,8 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
_db.localAlbumAssetEntity.selectOnly()
|
_db.localAlbumAssetEntity.selectOnly()
|
||||||
..addColumns([_db.localAlbumAssetEntity.assetId])
|
..addColumns([_db.localAlbumAssetEntity.assetId])
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumAssetEntity.albumId.isInQuery(selectedAlbumIds) &
|
_db.localAlbumAssetEntity.albumId
|
||||||
|
.isInQuery(selectedAlbumIds) &
|
||||||
_db.localAlbumAssetEntity.assetId.equalsExp(lae.id),
|
_db.localAlbumAssetEntity.assetId.equalsExp(lae.id),
|
||||||
),
|
),
|
||||||
) &
|
) &
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ 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/auth_user.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/asset_face.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/exif.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';
|
||||||
@@ -44,7 +43,6 @@ class IsarDatabaseRepository implements IDatabaseRepository {
|
|||||||
@DriftDatabase(
|
@DriftDatabase(
|
||||||
tables: [
|
tables: [
|
||||||
UserEntity,
|
UserEntity,
|
||||||
AuthUserEntity,
|
|
||||||
UserMetadataEntity,
|
UserMetadataEntity,
|
||||||
PartnerEntity,
|
PartnerEntity,
|
||||||
LocalAlbumEntity,
|
LocalAlbumEntity,
|
||||||
@@ -76,7 +74,7 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 5;
|
int get schemaVersion => 4;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
@@ -104,18 +102,13 @@ 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 = await customSelect('PRAGMA foreign_key_check').get();
|
final wrongFKs =
|
||||||
|
await customSelect('PRAGMA foreign_key_check').get();
|
||||||
assert(wrongFKs.isEmpty, '${wrongFKs.map((e) => e.data)}');
|
assert(wrongFKs.isEmpty, '${wrongFKs.map((e) => e.data)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,5 +127,6 @@ class DriftDatabaseRepository implements IDatabaseRepository {
|
|||||||
const DriftDatabaseRepository(this._db);
|
const DriftDatabaseRepository(this._db);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<T> transaction<T>(Future<T> Function() callback) => _db.transaction(callback);
|
Future<T> transaction<T>(Future<T> Function() callback) =>
|
||||||
|
_db.transaction(callback);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,31 +13,29 @@ 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/auth_user.entity.drift.dart'
|
|
||||||
as i7;
|
|
||||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart'
|
||||||
as i8;
|
as i7;
|
||||||
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart'
|
||||||
as i9;
|
as i8;
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
||||||
as i10;
|
as i9;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
||||||
as i11;
|
as i10;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
||||||
as i12;
|
as i11;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
||||||
as i13;
|
as i12;
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart'
|
||||||
as i14;
|
as i13;
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart'
|
||||||
as i15;
|
as i14;
|
||||||
import 'package:immich_mobile/infrastructure/entities/person.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/person.entity.drift.dart'
|
||||||
as i16;
|
as i15;
|
||||||
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart'
|
||||||
as i17;
|
as i16;
|
||||||
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
||||||
as i18;
|
as i17;
|
||||||
import 'package:drift/internal/modular.dart' as i19;
|
import 'package:drift/internal/modular.dart' as i18;
|
||||||
|
|
||||||
abstract class $Drift extends i0.GeneratedDatabase {
|
abstract class $Drift extends i0.GeneratedDatabase {
|
||||||
$Drift(i0.QueryExecutor e) : super(e);
|
$Drift(i0.QueryExecutor e) : super(e);
|
||||||
@@ -52,28 +50,26 @@ 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.$AuthUserEntityTable authUserEntity =
|
late final i7.$UserMetadataEntityTable userMetadataEntity =
|
||||||
i7.$AuthUserEntityTable(this);
|
i7.$UserMetadataEntityTable(this);
|
||||||
late final i8.$UserMetadataEntityTable userMetadataEntity =
|
late final i8.$PartnerEntityTable partnerEntity =
|
||||||
i8.$UserMetadataEntityTable(this);
|
i8.$PartnerEntityTable(this);
|
||||||
late final i9.$PartnerEntityTable partnerEntity =
|
late final i9.$RemoteExifEntityTable remoteExifEntity =
|
||||||
i9.$PartnerEntityTable(this);
|
i9.$RemoteExifEntityTable(this);
|
||||||
late final i10.$RemoteExifEntityTable remoteExifEntity =
|
late final i10.$RemoteAlbumEntityTable remoteAlbumEntity =
|
||||||
i10.$RemoteExifEntityTable(this);
|
i10.$RemoteAlbumEntityTable(this);
|
||||||
late final i11.$RemoteAlbumEntityTable remoteAlbumEntity =
|
late final i11.$RemoteAlbumAssetEntityTable remoteAlbumAssetEntity =
|
||||||
i11.$RemoteAlbumEntityTable(this);
|
i11.$RemoteAlbumAssetEntityTable(this);
|
||||||
late final i12.$RemoteAlbumAssetEntityTable remoteAlbumAssetEntity =
|
late final i12.$RemoteAlbumUserEntityTable remoteAlbumUserEntity =
|
||||||
i12.$RemoteAlbumAssetEntityTable(this);
|
i12.$RemoteAlbumUserEntityTable(this);
|
||||||
late final i13.$RemoteAlbumUserEntityTable remoteAlbumUserEntity =
|
late final i13.$MemoryEntityTable memoryEntity = i13.$MemoryEntityTable(this);
|
||||||
i13.$RemoteAlbumUserEntityTable(this);
|
late final i14.$MemoryAssetEntityTable memoryAssetEntity =
|
||||||
late final i14.$MemoryEntityTable memoryEntity = i14.$MemoryEntityTable(this);
|
i14.$MemoryAssetEntityTable(this);
|
||||||
late final i15.$MemoryAssetEntityTable memoryAssetEntity =
|
late final i15.$PersonEntityTable personEntity = i15.$PersonEntityTable(this);
|
||||||
i15.$MemoryAssetEntityTable(this);
|
late final i16.$AssetFaceEntityTable assetFaceEntity =
|
||||||
late final i16.$PersonEntityTable personEntity = i16.$PersonEntityTable(this);
|
i16.$AssetFaceEntityTable(this);
|
||||||
late final i17.$AssetFaceEntityTable assetFaceEntity =
|
i17.MergedAssetDrift get mergedAssetDrift => i18.ReadDatabaseContainer(this)
|
||||||
i17.$AssetFaceEntityTable(this);
|
.accessor<i17.MergedAssetDrift>(i17.MergedAssetDrift.new);
|
||||||
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?>>();
|
||||||
@@ -88,7 +84,6 @@ 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,
|
||||||
@@ -273,27 +268,25 @@ 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.$$AuthUserEntityTableTableManager get authUserEntity =>
|
i7.$$UserMetadataEntityTableTableManager get userMetadataEntity =>
|
||||||
i7.$$AuthUserEntityTableTableManager(_db, _db.authUserEntity);
|
i7.$$UserMetadataEntityTableTableManager(_db, _db.userMetadataEntity);
|
||||||
i8.$$UserMetadataEntityTableTableManager get userMetadataEntity =>
|
i8.$$PartnerEntityTableTableManager get partnerEntity =>
|
||||||
i8.$$UserMetadataEntityTableTableManager(_db, _db.userMetadataEntity);
|
i8.$$PartnerEntityTableTableManager(_db, _db.partnerEntity);
|
||||||
i9.$$PartnerEntityTableTableManager get partnerEntity =>
|
i9.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
||||||
i9.$$PartnerEntityTableTableManager(_db, _db.partnerEntity);
|
i9.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
||||||
i10.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
i10.$$RemoteAlbumEntityTableTableManager get remoteAlbumEntity =>
|
||||||
i10.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
i10.$$RemoteAlbumEntityTableTableManager(_db, _db.remoteAlbumEntity);
|
||||||
i11.$$RemoteAlbumEntityTableTableManager get remoteAlbumEntity =>
|
i11.$$RemoteAlbumAssetEntityTableTableManager get remoteAlbumAssetEntity =>
|
||||||
i11.$$RemoteAlbumEntityTableTableManager(_db, _db.remoteAlbumEntity);
|
i11.$$RemoteAlbumAssetEntityTableTableManager(
|
||||||
i12.$$RemoteAlbumAssetEntityTableTableManager get remoteAlbumAssetEntity =>
|
|
||||||
i12.$$RemoteAlbumAssetEntityTableTableManager(
|
|
||||||
_db, _db.remoteAlbumAssetEntity);
|
_db, _db.remoteAlbumAssetEntity);
|
||||||
i13.$$RemoteAlbumUserEntityTableTableManager get remoteAlbumUserEntity => i13
|
i12.$$RemoteAlbumUserEntityTableTableManager get remoteAlbumUserEntity => i12
|
||||||
.$$RemoteAlbumUserEntityTableTableManager(_db, _db.remoteAlbumUserEntity);
|
.$$RemoteAlbumUserEntityTableTableManager(_db, _db.remoteAlbumUserEntity);
|
||||||
i14.$$MemoryEntityTableTableManager get memoryEntity =>
|
i13.$$MemoryEntityTableTableManager get memoryEntity =>
|
||||||
i14.$$MemoryEntityTableTableManager(_db, _db.memoryEntity);
|
i13.$$MemoryEntityTableTableManager(_db, _db.memoryEntity);
|
||||||
i15.$$MemoryAssetEntityTableTableManager get memoryAssetEntity =>
|
i14.$$MemoryAssetEntityTableTableManager get memoryAssetEntity =>
|
||||||
i15.$$MemoryAssetEntityTableTableManager(_db, _db.memoryAssetEntity);
|
i14.$$MemoryAssetEntityTableTableManager(_db, _db.memoryAssetEntity);
|
||||||
i16.$$PersonEntityTableTableManager get personEntity =>
|
i15.$$PersonEntityTableTableManager get personEntity =>
|
||||||
i16.$$PersonEntityTableTableManager(_db, _db.personEntity);
|
i15.$$PersonEntityTableTableManager(_db, _db.personEntity);
|
||||||
i17.$$AssetFaceEntityTableTableManager get assetFaceEntity =>
|
i16.$$AssetFaceEntityTableTableManager get assetFaceEntity =>
|
||||||
i17.$$AssetFaceEntityTableTableManager(_db, _db.assetFaceEntity);
|
i16.$$AssetFaceEntityTableTableManager(_db, _db.assetFaceEntity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1707,470 +1707,10 @@ 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) {
|
||||||
@@ -2189,11 +1729,6 @@ 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');
|
||||||
}
|
}
|
||||||
@@ -2204,12 +1739,10 @@ 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,7 +24,8 @@ 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.putAll(assetHash.map(DeviceAssetEntity.fromDto).toList());
|
await _db.deviceAssetEntitys
|
||||||
|
.putAll(assetHash.map(DeviceAssetEntity.fromDto).toList());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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' as entity;
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart'
|
||||||
|
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,7 +8,13 @@ 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 { id, backupSelection, isIosSharedAlbum, name, assetCount }
|
enum SortLocalAlbumsBy {
|
||||||
|
id,
|
||||||
|
backupSelection,
|
||||||
|
isIosSharedAlbum,
|
||||||
|
name,
|
||||||
|
assetCount
|
||||||
|
}
|
||||||
|
|
||||||
class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
||||||
final Drift _db;
|
final Drift _db;
|
||||||
@@ -37,9 +43,12 @@ 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 => OrderingTerm.asc(_db.localAlbumEntity.backupSelection),
|
SortLocalAlbumsBy.backupSelection =>
|
||||||
SortLocalAlbumsBy.isIosSharedAlbum => OrderingTerm.asc(_db.localAlbumEntity.isIosSharedAlbum),
|
OrderingTerm.asc(_db.localAlbumEntity.backupSelection),
|
||||||
SortLocalAlbumsBy.name => OrderingTerm.asc(_db.localAlbumEntity.name),
|
SortLocalAlbumsBy.isIosSharedAlbum =>
|
||||||
|
OrderingTerm.asc(_db.localAlbumEntity.isIosSharedAlbum),
|
||||||
|
SortLocalAlbumsBy.name =>
|
||||||
|
OrderingTerm.asc(_db.localAlbumEntity.name),
|
||||||
SortLocalAlbumsBy.assetCount => OrderingTerm.desc(assetCount),
|
SortLocalAlbumsBy.assetCount => OrderingTerm.desc(assetCount),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -49,7 +58,9 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
return query
|
return query
|
||||||
.map(
|
.map(
|
||||||
(row) => row.readTable(_db.localAlbumEntity).toDto(assetCount: row.read(assetCount) ?? 0),
|
(row) => row
|
||||||
|
.readTable(_db.localAlbumEntity)
|
||||||
|
.toDto(assetCount: row.read(assetCount) ?? 0),
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
@@ -58,11 +69,15 @@ 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 ? await _getUniqueAssetsInAlbum(albumId) : await getAssetIds(albumId);
|
final assetsToDelete = _platform.isIOS
|
||||||
|
? 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.filter((a) => a.id.equals(albumId)).delete();
|
await _db.managers.localAlbumEntity
|
||||||
|
.filter((a) => a.id.equals(albumId))
|
||||||
|
.delete();
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<void> syncDeletes(
|
Future<void> syncDeletes(
|
||||||
@@ -80,11 +95,13 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.localAlbumEntity,
|
_db.localAlbumEntity,
|
||||||
_db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id),
|
_db.localAlbumAssetEntity.albumId
|
||||||
|
.equalsExp(_db.localAlbumEntity.id),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
subQuery.where(
|
subQuery.where(
|
||||||
_db.localAlbumEntity.id.equals(albumId) & _db.localAlbumAssetEntity.assetId.isNotIn(assetIdsToKeep),
|
_db.localAlbumEntity.id.equals(albumId) &
|
||||||
|
_db.localAlbumAssetEntity.assetId.isNotIn(assetIdsToKeep),
|
||||||
);
|
);
|
||||||
return localAsset.id.isInQuery(subQuery);
|
return localAsset.id.isInQuery(subQuery);
|
||||||
});
|
});
|
||||||
@@ -105,7 +122,8 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return _db.transaction(() async {
|
return _db.transaction(() async {
|
||||||
await _db.localAlbumEntity.insertOne(companion, onConflict: DoUpdate((_) => companion));
|
await _db.localAlbumEntity
|
||||||
|
.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(
|
||||||
@@ -124,7 +142,9 @@ 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.update().write(const LocalAlbumEntityCompanion(marker_: Value(true)));
|
await _db.localAlbumEntity
|
||||||
|
.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) {
|
||||||
@@ -164,7 +184,8 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.localAlbumEntity,
|
_db.localAlbumEntity,
|
||||||
_db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id),
|
_db.localAlbumAssetEntity.albumId
|
||||||
|
.equalsExp(_db.localAlbumEntity.id),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
subQuery.where(_db.localAlbumEntity.marker_.isNotNull());
|
subQuery.where(_db.localAlbumEntity.marker_.isNotNull());
|
||||||
@@ -188,14 +209,18 @@ 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.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
return query
|
||||||
|
.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.map((row) => row.read(_db.localAlbumAssetEntity.assetId)!).get();
|
return query
|
||||||
|
.map((row) => row.read(_db.localAlbumAssetEntity.assetId)!)
|
||||||
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> processDelta({
|
Future<void> processDelta({
|
||||||
@@ -215,7 +240,9 @@ 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.albumId.isNotIn(albumIds.cast<String?>().nonNulls) & f.assetId.equals(assetId),
|
(f) =>
|
||||||
|
f.albumId.isNotIn(albumIds.cast<String?>().nonNulls) &
|
||||||
|
f.assetId.equals(assetId),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -246,11 +273,14 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
..where(
|
..where(
|
||||||
_db.localAlbumAssetEntity.albumId.equals(albumId) & _db.localAssetEntity.checksum.isNull(),
|
_db.localAlbumAssetEntity.albumId.equals(albumId) &
|
||||||
|
_db.localAssetEntity.checksum.isNull(),
|
||||||
)
|
)
|
||||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
||||||
|
|
||||||
return query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
return query
|
||||||
|
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
||||||
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _upsertAssets(Iterable<LocalAsset> localAssets) {
|
Future<void> _upsertAssets(Iterable<LocalAsset> localAssets) {
|
||||||
@@ -334,7 +364,8 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..addColumns([assetId])
|
..addColumns([assetId])
|
||||||
..groupBy(
|
..groupBy(
|
||||||
[assetId],
|
[assetId],
|
||||||
having: _db.localAlbumAssetEntity.albumId.count().equals(1) & _db.localAlbumAssetEntity.albumId.equals(albumId),
|
having: _db.localAlbumAssetEntity.albumId.count().equals(1) &
|
||||||
|
_db.localAlbumAssetEntity.albumId.equals(albumId),
|
||||||
);
|
);
|
||||||
|
|
||||||
return query.map((row) => row.read(assetId)!).get();
|
return query.map((row) => row.read(assetId)!).get();
|
||||||
@@ -361,7 +392,9 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)])
|
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)])
|
||||||
..limit(1);
|
..limit(1);
|
||||||
|
|
||||||
final results = await query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
final results = await query
|
||||||
|
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
||||||
|
.get();
|
||||||
|
|
||||||
return results.isNotEmpty ? results.first : null;
|
return results.isNotEmpty ? results.first : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ 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.select().addColumns([_db.remoteAssetEntity.id]).join([
|
final query = _db.localAssetEntity
|
||||||
|
.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),
|
||||||
@@ -56,7 +58,8 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<LocalAsset?> getById(String id) {
|
Future<LocalAsset?> getById(String id) {
|
||||||
final query = _db.localAssetEntity.select()..where((lae) => lae.id.equals(id));
|
final query = _db.localAssetEntity.select()
|
||||||
|
..where((lae) => lae.id.equals(id));
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).getSingleOrNull();
|
return query.map((row) => row.toDto()).getSingleOrNull();
|
||||||
}
|
}
|
||||||
@@ -66,6 +69,8 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getHashedCount() {
|
Future<int> getHashedCount() {
|
||||||
return _db.managers.localAssetEntity.filter((e) => e.checksum.isNull().not()).count();
|
return _db.managers.localAssetEntity
|
||||||
|
.filter((e) => e.checksum.isNull().not())
|
||||||
|
.count();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class IsarLogRepository extends IsarDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<LogMessage>> getAll() async {
|
Future<List<LogMessage>> getAll() async {
|
||||||
final logs = await _db.loggerMessages.where().sortByCreatedAtDesc().findAll();
|
final logs =
|
||||||
|
await _db.loggerMessages.where().sortByCreatedAtDesc().findAll();
|
||||||
return logs.map((l) => l.toDto()).toList();
|
return logs.map((l) => l.toDto()).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +28,8 @@ 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 = logs.map((log) => LoggerMessage.fromDto(log)).toList();
|
final logEntities =
|
||||||
|
logs.map((log) => LoggerMessage.fromDto(log)).toList();
|
||||||
await _db.loggerMessages.putAll(logEntities);
|
await _db.loggerMessages.putAll(logEntities);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ 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.equalsValue(AssetVisibility.timeline),
|
_db.remoteAssetEntity.visibility
|
||||||
|
.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<PartnerUser>> getPartners(String userId) {
|
Future<List<PartnerUserDto>> 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 PartnerUser(
|
return PartnerUserDto(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -31,11 +31,12 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get users who we can share our library with
|
// Get users who we can share our library with
|
||||||
Future<List<PartnerUser>> getAvailablePartners(String currentUserId) {
|
Future<List<PartnerUserDto>> getAvailablePartners(String currentUserId) {
|
||||||
final query = _db.select(_db.userEntity)..where((row) => row.id.equals(currentUserId).not());
|
final query = _db.select(_db.userEntity)
|
||||||
|
..where((row) => row.id.equals(currentUserId).not());
|
||||||
|
|
||||||
return query.map((user) {
|
return query.map((user) {
|
||||||
return PartnerUser(
|
return PartnerUserDto(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -45,7 +46,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<PartnerUser>> getSharedWith(String partnerId) {
|
Future<List<PartnerUserDto>> getSharedWith(String partnerId) {
|
||||||
final query = _db.select(_db.partnerEntity).join([
|
final query = _db.select(_db.partnerEntity).join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.userEntity,
|
_db.userEntity,
|
||||||
@@ -59,7 +60,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 PartnerUser(
|
return PartnerUserDto(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -69,7 +70,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<PartnerUser>> getSharedBy(String userId) {
|
Future<List<PartnerUserDto>> getSharedBy(String userId) {
|
||||||
final query = _db.select(_db.partnerEntity).join([
|
final query = _db.select(_db.partnerEntity).join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.userEntity,
|
_db.userEntity,
|
||||||
@@ -83,7 +84,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 PartnerUser(
|
return PartnerUserDto(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -94,19 +95,24 @@ 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)..where((tbl) => tbl.sharedWithId.equals(userId));
|
final sharingWithMeQuery = _db.select(_db.partnerEntity)
|
||||||
final sharingWithMe = await sharingWithMeQuery.map((row) => row.sharedById).get();
|
..where((tbl) => tbl.sharedWithId.equals(userId));
|
||||||
|
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)..where((tbl) => tbl.sharedById.equals(userId));
|
final sharingWithThemQuery = _db.select(_db.partnerEntity)
|
||||||
final sharingWithThem = await sharingWithThemQuery.map((row) => row.sharedWithId).get();
|
..where((tbl) => tbl.sharedById.equals(userId));
|
||||||
|
final sharingWithThem =
|
||||||
|
await sharingWithThemQuery.map((row) => row.sharedWithId).get();
|
||||||
|
|
||||||
// Combine both lists and remove duplicates
|
// Combine both lists and remove duplicates
|
||||||
final allPartnerIds = <String>{...sharingWithMe, ...sharingWithThem}.toList();
|
final allPartnerIds =
|
||||||
|
<String>{...sharingWithMe, ...sharingWithThem}.toList();
|
||||||
return allPartnerIds;
|
return allPartnerIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<PartnerUser?> getPartner(String partnerId, String userId) {
|
Future<PartnerUserDto?> 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,
|
||||||
@@ -114,13 +120,14 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.partnerEntity.sharedById.equals(partnerId) & _db.partnerEntity.sharedWithId.equals(userId),
|
_db.partnerEntity.sharedById.equals(partnerId) &
|
||||||
|
_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 PartnerUser(
|
return PartnerUserDto(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
@@ -129,7 +136,7 @@ class DriftPartnerRepository extends DriftDatabaseRepository {
|
|||||||
}).getSingleOrNull();
|
}).getSingleOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> toggleShowInTimeline(PartnerUser partner, String userId) {
|
Future<bool> toggleShowInTimeline(PartnerUserDto partner, String userId) {
|
||||||
return _db.partnerEntity.update().replace(
|
return _db.partnerEntity.update().replace(
|
||||||
PartnerEntityCompanion(
|
PartnerEntityCompanion(
|
||||||
sharedById: Value(partner.id),
|
sharedById: Value(partner.id),
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ 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()..where((e) => e.ownerId.equals(userId));
|
final query = _db.personEntity.select()
|
||||||
|
..where((e) => e.ownerId.equals(userId));
|
||||||
|
|
||||||
return query.map((person) {
|
return query.map((person) {
|
||||||
return person.toDto();
|
return person.toDto();
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ 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 }
|
||||||
@@ -41,7 +40,8 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
]);
|
]);
|
||||||
query
|
query
|
||||||
..where(_db.remoteAssetEntity.deletedAt.isNull())
|
..where(_db.remoteAssetEntity.deletedAt.isNull())
|
||||||
..addColumns([assetCount, _db.userEntity.name])
|
..addColumns([assetCount])
|
||||||
|
..addColumns([_db.userEntity.name])
|
||||||
..groupBy([_db.remoteAlbumEntity.id]);
|
..groupBy([_db.remoteAlbumEntity.id]);
|
||||||
|
|
||||||
if (sortBy.isNotEmpty) {
|
if (sortBy.isNotEmpty) {
|
||||||
@@ -50,7 +50,8 @@ 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 => OrderingTerm.desc(_db.remoteAlbumEntity.updatedAt),
|
SortRemoteAlbumsBy.updatedAt =>
|
||||||
|
OrderingTerm.desc(_db.remoteAlbumEntity.updatedAt),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -136,7 +137,8 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.remoteAssetEntity.id.equalsExp(_db.remoteAlbumAssetEntity.assetId),
|
_db.remoteAssetEntity.id
|
||||||
|
.equalsExp(_db.remoteAlbumAssetEntity.assetId),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -147,18 +149,37 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
}).getSingle();
|
}).getSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<User>> getSharedUsers(String albumId) async {
|
Future<List<UserDto>> getSharedUsers(String albumId) async {
|
||||||
final query = _db.remoteAlbumUserEntity.selectOnly()
|
final albumUserRows = await (_db.select(_db.remoteAlbumUserEntity)
|
||||||
..join([
|
..where((row) => row.albumId.equals(albumId)))
|
||||||
innerJoin(
|
.get();
|
||||||
_db.userEntity,
|
|
||||||
_db.userEntity.id.equalsExp(_db.remoteAlbumUserEntity.userId),
|
|
||||||
useColumns: true,
|
|
||||||
),
|
|
||||||
])
|
|
||||||
..where(_db.remoteAlbumUserEntity.albumId.equals(albumId));
|
|
||||||
|
|
||||||
return query.map((row) => row.readTable(_db.userEntity).toDto()).get();
|
if (albumUserRows.isEmpty) {
|
||||||
|
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) {
|
||||||
@@ -170,7 +191,9 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
])
|
])
|
||||||
..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
||||||
|
|
||||||
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
return query
|
||||||
|
.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,7 +2,8 @@ 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' hide ExifInfo;
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart'
|
||||||
|
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';
|
||||||
@@ -21,7 +22,8 @@ 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.equalsValue(AssetVisibility.timeline),
|
_db.remoteAssetEntity.visibility
|
||||||
|
.equalsValue(AssetVisibility.timeline),
|
||||||
)
|
)
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)])
|
..orderBy([(row) => OrderingTerm.desc(row.createdAt)])
|
||||||
..limit(10);
|
..limit(10);
|
||||||
@@ -55,7 +57,8 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
final query = _db.remoteAssetEntity.select()
|
final query = _db.remoteAssetEntity.select()
|
||||||
..where(
|
..where(
|
||||||
(row) => row.stackId.equals(asset.stackId!) & row.id.equals(asset.id).not(),
|
(row) =>
|
||||||
|
row.stackId.equals(asset.stackId!) & row.id.equals(asset.id).not(),
|
||||||
)
|
)
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)]);
|
..orderBy([(row) => OrderingTerm.desc(row.createdAt)]);
|
||||||
|
|
||||||
@@ -69,16 +72,25 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
.getSingleOrNull();
|
.getSingleOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<RemoteAsset?> getAsset(String id) {
|
||||||
|
return _db.managers.remoteAssetEntity
|
||||||
|
.filter((row) => row.id.equals(id))
|
||||||
|
.map((row) => row.toDto())
|
||||||
|
.getSingleOrNull();
|
||||||
|
}
|
||||||
|
|
||||||
Future<List<(String, String)>> getPlaces() {
|
Future<List<(String, String)>> getPlaces() {
|
||||||
final asset = Subquery(
|
final asset = Subquery(
|
||||||
_db.remoteAssetEntity.select()..orderBy([(row) => OrderingTerm.desc(row.createdAt)]),
|
_db.remoteAssetEntity.select()
|
||||||
|
..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.equalsExp(asset.ref(_db.remoteAssetEntity.id)),
|
_db.remoteExifEntity.assetId
|
||||||
|
.equalsExp(asset.ref(_db.remoteAssetEntity.id)),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
@@ -89,7 +101,9 @@ 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.ref(_db.remoteAssetEntity.visibility).equals(AssetVisibility.timeline.index),
|
asset
|
||||||
|
.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)]);
|
||||||
@@ -168,6 +182,29 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> updateDateTime(List<String> ids, String dateTime) {
|
||||||
|
final localDateTime =
|
||||||
|
dateTime.replaceAll(RegExp(r'[\+|-][0-9]{2}:[0-9]{2}'), '');
|
||||||
|
return _db.batch((batch) async {
|
||||||
|
for (final id in ids) {
|
||||||
|
batch.update(
|
||||||
|
_db.remoteAssetEntity,
|
||||||
|
RemoteAssetEntityCompanion(
|
||||||
|
localDateTime: Value(DateTime.parse(localDateTime).toUtc()),
|
||||||
|
),
|
||||||
|
where: (e) => e.id.equals(id),
|
||||||
|
);
|
||||||
|
batch.update(
|
||||||
|
_db.remoteExifEntity,
|
||||||
|
RemoteExifEntityCompanion(
|
||||||
|
dateTimeOriginal: Value(DateTime.parse(dateTime)),
|
||||||
|
),
|
||||||
|
where: (e) => e.assetId.equals(id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> stack(String userId, StackResponse stack) {
|
Future<void> stack(String userId, StackResponse stack) {
|
||||||
return _db.transaction(() async {
|
return _db.transaction(() async {
|
||||||
final stackIds = await _db.managers.stackEntity
|
final stackIds = await _db.managers.stackEntity
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart' hide AssetVisibility;
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart'
|
||||||
|
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';
|
||||||
@@ -27,7 +28,9 @@ 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 ? AssetVisibility.archive : AssetVisibility.timeline,
|
visibility: filter.display.isArchive
|
||||||
|
? 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(),
|
||||||
@@ -40,16 +43,23 @@ class SearchApiRepository extends ApiRepository {
|
|||||||
|
|
||||||
return _api.searchAssets(
|
return _api.searchAssets(
|
||||||
MetadataSearchDto(
|
MetadataSearchDto(
|
||||||
originalFileName: filter.filename != null && filter.filename!.isNotEmpty ? filter.filename : null,
|
originalFileName: filter.filename != null && filter.filename!.isNotEmpty
|
||||||
|
? filter.filename
|
||||||
|
: null,
|
||||||
country: filter.location.country,
|
country: filter.location.country,
|
||||||
description: filter.description != null && filter.description!.isNotEmpty ? filter.description : null,
|
description:
|
||||||
|
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 ? AssetVisibility.archive : AssetVisibility.timeline,
|
visibility: filter.display.isArchive
|
||||||
|
? 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,7 +8,8 @@ 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()..where((e) => e.ownerId.equals(userId));
|
final query = _db.stackEntity.select()
|
||||||
|
..where((e) => e.ownerId.equals(userId));
|
||||||
|
|
||||||
return query.map((stack) {
|
return query.map((stack) {
|
||||||
return stack.toDto();
|
return stack.toDto();
|
||||||
|
|||||||
@@ -63,17 +63,23 @@ 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) as StoreKey<Object>;
|
final key = StoreKey.values.firstWhere((e) => e.id == entity.id)
|
||||||
|
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 => switch (key.type) {
|
Future<T?> _toValue<T>(StoreKey<T> key, StoreValue entity) async =>
|
||||||
|
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 ? null : DateTime.fromMillisecondsSinceEpoch(entity.intValue!),
|
const (DateTime) => entity.intValue == null
|
||||||
const (UserDto) => entity.strValue == null ? null : await IsarUserRepository(_db).getByUserId(entity.strValue!),
|
? null
|
||||||
|
: DateTime.fromMillisecondsSinceEpoch(entity.intValue!),
|
||||||
|
const (UserDto) => entity.strValue == null
|
||||||
|
? null
|
||||||
|
: await IsarUserRepository(_db).getByUserId(entity.strValue!),
|
||||||
_ => null,
|
_ => null,
|
||||||
} as T?;
|
} as T?;
|
||||||
|
|
||||||
@@ -95,7 +101,10 @@ class IsarStoreRepository extends IsarDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<StoreDto<Object>>> getAll() async {
|
Future<List<StoreDto<Object>>> getAll() async {
|
||||||
final entities = await _db.storeValues.filter().anyOf(validStoreKeys, (query, id) => query.idEqualTo(id)).findAll();
|
final entities = await _db.storeValues
|
||||||
|
.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,7 +41,6 @@ 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,
|
||||||
@@ -113,7 +112,8 @@ class SyncApiRepository {
|
|||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
stopwatch.stop();
|
stopwatch.stop();
|
||||||
_logger.info("Remote Sync completed in ${stopwatch.elapsed.inMilliseconds}ms");
|
_logger
|
||||||
|
.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,7 +139,6 @@ 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,7 +6,6 @@ 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';
|
||||||
@@ -30,41 +29,10 @@ 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.deleteWhere((row) => row.id.isIn(data.map((e) => e.userId)));
|
await _db.userEntity
|
||||||
|
.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;
|
||||||
@@ -78,8 +46,6 @@ 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(
|
||||||
@@ -118,7 +84,8 @@ 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 = PartnerEntityCompanion(inTimeline: Value(partner.inTimeline));
|
final companion =
|
||||||
|
PartnerEntityCompanion(inTimeline: Value(partner.inTimeline));
|
||||||
|
|
||||||
batch.insert(
|
batch.insert(
|
||||||
_db.partnerEntity,
|
_db.partnerEntity,
|
||||||
@@ -162,7 +129,8 @@ 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: Value(asset.duration?.toDuration()?.inSeconds ?? 0),
|
durationInSeconds:
|
||||||
|
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),
|
||||||
@@ -639,22 +607,6 @@ 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,
|
||||||
@@ -710,7 +662,9 @@ extension on String {
|
|||||||
extension on String {
|
extension on String {
|
||||||
Duration? toDuration() {
|
Duration? toDuration() {
|
||||||
try {
|
try {
|
||||||
final parts = split(':').map((e) => double.parse(e).toInt()).toList(growable: false);
|
final parts = split(':')
|
||||||
|
.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,7 +22,8 @@ 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.sharedWithId.equals(userId),
|
_db.partnerEntity.inTimeline.equals(true) &
|
||||||
|
_db.partnerEntity.sharedWithId.equals(userId),
|
||||||
);
|
);
|
||||||
|
|
||||||
return query
|
return query
|
||||||
@@ -172,7 +173,8 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
),
|
),
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
_db.localAssetEntity.checksum
|
||||||
|
.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -217,7 +219,10 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (_db.remoteAlbumEntity.select()..where((row) => row.id.equals(albumId))).watch().switchMap((albums) {
|
return (_db.remoteAlbumEntity.select()
|
||||||
|
..where((row) => row.id.equals(albumId)))
|
||||||
|
.watch()
|
||||||
|
.switchMap((albums) {
|
||||||
if (albums.isEmpty) {
|
if (albums.isEmpty) {
|
||||||
return Stream.value(<Bucket>[]);
|
return Stream.value(<Bucket>[]);
|
||||||
}
|
}
|
||||||
@@ -232,12 +237,14 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
..join([
|
..join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAlbumAssetEntity,
|
_db.remoteAlbumAssetEntity,
|
||||||
_db.remoteAlbumAssetEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
_db.remoteAlbumAssetEntity.assetId
|
||||||
|
.equalsExp(_db.remoteAssetEntity.id),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() & _db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
|
_db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
||||||
)
|
)
|
||||||
..groupBy([dateExp]);
|
..groupBy([dateExp]);
|
||||||
|
|
||||||
@@ -263,7 +270,9 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
required int offset,
|
required int offset,
|
||||||
required int count,
|
required int count,
|
||||||
}) async {
|
}) async {
|
||||||
final albumData = await _db.managers.remoteAlbumEntity.filter((row) => row.id.equals(albumId)).getSingleOrNull();
|
final albumData = await (_db.remoteAlbumEntity.select()
|
||||||
|
..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) {
|
||||||
@@ -276,12 +285,14 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
[
|
[
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAlbumAssetEntity,
|
_db.remoteAlbumAssetEntity,
|
||||||
_db.remoteAlbumAssetEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
_db.remoteAlbumAssetEntity.assetId
|
||||||
|
.equalsExp(_db.remoteAssetEntity.id),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)..where(
|
)..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() & _db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
|
_db.remoteAlbumAssetEntity.albumId.equals(albumId),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isAscending) {
|
if (isAscending) {
|
||||||
@@ -292,44 +303,62 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
query.limit(count, offset: offset);
|
query.limit(count, offset: offset);
|
||||||
|
|
||||||
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
return query
|
||||||
|
.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) => Future.value(assets.skip(offset).take(count).toList()),
|
assetSource: (offset, count) =>
|
||||||
|
Future.value(assets.skip(offset).take(count).toList()),
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery remote(String ownerId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
TimelineQuery remote(String ownerId, GroupAssetsBy groupBy) =>
|
||||||
|
_remoteQueryBuilder(
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() & row.visibility.equalsValue(AssetVisibility.timeline) & row.ownerId.equals(ownerId),
|
row.deletedAt.isNull() &
|
||||||
|
row.visibility.equalsValue(AssetVisibility.timeline) &
|
||||||
|
row.ownerId.equals(ownerId),
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery favorite(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
TimelineQuery favorite(String userId, GroupAssetsBy groupBy) =>
|
||||||
filter: (row) => row.deletedAt.isNull() & row.isFavorite.equals(true) & row.ownerId.equals(userId),
|
_remoteQueryBuilder(
|
||||||
|
filter: (row) =>
|
||||||
|
row.deletedAt.isNull() &
|
||||||
|
row.isFavorite.equals(true) &
|
||||||
|
row.ownerId.equals(userId),
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery trash(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
TimelineQuery trash(String userId, GroupAssetsBy groupBy) =>
|
||||||
|
_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) => _remoteQueryBuilder(
|
TimelineQuery archived(String userId, GroupAssetsBy groupBy) =>
|
||||||
|
_remoteQueryBuilder(
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() & row.ownerId.equals(userId) & row.visibility.equalsValue(AssetVisibility.archive),
|
row.deletedAt.isNull() &
|
||||||
|
row.ownerId.equals(userId) &
|
||||||
|
row.visibility.equalsValue(AssetVisibility.archive),
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery locked(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
TimelineQuery locked(String userId, GroupAssetsBy groupBy) =>
|
||||||
|
_remoteQueryBuilder(
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() & row.visibility.equalsValue(AssetVisibility.locked) & row.ownerId.equals(userId),
|
row.deletedAt.isNull() &
|
||||||
|
row.visibility.equalsValue(AssetVisibility.locked) &
|
||||||
|
row.ownerId.equals(userId),
|
||||||
groupBy: groupBy,
|
groupBy: groupBy,
|
||||||
);
|
);
|
||||||
|
|
||||||
TimelineQuery video(String userId, GroupAssetsBy groupBy) => _remoteQueryBuilder(
|
TimelineQuery video(String userId, GroupAssetsBy groupBy) =>
|
||||||
|
_remoteQueryBuilder(
|
||||||
filter: (row) =>
|
filter: (row) =>
|
||||||
row.deletedAt.isNull() &
|
row.deletedAt.isNull() &
|
||||||
row.type.equalsValue(AssetType.video) &
|
row.type.equalsValue(AssetType.video) &
|
||||||
@@ -376,7 +405,8 @@ 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.equalsValue(AssetVisibility.timeline),
|
_db.remoteAssetEntity.visibility
|
||||||
|
.equalsValue(AssetVisibility.timeline),
|
||||||
)
|
)
|
||||||
..groupBy([dateExp])
|
..groupBy([dateExp])
|
||||||
..orderBy([OrderingTerm.desc(dateExp)]);
|
..orderBy([OrderingTerm.desc(dateExp)]);
|
||||||
@@ -404,12 +434,15 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
)
|
)
|
||||||
..where(
|
..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
_db.remoteAssetEntity.visibility
|
||||||
|
.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.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
return query
|
||||||
|
.map((row) => row.readTable(_db.remoteAssetEntity).toDto())
|
||||||
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineQuery _remoteQueryBuilder({
|
TimelineQuery _remoteQueryBuilder({
|
||||||
@@ -463,7 +496,8 @@ 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.equalsExp(_db.localAssetEntity.checksum),
|
_db.remoteAssetEntity.checksum
|
||||||
|
.equalsExp(_db.localAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
@@ -505,7 +539,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 || GroupAssetsBy.auto => localTimeExp.date,
|
GroupAssetsBy.day => 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",
|
||||||
@@ -517,7 +551,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 || GroupAssetsBy.auto => "y-M-d",
|
GroupAssetsBy.day => "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,6 +1,7 @@
|
|||||||
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' as entity;
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart'
|
||||||
|
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';
|
||||||
|
|
||||||
@@ -10,18 +11,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.isarUsers.deleteAllById(ids);
|
await _db.users.deleteAllById(ids);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteAll() async {
|
Future<void> deleteAll() async {
|
||||||
await transaction(() async {
|
await transaction(() async {
|
||||||
await _db.isarUsers.clear();
|
await _db.users.clear();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<UserDto>> getAll({SortUserBy? sortBy}) async {
|
Future<List<UserDto>> getAll({SortUserBy? sortBy}) async {
|
||||||
return (await _db.isarUsers
|
return (await _db.users
|
||||||
.where()
|
.where()
|
||||||
.optional(
|
.optional(
|
||||||
sortBy != null,
|
sortBy != null,
|
||||||
@@ -35,44 +36,31 @@ class IsarUserRepository extends IsarDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<UserDto?> getByUserId(String id) async {
|
Future<UserDto?> getByUserId(String id) async {
|
||||||
return (await _db.isarUsers.getById(id))?.toDto();
|
return (await _db.users.getById(id))?.toDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<UserDto?>> getByUserIds(List<String> ids) async {
|
Future<List<UserDto?>> getByUserIds(List<String> ids) async {
|
||||||
return (await _db.isarUsers.getAllById(ids)).map((u) => u?.toDto()).toList();
|
return (await _db.users.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.isarUsers.put(entity.IsarUser.fromDto(user));
|
await _db.users.put(entity.User.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.isarUsers.put(entity.IsarUser.fromDto(user));
|
await _db.users.put(entity.User.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.isarUsers.putAll(users.map(entity.IsarUser.fromDto).toList());
|
await _db.users.putAll(users.map(entity.User.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,7 +11,8 @@ class UserApiRepository extends ApiRepository {
|
|||||||
const UserApiRepository(this._api);
|
const UserApiRepository(this._api);
|
||||||
|
|
||||||
Future<UserDto?> getMyUser() async {
|
Future<UserDto?> getMyUser() async {
|
||||||
final (adminDto, preferenceDto) = await (_api.getMyUser(), _api.getMyPreferences()).wait;
|
final (adminDto, preferenceDto) =
|
||||||
|
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,7 +8,8 @@ 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()..where((e) => e.userId.equals(userId));
|
final query = _db.userMetadataEntity.select()
|
||||||
|
..where((e) => e.userId.equals(userId));
|
||||||
|
|
||||||
return query.map((userMetadata) {
|
return query.map((userMetadata) {
|
||||||
return userMetadata.toDto();
|
return userMetadata.toDto();
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ class ImmichApp extends ConsumerStatefulWidget {
|
|||||||
ImmichAppState createState() => ImmichAppState();
|
ImmichAppState createState() => ImmichAppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserver {
|
class ImmichAppState extends ConsumerState<ImmichApp>
|
||||||
|
with WidgetsBindingObserver {
|
||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@@ -167,7 +168,9 @@ class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserve
|
|||||||
// 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 ? SystemUiOverlayStyle.dark : SystemUiOverlayStyle.light;
|
overlayStyle = context.isDarkTheme
|
||||||
|
? SystemUiOverlayStyle.dark
|
||||||
|
: SystemUiOverlayStyle.light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemChrome.setSystemUIOverlayStyle(overlayStyle);
|
SystemChrome.setSystemUIOverlayStyle(overlayStyle);
|
||||||
@@ -219,7 +222,8 @@ class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserve
|
|||||||
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 = currentRouteName == null || currentRouteName == SplashScreenRoute.name;
|
final isColdStart =
|
||||||
|
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(
|
||||||
@@ -295,7 +299,8 @@ class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserve
|
|||||||
),
|
),
|
||||||
routerConfig: router.config(
|
routerConfig: router.config(
|
||||||
deepLinkBuilder: _deepLinkBuilder,
|
deepLinkBuilder: _deepLinkBuilder,
|
||||||
navigatorObservers: () => [AppNavigationObserver(ref: ref), HeroController()],
|
navigatorObservers: () =>
|
||||||
|
[AppNavigationObserver(ref: ref), HeroController()],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -56,7 +56,12 @@ class Activity {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return id.hashCode ^ assetId.hashCode ^ comment.hashCode ^ createdAt.hashCode ^ type.hashCode ^ user.hashCode;
|
return id.hashCode ^
|
||||||
|
assetId.hashCode ^
|
||||||
|
comment.hashCode ^
|
||||||
|
createdAt.hashCode ^
|
||||||
|
type.hashCode ^
|
||||||
|
user.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,16 @@ class AlbumAddAssetsResponse {
|
|||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'AddAssetsResponse(alreadyInAlbum: $alreadyInAlbum, successfullyAdded: $successfullyAdded)';
|
String toString() =>
|
||||||
|
'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) && other.successfullyAdded == successfullyAdded;
|
return listEquals(other.alreadyInAlbum, alreadyInAlbum) &&
|
||||||
|
other.successfullyAdded == successfullyAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user