diff --git a/.github/actions/flutter-common/action.yml b/.github/actions/flutter-common/action.yml index 800e70ab6..5e52b587b 100644 --- a/.github/actions/flutter-common/action.yml +++ b/.github/actions/flutter-common/action.yml @@ -9,7 +9,7 @@ runs: uses: subosito/flutter-action@v2 with: channel: stable - flutter-version: 3.41.9 + flutter-version: 3.44.0 cache: true - name: Install Flutter dependencies diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 0a74ff7f3..6463dfd8e 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -5,17 +5,26 @@ on: - '**.dart' - 'pubspec.yaml' - 'analysis_options.yaml' + - 'lib/l10n/**' + - 'ios/Runner/Info.plist' + - 'android/app/src/main/res/xml/locales_config.xml' pull_request: branches: [ master, ] paths: - '**/*.dart' - 'pubspec.yaml' - 'analysis_options.yaml' + - 'lib/l10n/**' + - 'ios/Runner/Info.plist' + - 'android/app/src/main/res/xml/locales_config.xml' - '.github/actions/flutter-common/action.yml' - '.github/workflows/analyze.yml' workflow_call: workflow_dispatch: +permissions: + contents: read + jobs: analyze: name: Run analyzer @@ -31,3 +40,6 @@ jobs: - name: Analyze run: flutter analyze --no-fatal-infos --no-fatal-warnings + + - name: Check locale lists are in sync + run: dart run tool/check_locales.dart diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 0ad621313..da249ed40 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -16,6 +16,10 @@ on: required: true DECRYPTKEY_PROPERTIES: required: true + +permissions: + contents: read + jobs: build_android_apk: name: APK file diff --git a/.github/workflows/build-apple.yml b/.github/workflows/build-apple.yml index 1bb893adf..d95e5783c 100644 --- a/.github/workflows/build-apple.yml +++ b/.github/workflows/build-apple.yml @@ -11,6 +11,10 @@ on: ref: required: true type: string + +permissions: + contents: read + jobs: build_ios: name: iOS diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 3958f0067..435efe115 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -21,6 +21,10 @@ on: secrets: SSH_DEPLOY_KEY: required: true + +permissions: + contents: read + jobs: # TODO: note that we currently only build for x64, as arm64 is not supported by diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index e4a8995a0..0956ef8df 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -11,6 +11,10 @@ on: ref: required: true type: string + +permissions: + contents: read + jobs: # TODO: we currently upload the release folder as a ZIP, which works as a # portable version. For a proper installer (e.g. via Inno Setup or MSIX), diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index eade216d9..c595dd6d4 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -6,6 +6,9 @@ on: required: true type: string +permissions: + contents: write + jobs: determine_version: name: Create tag diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1c1235f5..a891b1d99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,9 @@ on: workflow_call: workflow_dispatch: +permissions: + contents: read + jobs: test: name: Run tests diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..b24b71894 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,40 @@ +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '44 6 * * 6' # Every Saturday at 6:44 UTC + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'actions' ] + # Supported languages https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v4 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index b77341b2a..5ae21bd3c 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -7,6 +7,9 @@ on: required: true type: string +permissions: + contents: read + jobs: ci: @@ -16,6 +19,8 @@ jobs: determine_version: needs: ci name: Prepare + permissions: + contents: write uses: ./.github/workflows/bump-version.yml with: app_version: ${{ github.event.inputs.version }} @@ -126,6 +131,8 @@ jobs: make_gh_release: name: Make Github Release runs-on: ubuntu-latest + permissions: + contents: write needs: - upload_play_store - build_linux diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index ae05cc3d5..f26dc11ce 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -7,6 +7,9 @@ on: type: boolean default: false +permissions: + contents: read + jobs: screenshots_apple: name: 'iOS' @@ -17,12 +20,6 @@ jobs: - name: Common flutter setup uses: ./.github/actions/flutter-common - - name: Install CocoaPods - run: | - cd ios - pod install || true - cd .. - - name: Boot iOS simulator id: boot run: | @@ -131,6 +128,8 @@ jobs: - screenshots_android runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v6 diff --git a/android/app/src/main/res/xml/locales_config.xml b/android/app/src/main/res/xml/locales_config.xml index 64cf1b329..5d088c4ae 100644 --- a/android/app/src/main/res/xml/locales_config.xml +++ b/android/app/src/main/res/xml/locales_config.xml @@ -11,6 +11,7 @@ + @@ -29,6 +30,7 @@ + diff --git a/fastlane/metadata/android/nb-NO/full_description.txt b/fastlane/metadata/android/nb-NO/full_description.txt index e5160aa75..c9fe2a85e 100644 --- a/fastlane/metadata/android/nb-NO/full_description.txt +++ b/fastlane/metadata/android/nb-NO/full_description.txt @@ -1,6 +1,38 @@ -wger (ˈvɛɡɐ) er gemenhetslig fri programvare som hjelper din helse. +Fra treningsentusiaster til treningsentusiaster – få helsen din organisert med WGER, din treningsmanager! -- Planlegg treningsøkter og ernæring -- Lagre øvelser og kommenter dem -- Helsestudio-modus -- Dagbok og utviklingssporing +Har du allerede funnet din favoritt treningsapp og elsker du å lage dine egne treningsrutiner? Uansett hvilken type treningsgal du er – vi har alle noe til felles: Vi elsker å holde oversikt over helsedata <3 + +Så vi dømmer deg ikke for at du fortsatt styrer treningsreisen din med den lille treningsdagboken din, men velkommen til 2025! + +Vi har utviklet en 100% gratis digital helse- og treningssporer-app for deg, trimmet ned til de mest relevante funksjonene for å gjøre livet ditt enklere. Kom i gang, fortsett å trene og feir fremgangen din! + +wger er et Open Source-prosjekt og handler om: +* Kroppen din +* Treningene dine +* Fremgangen din +* Dataene dine + +Kroppen din: Ikke noe behov for å google ingrediensene i favorittmatene dine – velg dine daglige måltider fra mer enn 78 000 produkter og se næringsverdiene. Legg til måltider i ernæringsplanen og hold oversikt over kostholdet ditt i kalenderen. + +Treningene dine: +Du vet hva som er best for kroppen din. Lag dine egne treningsøkter fra et voksende utvalg på 200 forskjellige øvelser. Bruk deretter Gym-modus for å guide deg gjennom treningen mens du logger vektene dine med ett trykk. + +Fremgangen din: +Mist aldri målet av syne. Spor vekten din og hold statistikken din. + +Dataene dine: +Wger er din personlige treningsdagbok – men du eier dataene dine. Bruk REST API-et for å få tilgang til dem og gjøre fantastiske ting med dem. + +Vær oppmerksom på: Denne gratis appen er ikke basert på ekstern finansiering, og vi ber deg ikke om å donere penger. Den er et fellesskapsprosjekt som vokser konstant. Så vær forberedt på nye funksjoner når som helst! + +#OpenSource – hva betyr det? + +Open Source betyr at hele kildekoden for denne appen og serveren den kommuniserer med er gratis og tilgjengelig for alle: +* Vil du kjøre wger på din egen server for deg selv eller det lokale treningssenteret ditt? Bare gjør det! +* Savner du en funksjon og vil implementere den? Start nå! +* Vil du sjekke at ingenting sendes noe sted? Det kan du! + +Bli med i fellesskapet vårt og bli en del av treningsentusiaster og IT-nerder fra hele verden. Vi jobber kontinuerlig med å tilpasse og optimalisere appen etter våre behov. Vi elsker dine innspill, så hopp gjerne inn når som helst og bidra med ønsker og ideer! + +-> finn kildekoden på https://github.com/wger-project +-> still spørsmål eller si hei på vår Discord-server https://discord.gg/rPWFv6W diff --git a/ios/.gitignore b/ios/.gitignore index e96ef602b..662923658 100644 --- a/ios/.gitignore +++ b/ios/.gitignore @@ -11,6 +11,7 @@ Icon? **/Pods/ **/.symlinks/ +**/Flutter/ephemeral/ profile xcuserdata **/.generated/ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8c1367e35..5900c352b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,116 +1,15 @@ PODS: - - camera_avfoundation (0.0.1): - - Flutter - - connectivity_plus (0.0.1): - - Flutter - Flutter (1.0.0) - - flutter_zxing (0.0.1): - - Flutter - - image_picker_ios (0.0.1): - - Flutter - - integration_test (0.0.1): - - Flutter - - package_info_plus (0.4.5): - - Flutter - - powersync-sqlite-core (0.4.12) - - powersync_flutter_libs (0.0.1): - - Flutter - - FlutterMacOS - - powersync-sqlite-core (~> 0.4.11) - - shared_preferences_foundation (0.0.1): - - Flutter - - FlutterMacOS - - sqlite3 (3.52.0): - - sqlite3/common (= 3.52.0) - - sqlite3/common (3.52.0) - - sqlite3/dbstatvtab (3.52.0): - - sqlite3/common - - sqlite3/fts5 (3.52.0): - - sqlite3/common - - sqlite3/math (3.52.0): - - sqlite3/common - - sqlite3/perf-threadsafe (3.52.0): - - sqlite3/common - - sqlite3/rtree (3.52.0): - - sqlite3/common - - sqlite3/session (3.52.0): - - sqlite3/common - - sqlite3_flutter_libs (0.0.1): - - Flutter - - FlutterMacOS - - sqlite3 (~> 3.52.0) - - sqlite3/dbstatvtab - - sqlite3/fts5 - - sqlite3/math - - sqlite3/perf-threadsafe - - sqlite3/rtree - - sqlite3/session - - url_launcher_ios (0.0.1): - - Flutter - - video_player_avfoundation (0.0.1): - - Flutter - - FlutterMacOS DEPENDENCIES: - - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - Flutter (from `Flutter`) - - flutter_zxing (from `.symlinks/plugins/flutter_zxing/ios`) - - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - - integration_test (from `.symlinks/plugins/integration_test/ios`) - - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - - powersync_flutter_libs (from `.symlinks/plugins/powersync_flutter_libs/darwin`) - - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/darwin`) - - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`) - -SPEC REPOS: - trunk: - - powersync-sqlite-core - - sqlite3 EXTERNAL SOURCES: - camera_avfoundation: - :path: ".symlinks/plugins/camera_avfoundation/ios" - connectivity_plus: - :path: ".symlinks/plugins/connectivity_plus/ios" Flutter: :path: Flutter - flutter_zxing: - :path: ".symlinks/plugins/flutter_zxing/ios" - image_picker_ios: - :path: ".symlinks/plugins/image_picker_ios/ios" - integration_test: - :path: ".symlinks/plugins/integration_test/ios" - package_info_plus: - :path: ".symlinks/plugins/package_info_plus/ios" - powersync_flutter_libs: - :path: ".symlinks/plugins/powersync_flutter_libs/darwin" - shared_preferences_foundation: - :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sqlite3_flutter_libs: - :path: ".symlinks/plugins/sqlite3_flutter_libs/darwin" - url_launcher_ios: - :path: ".symlinks/plugins/url_launcher_ios/ios" - video_player_avfoundation: - :path: ".symlinks/plugins/video_player_avfoundation/darwin" SPEC CHECKSUMS: - camera_avfoundation: 968a9a5323c79a99c166ad9d7866bfd2047b5a9b - connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 - flutter_zxing: fe1338b6d79b8a455d209a28381e336b6cfb4161 - image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326 - integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e - package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 - powersync-sqlite-core: 116ecf3391859445f1477f8c230914e04d9874e7 - powersync_flutter_libs: 20381b877038d27d8fa918f8c3fff08bfc3925d0 - shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb - sqlite3: a51c07cf16e023d6c48abd5e5791a61a47354921 - sqlite3_flutter_libs: b3e120efe9a82017e5552a620f696589ed4f62ab - url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b - video_player_avfoundation: dd410b52df6d2466a42d28550e33e4146928280a PODFILE CHECKSUM: 140d612345f5f5eda8a7ae30f1ccf4e0b07aced5 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index eb69bbb2b..5caf6464f 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 3845DFE0762714C6680D5DFA /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFA44D9DB464FB85F130C5B5 /* Pods_Runner.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -36,6 +37,7 @@ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 89F44165E15E0A7B109A05EB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 8D383D452D8E929100066A20 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; @@ -55,6 +57,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, 3845DFE0762714C6680D5DFA /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -73,6 +76,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, @@ -140,13 +144,15 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 0A9E38C31DF3DC192213822E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); dependencies = ( ); name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; @@ -175,6 +181,9 @@ Base, ); mainGroup = 97C146E51CF9000F007C117D; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectRoot = ""; @@ -199,23 +208,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0A9E38C31DF3DC192213822E /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -581,6 +573,20 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fc5ae0316..0bd6d4227 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 + CFBundleLocalizations + + am + ar + ca + cs + de + el + en + es + fa + fil + fr + gl + he + hi + hr + hu + id + it + ja + ko + mk + nb + nl + pl + pt + pt-BR + pt-PT + ro + ru + sk + sn + ta + th + tr + uk + ur + zh + zh-Hant + CFBundleName wger CFBundlePackageType diff --git a/lib/database/converters/exercise_image_style_converter.dart b/lib/database/converters/exercise_image_style_converter.dart new file mode 100644 index 000000000..c1e9377ff --- /dev/null +++ b/lib/database/converters/exercise_image_style_converter.dart @@ -0,0 +1,32 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (c) 2020 - 2026 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:drift/drift.dart'; +import 'package:wger/models/exercises/image.dart'; + +/// Maps an [ExerciseImageStyle] to and from the Django wire format +/// (`'1'`–`'5'`). +class ExerciseImageStyleConverter extends TypeConverter { + const ExerciseImageStyleConverter(); + + @override + ExerciseImageStyle fromSql(String fromDb) => ExerciseImageStyle.fromWire(fromDb); + + @override + String toSql(ExerciseImageStyle value) => value.wireValue; +} diff --git a/lib/database/powersync/database.dart b/lib/database/powersync/database.dart index b9367475c..b81959cd7 100644 --- a/lib/database/powersync/database.dart +++ b/lib/database/powersync/database.dart @@ -21,17 +21,18 @@ import 'package:drift_sqlite_async/drift_sqlite_async.dart'; import 'package:flutter/material.dart' show TimeOfDay; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:powersync/powersync.dart' as ps; +import 'package:wger/database/converters/exercise_image_style_converter.dart'; import 'package:wger/database/converters/time_of_day_converter.dart'; import 'package:wger/database/converters/workout_impression_converter.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; import 'package:wger/models/core/language.dart'; import 'package:wger/models/core/license.dart'; +import 'package:wger/models/exercises/alias.dart'; import 'package:wger/models/exercises/category.dart'; +import 'package:wger/models/exercises/comment.dart'; import 'package:wger/models/exercises/equipment.dart'; -import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/exercises/image.dart'; import 'package:wger/models/exercises/muscle.dart'; -import 'package:wger/models/exercises/translation.dart'; import 'package:wger/models/exercises/video.dart'; import 'package:wger/models/gallery/image.dart'; import 'package:wger/models/measurements/measurement_category.dart'; @@ -71,6 +72,8 @@ part 'database.g.dart'; // Exercises ExerciseTable, ExerciseTranslationTable, + ExerciseAliasTable, + ExerciseCommentTable, MuscleTable, ExerciseMuscleM2N, ExerciseSecondaryMuscleM2N, diff --git a/lib/database/powersync/database.g.dart b/lib/database/powersync/database.g.dart index 1fdebab66..27696b0a0 100644 --- a/lib/database/powersync/database.g.dart +++ b/lib/database/powersync/database.g.dart @@ -534,7 +534,7 @@ class ExerciseCategoryTableCompanion extends UpdateCompanion { } } -class $ExerciseTableTable extends ExerciseTable with TableInfo<$ExerciseTableTable, Exercise> { +class $ExerciseTableTable extends ExerciseTable with TableInfo<$ExerciseTableTable, ExerciseRow> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -620,7 +620,7 @@ class $ExerciseTableTable extends ExerciseTable with TableInfo<$ExerciseTableTab static const String $name = 'exercises_exercise'; @override VerificationContext validateIntegrity( - Insertable instance, { + Insertable instance, { bool isInserting = false, }) { final context = VerificationContext(); @@ -677,9 +677,9 @@ class $ExerciseTableTable extends ExerciseTable with TableInfo<$ExerciseTableTab @override Set get $primaryKey => const {}; @override - Exercise map(Map data, {String? tablePrefix}) { + ExerciseRow map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; - return Exercise( + return ExerciseRow( id: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}id'], @@ -688,14 +688,6 @@ class $ExerciseTableTable extends ExerciseTable with TableInfo<$ExerciseTableTab DriftSqlType.string, data['${effectivePrefix}uuid'], )!, - created: attachedDatabase.typeMapping.read( - DriftSqlType.dateTime, - data['${effectivePrefix}created'], - )!, - lastUpdate: attachedDatabase.typeMapping.read( - DriftSqlType.dateTime, - data['${effectivePrefix}last_update'], - )!, variationGroup: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}variation_group'], @@ -704,6 +696,14 @@ class $ExerciseTableTable extends ExerciseTable with TableInfo<$ExerciseTableTab DriftSqlType.int, data['${effectivePrefix}category_id'], )!, + created: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created'], + )!, + lastUpdate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_update'], + )!, ); } @@ -713,7 +713,129 @@ class $ExerciseTableTable extends ExerciseTable with TableInfo<$ExerciseTableTab } } -class ExerciseTableCompanion extends UpdateCompanion { +class ExerciseRow extends DataClass implements Insertable { + final int id; + final String uuid; + final String? variationGroup; + final int categoryId; + final DateTime created; + final DateTime lastUpdate; + const ExerciseRow({ + required this.id, + required this.uuid, + this.variationGroup, + required this.categoryId, + required this.created, + required this.lastUpdate, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['uuid'] = Variable(uuid); + if (!nullToAbsent || variationGroup != null) { + map['variation_group'] = Variable(variationGroup); + } + map['category_id'] = Variable(categoryId); + map['created'] = Variable(created); + map['last_update'] = Variable(lastUpdate); + return map; + } + + ExerciseTableCompanion toCompanion(bool nullToAbsent) { + return ExerciseTableCompanion( + id: Value(id), + uuid: Value(uuid), + variationGroup: variationGroup == null && nullToAbsent + ? const Value.absent() + : Value(variationGroup), + categoryId: Value(categoryId), + created: Value(created), + lastUpdate: Value(lastUpdate), + ); + } + + factory ExerciseRow.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ExerciseRow( + id: serializer.fromJson(json['id']), + uuid: serializer.fromJson(json['uuid']), + variationGroup: serializer.fromJson(json['variationGroup']), + categoryId: serializer.fromJson(json['categoryId']), + created: serializer.fromJson(json['created']), + lastUpdate: serializer.fromJson(json['lastUpdate']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'uuid': serializer.toJson(uuid), + 'variationGroup': serializer.toJson(variationGroup), + 'categoryId': serializer.toJson(categoryId), + 'created': serializer.toJson(created), + 'lastUpdate': serializer.toJson(lastUpdate), + }; + } + + ExerciseRow copyWith({ + int? id, + String? uuid, + Value variationGroup = const Value.absent(), + int? categoryId, + DateTime? created, + DateTime? lastUpdate, + }) => ExerciseRow( + id: id ?? this.id, + uuid: uuid ?? this.uuid, + variationGroup: variationGroup.present ? variationGroup.value : this.variationGroup, + categoryId: categoryId ?? this.categoryId, + created: created ?? this.created, + lastUpdate: lastUpdate ?? this.lastUpdate, + ); + ExerciseRow copyWithCompanion(ExerciseTableCompanion data) { + return ExerciseRow( + id: data.id.present ? data.id.value : this.id, + uuid: data.uuid.present ? data.uuid.value : this.uuid, + variationGroup: data.variationGroup.present ? data.variationGroup.value : this.variationGroup, + categoryId: data.categoryId.present ? data.categoryId.value : this.categoryId, + created: data.created.present ? data.created.value : this.created, + lastUpdate: data.lastUpdate.present ? data.lastUpdate.value : this.lastUpdate, + ); + } + + @override + String toString() { + return (StringBuffer('ExerciseRow(') + ..write('id: $id, ') + ..write('uuid: $uuid, ') + ..write('variationGroup: $variationGroup, ') + ..write('categoryId: $categoryId, ') + ..write('created: $created, ') + ..write('lastUpdate: $lastUpdate') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, uuid, variationGroup, categoryId, created, lastUpdate); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ExerciseRow && + other.id == this.id && + other.uuid == this.uuid && + other.variationGroup == this.variationGroup && + other.categoryId == this.categoryId && + other.created == this.created && + other.lastUpdate == this.lastUpdate); +} + +class ExerciseTableCompanion extends UpdateCompanion { final Value id; final Value uuid; final Value variationGroup; @@ -743,7 +865,7 @@ class ExerciseTableCompanion extends UpdateCompanion { categoryId = Value(categoryId), created = Value(created), lastUpdate = Value(lastUpdate); - static Insertable custom({ + static Insertable custom({ Expression? id, Expression? uuid, Expression? variationGroup, @@ -826,7 +948,7 @@ class ExerciseTableCompanion extends UpdateCompanion { } class $ExerciseTranslationTableTable extends ExerciseTranslationTable - with TableInfo<$ExerciseTranslationTableTable, Translation> { + with TableInfo<$ExerciseTranslationTableTable, ExerciseTranslationRow> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -937,7 +1059,7 @@ class $ExerciseTranslationTableTable extends ExerciseTranslationTable static const String $name = 'exercises_translation'; @override VerificationContext validateIntegrity( - Insertable instance, { + Insertable instance, { bool isInserting = false, }) { final context = VerificationContext(); @@ -1012,9 +1134,9 @@ class $ExerciseTranslationTableTable extends ExerciseTranslationTable @override Set get $primaryKey => const {}; @override - Translation map(Map data, {String? tablePrefix}) { + ExerciseTranslationRow map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; - return Translation( + return ExerciseTranslationRow( id: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}id'], @@ -1023,9 +1145,13 @@ class $ExerciseTranslationTableTable extends ExerciseTranslationTable DriftSqlType.string, data['${effectivePrefix}uuid'], )!, - created: attachedDatabase.typeMapping.read( - DriftSqlType.dateTime, - data['${effectivePrefix}created'], + exerciseId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}exercise_id'], + )!, + languageId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}language_id'], )!, name: attachedDatabase.typeMapping.read( DriftSqlType.string, @@ -1035,9 +1161,13 @@ class $ExerciseTranslationTableTable extends ExerciseTranslationTable DriftSqlType.string, data['${effectivePrefix}description'], )!, - exerciseId: attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}exercise_id'], + created: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created'], + )!, + lastUpdate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_update'], )!, ); } @@ -1048,7 +1178,158 @@ class $ExerciseTranslationTableTable extends ExerciseTranslationTable } } -class ExerciseTranslationTableCompanion extends UpdateCompanion { +class ExerciseTranslationRow extends DataClass implements Insertable { + final int id; + final String uuid; + final int exerciseId; + final int languageId; + final String name; + final String description; + final DateTime created; + final DateTime lastUpdate; + const ExerciseTranslationRow({ + required this.id, + required this.uuid, + required this.exerciseId, + required this.languageId, + required this.name, + required this.description, + required this.created, + required this.lastUpdate, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['uuid'] = Variable(uuid); + map['exercise_id'] = Variable(exerciseId); + map['language_id'] = Variable(languageId); + map['name'] = Variable(name); + map['description'] = Variable(description); + map['created'] = Variable(created); + map['last_update'] = Variable(lastUpdate); + return map; + } + + ExerciseTranslationTableCompanion toCompanion(bool nullToAbsent) { + return ExerciseTranslationTableCompanion( + id: Value(id), + uuid: Value(uuid), + exerciseId: Value(exerciseId), + languageId: Value(languageId), + name: Value(name), + description: Value(description), + created: Value(created), + lastUpdate: Value(lastUpdate), + ); + } + + factory ExerciseTranslationRow.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ExerciseTranslationRow( + id: serializer.fromJson(json['id']), + uuid: serializer.fromJson(json['uuid']), + exerciseId: serializer.fromJson(json['exerciseId']), + languageId: serializer.fromJson(json['languageId']), + name: serializer.fromJson(json['name']), + description: serializer.fromJson(json['description']), + created: serializer.fromJson(json['created']), + lastUpdate: serializer.fromJson(json['lastUpdate']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'uuid': serializer.toJson(uuid), + 'exerciseId': serializer.toJson(exerciseId), + 'languageId': serializer.toJson(languageId), + 'name': serializer.toJson(name), + 'description': serializer.toJson(description), + 'created': serializer.toJson(created), + 'lastUpdate': serializer.toJson(lastUpdate), + }; + } + + ExerciseTranslationRow copyWith({ + int? id, + String? uuid, + int? exerciseId, + int? languageId, + String? name, + String? description, + DateTime? created, + DateTime? lastUpdate, + }) => ExerciseTranslationRow( + id: id ?? this.id, + uuid: uuid ?? this.uuid, + exerciseId: exerciseId ?? this.exerciseId, + languageId: languageId ?? this.languageId, + name: name ?? this.name, + description: description ?? this.description, + created: created ?? this.created, + lastUpdate: lastUpdate ?? this.lastUpdate, + ); + ExerciseTranslationRow copyWithCompanion( + ExerciseTranslationTableCompanion data, + ) { + return ExerciseTranslationRow( + id: data.id.present ? data.id.value : this.id, + uuid: data.uuid.present ? data.uuid.value : this.uuid, + exerciseId: data.exerciseId.present ? data.exerciseId.value : this.exerciseId, + languageId: data.languageId.present ? data.languageId.value : this.languageId, + name: data.name.present ? data.name.value : this.name, + description: data.description.present ? data.description.value : this.description, + created: data.created.present ? data.created.value : this.created, + lastUpdate: data.lastUpdate.present ? data.lastUpdate.value : this.lastUpdate, + ); + } + + @override + String toString() { + return (StringBuffer('ExerciseTranslationRow(') + ..write('id: $id, ') + ..write('uuid: $uuid, ') + ..write('exerciseId: $exerciseId, ') + ..write('languageId: $languageId, ') + ..write('name: $name, ') + ..write('description: $description, ') + ..write('created: $created, ') + ..write('lastUpdate: $lastUpdate') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + uuid, + exerciseId, + languageId, + name, + description, + created, + lastUpdate, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ExerciseTranslationRow && + other.id == this.id && + other.uuid == this.uuid && + other.exerciseId == this.exerciseId && + other.languageId == this.languageId && + other.name == this.name && + other.description == this.description && + other.created == this.created && + other.lastUpdate == this.lastUpdate); +} + +class ExerciseTranslationTableCompanion extends UpdateCompanion { final Value id; final Value uuid; final Value exerciseId; @@ -1087,7 +1368,7 @@ class ExerciseTranslationTableCompanion extends UpdateCompanion { description = Value(description), created = Value(created), lastUpdate = Value(lastUpdate); - static Insertable custom({ + static Insertable custom({ Expression? id, Expression? uuid, Expression? exerciseId, @@ -1185,6 +1466,432 @@ class ExerciseTranslationTableCompanion extends UpdateCompanion { } } +class $ExerciseAliasTableTable extends ExerciseAliasTable + with TableInfo<$ExerciseAliasTableTable, Alias> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $ExerciseAliasTableTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + static const VerificationMeta _uuidMeta = const VerificationMeta('uuid'); + @override + late final GeneratedColumn uuid = GeneratedColumn( + 'uuid', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _translationIdMeta = const VerificationMeta( + 'translationId', + ); + @override + late final GeneratedColumn translationId = GeneratedColumn( + 'translation_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES exercises_translation (id)', + ), + ); + static const VerificationMeta _aliasMeta = const VerificationMeta('alias'); + @override + late final GeneratedColumn alias = GeneratedColumn( + 'alias', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + @override + List get $columns => [id, uuid, translationId, alias]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'exercises_alias'; + @override + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { + final context = 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('uuid')) { + context.handle( + _uuidMeta, + uuid.isAcceptableOrUnknown(data['uuid']!, _uuidMeta), + ); + } else if (isInserting) { + context.missing(_uuidMeta); + } + if (data.containsKey('translation_id')) { + context.handle( + _translationIdMeta, + translationId.isAcceptableOrUnknown( + data['translation_id']!, + _translationIdMeta, + ), + ); + } else if (isInserting) { + context.missing(_translationIdMeta); + } + if (data.containsKey('alias')) { + context.handle( + _aliasMeta, + alias.isAcceptableOrUnknown(data['alias']!, _aliasMeta), + ); + } else if (isInserting) { + context.missing(_aliasMeta); + } + return context; + } + + @override + Set get $primaryKey => const {}; + @override + Alias map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return Alias( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + translationId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}translation_id'], + )!, + alias: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}alias'], + )!, + ); + } + + @override + $ExerciseAliasTableTable createAlias(String alias) { + return $ExerciseAliasTableTable(attachedDatabase, alias); + } +} + +class ExerciseAliasTableCompanion extends UpdateCompanion { + final Value id; + final Value uuid; + final Value translationId; + final Value alias; + final Value rowid; + const ExerciseAliasTableCompanion({ + this.id = const Value.absent(), + this.uuid = const Value.absent(), + this.translationId = const Value.absent(), + this.alias = const Value.absent(), + this.rowid = const Value.absent(), + }); + ExerciseAliasTableCompanion.insert({ + required int id, + required String uuid, + required int translationId, + required String alias, + this.rowid = const Value.absent(), + }) : id = Value(id), + uuid = Value(uuid), + translationId = Value(translationId), + alias = Value(alias); + static Insertable custom({ + Expression? id, + Expression? uuid, + Expression? translationId, + Expression? alias, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (uuid != null) 'uuid': uuid, + if (translationId != null) 'translation_id': translationId, + if (alias != null) 'alias': alias, + if (rowid != null) 'rowid': rowid, + }); + } + + ExerciseAliasTableCompanion copyWith({ + Value? id, + Value? uuid, + Value? translationId, + Value? alias, + Value? rowid, + }) { + return ExerciseAliasTableCompanion( + id: id ?? this.id, + uuid: uuid ?? this.uuid, + translationId: translationId ?? this.translationId, + alias: alias ?? this.alias, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (uuid.present) { + map['uuid'] = Variable(uuid.value); + } + if (translationId.present) { + map['translation_id'] = Variable(translationId.value); + } + if (alias.present) { + map['alias'] = Variable(alias.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ExerciseAliasTableCompanion(') + ..write('id: $id, ') + ..write('uuid: $uuid, ') + ..write('translationId: $translationId, ') + ..write('alias: $alias, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + +class $ExerciseCommentTableTable extends ExerciseCommentTable + with TableInfo<$ExerciseCommentTableTable, Comment> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $ExerciseCommentTableTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + static const VerificationMeta _uuidMeta = const VerificationMeta('uuid'); + @override + late final GeneratedColumn uuid = GeneratedColumn( + 'uuid', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _translationIdMeta = const VerificationMeta( + 'translationId', + ); + @override + late final GeneratedColumn translationId = GeneratedColumn( + 'translation_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES exercises_translation (id)', + ), + ); + static const VerificationMeta _commentMeta = const VerificationMeta( + 'comment', + ); + @override + late final GeneratedColumn comment = GeneratedColumn( + 'comment', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + @override + List get $columns => [id, uuid, translationId, comment]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'exercises_exercisecomment'; + @override + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { + final context = 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('uuid')) { + context.handle( + _uuidMeta, + uuid.isAcceptableOrUnknown(data['uuid']!, _uuidMeta), + ); + } else if (isInserting) { + context.missing(_uuidMeta); + } + if (data.containsKey('translation_id')) { + context.handle( + _translationIdMeta, + translationId.isAcceptableOrUnknown( + data['translation_id']!, + _translationIdMeta, + ), + ); + } else if (isInserting) { + context.missing(_translationIdMeta); + } + if (data.containsKey('comment')) { + context.handle( + _commentMeta, + comment.isAcceptableOrUnknown(data['comment']!, _commentMeta), + ); + } else if (isInserting) { + context.missing(_commentMeta); + } + return context; + } + + @override + Set get $primaryKey => const {}; + @override + Comment map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return Comment( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + translationId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}translation_id'], + )!, + comment: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}comment'], + )!, + ); + } + + @override + $ExerciseCommentTableTable createAlias(String alias) { + return $ExerciseCommentTableTable(attachedDatabase, alias); + } +} + +class ExerciseCommentTableCompanion extends UpdateCompanion { + final Value id; + final Value uuid; + final Value translationId; + final Value comment; + final Value rowid; + const ExerciseCommentTableCompanion({ + this.id = const Value.absent(), + this.uuid = const Value.absent(), + this.translationId = const Value.absent(), + this.comment = const Value.absent(), + this.rowid = const Value.absent(), + }); + ExerciseCommentTableCompanion.insert({ + required int id, + required String uuid, + required int translationId, + required String comment, + this.rowid = const Value.absent(), + }) : id = Value(id), + uuid = Value(uuid), + translationId = Value(translationId), + comment = Value(comment); + static Insertable custom({ + Expression? id, + Expression? uuid, + Expression? translationId, + Expression? comment, + Expression? rowid, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (uuid != null) 'uuid': uuid, + if (translationId != null) 'translation_id': translationId, + if (comment != null) 'comment': comment, + if (rowid != null) 'rowid': rowid, + }); + } + + ExerciseCommentTableCompanion copyWith({ + Value? id, + Value? uuid, + Value? translationId, + Value? comment, + Value? rowid, + }) { + return ExerciseCommentTableCompanion( + id: id ?? this.id, + uuid: uuid ?? this.uuid, + translationId: translationId ?? this.translationId, + comment: comment ?? this.comment, + rowid: rowid ?? this.rowid, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (uuid.present) { + map['uuid'] = Variable(uuid.value); + } + if (translationId.present) { + map['translation_id'] = Variable(translationId.value); + } + if (comment.present) { + map['comment'] = Variable(comment.value); + } + if (rowid.present) { + map['rowid'] = Variable(rowid.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ExerciseCommentTableCompanion(') + ..write('id: $id, ') + ..write('uuid: $uuid, ') + ..write('translationId: $translationId, ') + ..write('comment: $comment, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} + class $MuscleTableTable extends MuscleTable with TableInfo<$MuscleTableTable, Muscle> { @override final GeneratedDatabase attachedDatabase; @@ -2418,8 +3125,155 @@ class $ExerciseImageTableTable extends ExerciseImageTable 'CHECK ("is_main" IN (0, 1))', ), ); + static const VerificationMeta _isAiGeneratedMeta = const VerificationMeta( + 'isAiGenerated', + ); @override - List get $columns => [id, uuid, exerciseId, image, isMain]; + late final GeneratedColumn isAiGenerated = GeneratedColumn( + 'is_ai_generated', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_ai_generated" IN (0, 1))', + ), + ); + @override + late final GeneratedColumnWithTypeConverter style = + GeneratedColumn( + 'style', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ).withConverter($ExerciseImageTableTable.$converterstyle); + static const VerificationMeta _widthMeta = const VerificationMeta('width'); + @override + late final GeneratedColumn width = GeneratedColumn( + 'width', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _heightMeta = const VerificationMeta('height'); + @override + late final GeneratedColumn height = GeneratedColumn( + 'height', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _createdMeta = const VerificationMeta( + 'created', + ); + @override + late final GeneratedColumn created = GeneratedColumn( + 'created', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _lastUpdateMeta = const VerificationMeta( + 'lastUpdate', + ); + @override + late final GeneratedColumn lastUpdate = GeneratedColumn( + 'last_update', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _licenseIdMeta = const VerificationMeta( + 'licenseId', + ); + @override + late final GeneratedColumn licenseId = GeneratedColumn( + 'license_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + static const VerificationMeta _licenseTitleMeta = const VerificationMeta( + 'licenseTitle', + ); + @override + late final GeneratedColumn licenseTitle = GeneratedColumn( + 'license_title', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _licenseObjectUrlMeta = const VerificationMeta( + 'licenseObjectUrl', + ); + @override + late final GeneratedColumn licenseObjectUrl = GeneratedColumn( + 'license_object_url', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _licenseAuthorMeta = const VerificationMeta( + 'licenseAuthor', + ); + @override + late final GeneratedColumn licenseAuthor = GeneratedColumn( + 'license_author', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _licenseAuthorUrlMeta = const VerificationMeta( + 'licenseAuthorUrl', + ); + @override + late final GeneratedColumn licenseAuthorUrl = GeneratedColumn( + 'license_author_url', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _licenseDerivativeSourceUrlMeta = const VerificationMeta( + 'licenseDerivativeSourceUrl', + ); + @override + late final GeneratedColumn licenseDerivativeSourceUrl = GeneratedColumn( + 'license_derivative_source_url', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + @override + List get $columns => [ + id, + uuid, + exerciseId, + image, + isMain, + isAiGenerated, + style, + width, + height, + created, + lastUpdate, + licenseId, + licenseTitle, + licenseObjectUrl, + licenseAuthor, + licenseAuthorUrl, + licenseDerivativeSourceUrl, + ]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -2469,6 +3323,106 @@ class $ExerciseImageTableTable extends ExerciseImageTable } else if (isInserting) { context.missing(_isMainMeta); } + if (data.containsKey('is_ai_generated')) { + context.handle( + _isAiGeneratedMeta, + isAiGenerated.isAcceptableOrUnknown( + data['is_ai_generated']!, + _isAiGeneratedMeta, + ), + ); + } else if (isInserting) { + context.missing(_isAiGeneratedMeta); + } + if (data.containsKey('width')) { + context.handle( + _widthMeta, + width.isAcceptableOrUnknown(data['width']!, _widthMeta), + ); + } + if (data.containsKey('height')) { + context.handle( + _heightMeta, + height.isAcceptableOrUnknown(data['height']!, _heightMeta), + ); + } + if (data.containsKey('created')) { + context.handle( + _createdMeta, + created.isAcceptableOrUnknown(data['created']!, _createdMeta), + ); + } else if (isInserting) { + context.missing(_createdMeta); + } + if (data.containsKey('last_update')) { + context.handle( + _lastUpdateMeta, + lastUpdate.isAcceptableOrUnknown(data['last_update']!, _lastUpdateMeta), + ); + } else if (isInserting) { + context.missing(_lastUpdateMeta); + } + if (data.containsKey('license_id')) { + context.handle( + _licenseIdMeta, + licenseId.isAcceptableOrUnknown(data['license_id']!, _licenseIdMeta), + ); + } else if (isInserting) { + context.missing(_licenseIdMeta); + } + if (data.containsKey('license_title')) { + context.handle( + _licenseTitleMeta, + licenseTitle.isAcceptableOrUnknown( + data['license_title']!, + _licenseTitleMeta, + ), + ); + } else if (isInserting) { + context.missing(_licenseTitleMeta); + } + if (data.containsKey('license_object_url')) { + context.handle( + _licenseObjectUrlMeta, + licenseObjectUrl.isAcceptableOrUnknown( + data['license_object_url']!, + _licenseObjectUrlMeta, + ), + ); + } else if (isInserting) { + context.missing(_licenseObjectUrlMeta); + } + if (data.containsKey('license_author')) { + context.handle( + _licenseAuthorMeta, + licenseAuthor.isAcceptableOrUnknown( + data['license_author']!, + _licenseAuthorMeta, + ), + ); + } + if (data.containsKey('license_author_url')) { + context.handle( + _licenseAuthorUrlMeta, + licenseAuthorUrl.isAcceptableOrUnknown( + data['license_author_url']!, + _licenseAuthorUrlMeta, + ), + ); + } else if (isInserting) { + context.missing(_licenseAuthorUrlMeta); + } + if (data.containsKey('license_derivative_source_url')) { + context.handle( + _licenseDerivativeSourceUrlMeta, + licenseDerivativeSourceUrl.isAcceptableOrUnknown( + data['license_derivative_source_url']!, + _licenseDerivativeSourceUrlMeta, + ), + ); + } else if (isInserting) { + context.missing(_licenseDerivativeSourceUrlMeta); + } return context; } @@ -2498,6 +3452,56 @@ class $ExerciseImageTableTable extends ExerciseImageTable DriftSqlType.bool, data['${effectivePrefix}is_main'], )!, + isAiGenerated: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_ai_generated'], + )!, + style: $ExerciseImageTableTable.$converterstyle.fromSql( + attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}style'], + )!, + ), + width: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}width'], + ), + height: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}height'], + ), + created: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created'], + )!, + lastUpdate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_update'], + )!, + licenseId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}license_id'], + )!, + licenseTitle: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_title'], + )!, + licenseObjectUrl: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_object_url'], + )!, + licenseAuthor: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_author'], + ), + licenseAuthorUrl: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_author_url'], + )!, + licenseDerivativeSourceUrl: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_derivative_source_url'], + )!, ); } @@ -2505,6 +3509,9 @@ class $ExerciseImageTableTable extends ExerciseImageTable $ExerciseImageTableTable createAlias(String alias) { return $ExerciseImageTableTable(attachedDatabase, alias); } + + static TypeConverter $converterstyle = + const ExerciseImageStyleConverter(); } class ExerciseImageTableCompanion extends UpdateCompanion { @@ -2513,6 +3520,18 @@ class ExerciseImageTableCompanion extends UpdateCompanion { final Value exerciseId; final Value image; final Value isMain; + final Value isAiGenerated; + final Value style; + final Value width; + final Value height; + final Value created; + final Value lastUpdate; + final Value licenseId; + final Value licenseTitle; + final Value licenseObjectUrl; + final Value licenseAuthor; + final Value licenseAuthorUrl; + final Value licenseDerivativeSourceUrl; final Value rowid; const ExerciseImageTableCompanion({ this.id = const Value.absent(), @@ -2520,6 +3539,18 @@ class ExerciseImageTableCompanion extends UpdateCompanion { this.exerciseId = const Value.absent(), this.image = const Value.absent(), this.isMain = const Value.absent(), + this.isAiGenerated = const Value.absent(), + this.style = const Value.absent(), + this.width = const Value.absent(), + this.height = const Value.absent(), + this.created = const Value.absent(), + this.lastUpdate = const Value.absent(), + this.licenseId = const Value.absent(), + this.licenseTitle = const Value.absent(), + this.licenseObjectUrl = const Value.absent(), + this.licenseAuthor = const Value.absent(), + this.licenseAuthorUrl = const Value.absent(), + this.licenseDerivativeSourceUrl = const Value.absent(), this.rowid = const Value.absent(), }); ExerciseImageTableCompanion.insert({ @@ -2528,18 +3559,51 @@ class ExerciseImageTableCompanion extends UpdateCompanion { required int exerciseId, required String image, required bool isMain, + required bool isAiGenerated, + required ExerciseImageStyle style, + this.width = const Value.absent(), + this.height = const Value.absent(), + required DateTime created, + required DateTime lastUpdate, + required int licenseId, + required String licenseTitle, + required String licenseObjectUrl, + this.licenseAuthor = const Value.absent(), + required String licenseAuthorUrl, + required String licenseDerivativeSourceUrl, this.rowid = const Value.absent(), }) : id = Value(id), uuid = Value(uuid), exerciseId = Value(exerciseId), image = Value(image), - isMain = Value(isMain); + isMain = Value(isMain), + isAiGenerated = Value(isAiGenerated), + style = Value(style), + created = Value(created), + lastUpdate = Value(lastUpdate), + licenseId = Value(licenseId), + licenseTitle = Value(licenseTitle), + licenseObjectUrl = Value(licenseObjectUrl), + licenseAuthorUrl = Value(licenseAuthorUrl), + licenseDerivativeSourceUrl = Value(licenseDerivativeSourceUrl); static Insertable custom({ Expression? id, Expression? uuid, Expression? exerciseId, Expression? image, Expression? isMain, + Expression? isAiGenerated, + Expression? style, + Expression? width, + Expression? height, + Expression? created, + Expression? lastUpdate, + Expression? licenseId, + Expression? licenseTitle, + Expression? licenseObjectUrl, + Expression? licenseAuthor, + Expression? licenseAuthorUrl, + Expression? licenseDerivativeSourceUrl, Expression? rowid, }) { return RawValuesInsertable({ @@ -2548,6 +3612,19 @@ class ExerciseImageTableCompanion extends UpdateCompanion { if (exerciseId != null) 'exercise_id': exerciseId, if (image != null) 'image': image, if (isMain != null) 'is_main': isMain, + if (isAiGenerated != null) 'is_ai_generated': isAiGenerated, + if (style != null) 'style': style, + if (width != null) 'width': width, + if (height != null) 'height': height, + if (created != null) 'created': created, + if (lastUpdate != null) 'last_update': lastUpdate, + if (licenseId != null) 'license_id': licenseId, + if (licenseTitle != null) 'license_title': licenseTitle, + if (licenseObjectUrl != null) 'license_object_url': licenseObjectUrl, + if (licenseAuthor != null) 'license_author': licenseAuthor, + if (licenseAuthorUrl != null) 'license_author_url': licenseAuthorUrl, + if (licenseDerivativeSourceUrl != null) + 'license_derivative_source_url': licenseDerivativeSourceUrl, if (rowid != null) 'rowid': rowid, }); } @@ -2558,6 +3635,18 @@ class ExerciseImageTableCompanion extends UpdateCompanion { Value? exerciseId, Value? image, Value? isMain, + Value? isAiGenerated, + Value? style, + Value? width, + Value? height, + Value? created, + Value? lastUpdate, + Value? licenseId, + Value? licenseTitle, + Value? licenseObjectUrl, + Value? licenseAuthor, + Value? licenseAuthorUrl, + Value? licenseDerivativeSourceUrl, Value? rowid, }) { return ExerciseImageTableCompanion( @@ -2566,6 +3655,18 @@ class ExerciseImageTableCompanion extends UpdateCompanion { exerciseId: exerciseId ?? this.exerciseId, image: image ?? this.image, isMain: isMain ?? this.isMain, + isAiGenerated: isAiGenerated ?? this.isAiGenerated, + style: style ?? this.style, + width: width ?? this.width, + height: height ?? this.height, + created: created ?? this.created, + lastUpdate: lastUpdate ?? this.lastUpdate, + licenseId: licenseId ?? this.licenseId, + licenseTitle: licenseTitle ?? this.licenseTitle, + licenseObjectUrl: licenseObjectUrl ?? this.licenseObjectUrl, + licenseAuthor: licenseAuthor ?? this.licenseAuthor, + licenseAuthorUrl: licenseAuthorUrl ?? this.licenseAuthorUrl, + licenseDerivativeSourceUrl: licenseDerivativeSourceUrl ?? this.licenseDerivativeSourceUrl, rowid: rowid ?? this.rowid, ); } @@ -2588,6 +3689,46 @@ class ExerciseImageTableCompanion extends UpdateCompanion { if (isMain.present) { map['is_main'] = Variable(isMain.value); } + if (isAiGenerated.present) { + map['is_ai_generated'] = Variable(isAiGenerated.value); + } + if (style.present) { + map['style'] = Variable( + $ExerciseImageTableTable.$converterstyle.toSql(style.value), + ); + } + if (width.present) { + map['width'] = Variable(width.value); + } + if (height.present) { + map['height'] = Variable(height.value); + } + if (created.present) { + map['created'] = Variable(created.value); + } + if (lastUpdate.present) { + map['last_update'] = Variable(lastUpdate.value); + } + if (licenseId.present) { + map['license_id'] = Variable(licenseId.value); + } + if (licenseTitle.present) { + map['license_title'] = Variable(licenseTitle.value); + } + if (licenseObjectUrl.present) { + map['license_object_url'] = Variable(licenseObjectUrl.value); + } + if (licenseAuthor.present) { + map['license_author'] = Variable(licenseAuthor.value); + } + if (licenseAuthorUrl.present) { + map['license_author_url'] = Variable(licenseAuthorUrl.value); + } + if (licenseDerivativeSourceUrl.present) { + map['license_derivative_source_url'] = Variable( + licenseDerivativeSourceUrl.value, + ); + } if (rowid.present) { map['rowid'] = Variable(rowid.value); } @@ -2602,6 +3743,18 @@ class ExerciseImageTableCompanion extends UpdateCompanion { ..write('exerciseId: $exerciseId, ') ..write('image: $image, ') ..write('isMain: $isMain, ') + ..write('isAiGenerated: $isAiGenerated, ') + ..write('style: $style, ') + ..write('width: $width, ') + ..write('height: $height, ') + ..write('created: $created, ') + ..write('lastUpdate: $lastUpdate, ') + ..write('licenseId: $licenseId, ') + ..write('licenseTitle: $licenseTitle, ') + ..write('licenseObjectUrl: $licenseObjectUrl, ') + ..write('licenseAuthor: $licenseAuthor, ') + ..write('licenseAuthorUrl: $licenseAuthorUrl, ') + ..write('licenseDerivativeSourceUrl: $licenseDerivativeSourceUrl, ') ..write('rowid: $rowid') ..write(')')) .toString(); @@ -2646,6 +3799,18 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable 'REFERENCES exercises_exercise (id)', ), ); + static const VerificationMeta _isMainMeta = const VerificationMeta('isMain'); + @override + late final GeneratedColumn isMain = GeneratedColumn( + 'is_main', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_main" IN (0, 1))', + ), + ); static const VerificationMeta _urlMeta = const VerificationMeta('url'); @override late final GeneratedColumn url = GeneratedColumn( @@ -2713,6 +3878,28 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable type: DriftSqlType.string, requiredDuringInsert: true, ); + static const VerificationMeta _createdMeta = const VerificationMeta( + 'created', + ); + @override + late final GeneratedColumn created = GeneratedColumn( + 'created', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _lastUpdateMeta = const VerificationMeta( + 'lastUpdate', + ); + @override + late final GeneratedColumn lastUpdate = GeneratedColumn( + 'last_update', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); static const VerificationMeta _licenseIdMeta = const VerificationMeta( 'licenseId', ); @@ -2724,6 +3911,28 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable type: DriftSqlType.int, requiredDuringInsert: true, ); + static const VerificationMeta _licenseTitleMeta = const VerificationMeta( + 'licenseTitle', + ); + @override + late final GeneratedColumn licenseTitle = GeneratedColumn( + 'license_title', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _licenseObjectUrlMeta = const VerificationMeta( + 'licenseObjectUrl', + ); + @override + late final GeneratedColumn licenseObjectUrl = GeneratedColumn( + 'license_object_url', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); static const VerificationMeta _licenseAuthorMeta = const VerificationMeta( 'licenseAuthor', ); @@ -2731,6 +3940,28 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable late final GeneratedColumn licenseAuthor = GeneratedColumn( 'license_author', aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _licenseAuthorUrlMeta = const VerificationMeta( + 'licenseAuthorUrl', + ); + @override + late final GeneratedColumn licenseAuthorUrl = GeneratedColumn( + 'license_author_url', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _licenseDerivativeSourceUrlMeta = const VerificationMeta( + 'licenseDerivativeSourceUrl', + ); + @override + late final GeneratedColumn licenseDerivativeSourceUrl = GeneratedColumn( + 'license_derivative_source_url', + aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, @@ -2740,6 +3971,7 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable id, uuid, exerciseId, + isMain, url, size, duration, @@ -2747,8 +3979,14 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable height, codec, codecLong, + created, + lastUpdate, licenseId, + licenseTitle, + licenseObjectUrl, licenseAuthor, + licenseAuthorUrl, + licenseDerivativeSourceUrl, ]; @override String get aliasedName => _alias ?? actualTableName; @@ -2783,6 +4021,14 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable } else if (isInserting) { context.missing(_exerciseIdMeta); } + if (data.containsKey('is_main')) { + context.handle( + _isMainMeta, + isMain.isAcceptableOrUnknown(data['is_main']!, _isMainMeta), + ); + } else if (isInserting) { + context.missing(_isMainMeta); + } if (data.containsKey('url')) { context.handle( _urlMeta, @@ -2839,6 +4085,22 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable } else if (isInserting) { context.missing(_codecLongMeta); } + if (data.containsKey('created')) { + context.handle( + _createdMeta, + created.isAcceptableOrUnknown(data['created']!, _createdMeta), + ); + } else if (isInserting) { + context.missing(_createdMeta); + } + if (data.containsKey('last_update')) { + context.handle( + _lastUpdateMeta, + lastUpdate.isAcceptableOrUnknown(data['last_update']!, _lastUpdateMeta), + ); + } else if (isInserting) { + context.missing(_lastUpdateMeta); + } if (data.containsKey('license_id')) { context.handle( _licenseIdMeta, @@ -2847,6 +4109,28 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable } else if (isInserting) { context.missing(_licenseIdMeta); } + if (data.containsKey('license_title')) { + context.handle( + _licenseTitleMeta, + licenseTitle.isAcceptableOrUnknown( + data['license_title']!, + _licenseTitleMeta, + ), + ); + } else if (isInserting) { + context.missing(_licenseTitleMeta); + } + if (data.containsKey('license_object_url')) { + context.handle( + _licenseObjectUrlMeta, + licenseObjectUrl.isAcceptableOrUnknown( + data['license_object_url']!, + _licenseObjectUrlMeta, + ), + ); + } else if (isInserting) { + context.missing(_licenseObjectUrlMeta); + } if (data.containsKey('license_author')) { context.handle( _licenseAuthorMeta, @@ -2855,8 +4139,28 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable _licenseAuthorMeta, ), ); + } + if (data.containsKey('license_author_url')) { + context.handle( + _licenseAuthorUrlMeta, + licenseAuthorUrl.isAcceptableOrUnknown( + data['license_author_url']!, + _licenseAuthorUrlMeta, + ), + ); } else if (isInserting) { - context.missing(_licenseAuthorMeta); + context.missing(_licenseAuthorUrlMeta); + } + if (data.containsKey('license_derivative_source_url')) { + context.handle( + _licenseDerivativeSourceUrlMeta, + licenseDerivativeSourceUrl.isAcceptableOrUnknown( + data['license_derivative_source_url']!, + _licenseDerivativeSourceUrlMeta, + ), + ); + } else if (isInserting) { + context.missing(_licenseDerivativeSourceUrlMeta); } return context; } @@ -2879,14 +4183,18 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable DriftSqlType.int, data['${effectivePrefix}exercise_id'], )!, - size: attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}size'], + isMain: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_main'], )!, url: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}url'], )!, + size: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}size'], + )!, duration: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}duration'], @@ -2907,13 +4215,37 @@ class $ExerciseVideoTableTable extends ExerciseVideoTable DriftSqlType.string, data['${effectivePrefix}codec_long'], )!, + created: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created'], + )!, + lastUpdate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}last_update'], + )!, licenseId: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}license_id'], )!, + licenseTitle: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_title'], + )!, + licenseObjectUrl: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_object_url'], + )!, licenseAuthor: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}license_author'], + ), + licenseAuthorUrl: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_author_url'], + )!, + licenseDerivativeSourceUrl: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}license_derivative_source_url'], )!, ); } @@ -2928,6 +4260,7 @@ class ExerciseVideoTableCompanion extends UpdateCompanion