diff --git a/lib/Entities/drift_database.dart b/lib/Entities/drift_database.dart index 7d68192..bb64b08 100644 --- a/lib/Entities/drift_database.dart +++ b/lib/Entities/drift_database.dart @@ -28,6 +28,9 @@ class Transactions extends Table { /// Betrag der Transaktion RealColumn get amount => real().withDefault(const Constant(0))(); + /// Ob diese Transaktion bereits geprüft wurde + BoolColumn get checked => boolean().withDefault(const Constant(true))(); + /// Fremdschlüssel zum zugehörigen Konto IntColumn get accountId => integer().references(Accounts, #id)(); diff --git a/lib/Entities/drift_database.g.dart b/lib/Entities/drift_database.g.dart index 20a90b3..219712b 100644 --- a/lib/Entities/drift_database.g.dart +++ b/lib/Entities/drift_database.g.dart @@ -655,6 +655,21 @@ class $TransactionsTable extends Transactions requiredDuringInsert: false, defaultValue: const Constant(0), ); + static const VerificationMeta _checkedMeta = const VerificationMeta( + 'checked', + ); + @override + late final GeneratedColumn checked = GeneratedColumn( + 'checked', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("checked" IN (0, 1))', + ), + defaultValue: const Constant(true), + ); static const VerificationMeta _accountIdMeta = const VerificationMeta( 'accountId', ); @@ -688,6 +703,7 @@ class $TransactionsTable extends Transactions name, date, amount, + checked, accountId, recurringTransactionId, ]; @@ -724,6 +740,12 @@ class $TransactionsTable extends Transactions amount.isAcceptableOrUnknown(data['amount']!, _amountMeta), ); } + if (data.containsKey('checked')) { + context.handle( + _checkedMeta, + checked.isAcceptableOrUnknown(data['checked']!, _checkedMeta), + ); + } if (data.containsKey('account_id')) { context.handle( _accountIdMeta, @@ -766,6 +788,10 @@ class $TransactionsTable extends Transactions DriftSqlType.double, data['${effectivePrefix}amount'], )!, + checked: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}checked'], + )!, accountId: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}account_id'], @@ -796,6 +822,9 @@ class Transaction extends DataClass implements Insertable { /// Betrag der Transaktion final double amount; + /// Ob diese Transaktion bereits geprüft wurde + final bool checked; + /// Fremdschlüssel zum zugehörigen Konto final int accountId; @@ -807,6 +836,7 @@ class Transaction extends DataClass implements Insertable { required this.name, this.date, required this.amount, + required this.checked, required this.accountId, this.recurringTransactionId, }); @@ -819,6 +849,7 @@ class Transaction extends DataClass implements Insertable { map['date'] = Variable(date); } map['amount'] = Variable(amount); + map['checked'] = Variable(checked); map['account_id'] = Variable(accountId); if (!nullToAbsent || recurringTransactionId != null) { map['recurring_transaction_id'] = Variable(recurringTransactionId); @@ -832,6 +863,7 @@ class Transaction extends DataClass implements Insertable { name: Value(name), date: date == null && nullToAbsent ? const Value.absent() : Value(date), amount: Value(amount), + checked: Value(checked), accountId: Value(accountId), recurringTransactionId: recurringTransactionId == null && nullToAbsent ? const Value.absent() @@ -849,6 +881,7 @@ class Transaction extends DataClass implements Insertable { name: serializer.fromJson(json['name']), date: serializer.fromJson(json['date']), amount: serializer.fromJson(json['amount']), + checked: serializer.fromJson(json['checked']), accountId: serializer.fromJson(json['accountId']), recurringTransactionId: serializer.fromJson( json['recurringTransactionId'], @@ -863,6 +896,7 @@ class Transaction extends DataClass implements Insertable { 'name': serializer.toJson(name), 'date': serializer.toJson(date), 'amount': serializer.toJson(amount), + 'checked': serializer.toJson(checked), 'accountId': serializer.toJson(accountId), 'recurringTransactionId': serializer.toJson(recurringTransactionId), }; @@ -873,6 +907,7 @@ class Transaction extends DataClass implements Insertable { String? name, Value date = const Value.absent(), double? amount, + bool? checked, int? accountId, Value recurringTransactionId = const Value.absent(), }) => Transaction( @@ -880,6 +915,7 @@ class Transaction extends DataClass implements Insertable { name: name ?? this.name, date: date.present ? date.value : this.date, amount: amount ?? this.amount, + checked: checked ?? this.checked, accountId: accountId ?? this.accountId, recurringTransactionId: recurringTransactionId.present ? recurringTransactionId.value @@ -891,6 +927,7 @@ class Transaction extends DataClass implements Insertable { name: data.name.present ? data.name.value : this.name, date: data.date.present ? data.date.value : this.date, amount: data.amount.present ? data.amount.value : this.amount, + checked: data.checked.present ? data.checked.value : this.checked, accountId: data.accountId.present ? data.accountId.value : this.accountId, recurringTransactionId: data.recurringTransactionId.present ? data.recurringTransactionId.value @@ -904,7 +941,7 @@ class Transaction extends DataClass implements Insertable { ..write('id: $id, ') ..write('name: $name, ') ..write('date: $date, ') - ..write('amount: $amount, ') + ..write('amount: $amount, ')..write('checked: $checked, ') ..write('accountId: $accountId, ') ..write('recurringTransactionId: $recurringTransactionId') ..write(')')) @@ -912,8 +949,15 @@ class Transaction extends DataClass implements Insertable { } @override - int get hashCode => - Object.hash(id, name, date, amount, accountId, recurringTransactionId); + int get hashCode => Object.hash( + id, + name, + date, + amount, + checked, + accountId, + recurringTransactionId, + ); @override bool operator ==(Object other) => identical(this, other) || @@ -922,6 +966,7 @@ class Transaction extends DataClass implements Insertable { other.name == this.name && other.date == this.date && other.amount == this.amount && + other.checked == this.checked && other.accountId == this.accountId && other.recurringTransactionId == this.recurringTransactionId); } @@ -931,6 +976,7 @@ class TransactionsCompanion extends UpdateCompanion { final Value name; final Value date; final Value amount; + final Value checked; final Value accountId; final Value recurringTransactionId; const TransactionsCompanion({ @@ -938,6 +984,7 @@ class TransactionsCompanion extends UpdateCompanion { this.name = const Value.absent(), this.date = const Value.absent(), this.amount = const Value.absent(), + this.checked = const Value.absent(), this.accountId = const Value.absent(), this.recurringTransactionId = const Value.absent(), }); @@ -946,6 +993,7 @@ class TransactionsCompanion extends UpdateCompanion { this.name = const Value.absent(), this.date = const Value.absent(), this.amount = const Value.absent(), + this.checked = const Value.absent(), required int accountId, this.recurringTransactionId = const Value.absent(), }) : accountId = Value(accountId); @@ -954,6 +1002,7 @@ class TransactionsCompanion extends UpdateCompanion { Expression? name, Expression? date, Expression? amount, + Expression? checked, Expression? accountId, Expression? recurringTransactionId, }) { @@ -962,6 +1011,7 @@ class TransactionsCompanion extends UpdateCompanion { if (name != null) 'name': name, if (date != null) 'date': date, if (amount != null) 'amount': amount, + if (checked != null) 'checked': checked, if (accountId != null) 'account_id': accountId, if (recurringTransactionId != null) 'recurring_transaction_id': recurringTransactionId, @@ -973,6 +1023,7 @@ class TransactionsCompanion extends UpdateCompanion { Value? name, Value? date, Value? amount, + Value? checked, Value? accountId, Value? recurringTransactionId, }) { @@ -981,6 +1032,7 @@ class TransactionsCompanion extends UpdateCompanion { name: name ?? this.name, date: date ?? this.date, amount: amount ?? this.amount, + checked: checked ?? this.checked, accountId: accountId ?? this.accountId, recurringTransactionId: recurringTransactionId ?? this.recurringTransactionId, @@ -1002,6 +1054,9 @@ class TransactionsCompanion extends UpdateCompanion { if (amount.present) { map['amount'] = Variable(amount.value); } + if (checked.present) { + map['checked'] = Variable(checked.value); + } if (accountId.present) { map['account_id'] = Variable(accountId.value); } @@ -1019,7 +1074,7 @@ class TransactionsCompanion extends UpdateCompanion { ..write('id: $id, ') ..write('name: $name, ') ..write('date: $date, ') - ..write('amount: $amount, ') + ..write('amount: $amount, ')..write('checked: $checked, ') ..write('accountId: $accountId, ') ..write('recurringTransactionId: $recurringTransactionId') ..write(')')) @@ -1846,6 +1901,7 @@ typedef $$TransactionsTableCreateCompanionBuilder = Value name, Value date, Value amount, + Value checked, required int accountId, Value recurringTransactionId, }); @@ -1855,6 +1911,7 @@ typedef $$TransactionsTableUpdateCompanionBuilder = Value name, Value date, Value amount, + Value checked, Value accountId, Value recurringTransactionId, }); @@ -1938,6 +1995,11 @@ class $$TransactionsTableFilterComposer builder: (column) => ColumnFilters(column), ); + ColumnFilters get checked => $composableBuilder( + column: $table.checked, + builder: (column) => ColumnFilters(column), + ); + $$AccountsTableFilterComposer get accountId { final $$AccountsTableFilterComposer composer = $composerBuilder( composer: this, @@ -2015,6 +2077,11 @@ class $$TransactionsTableOrderingComposer builder: (column) => ColumnOrderings(column), ); + ColumnOrderings get checked => $composableBuilder( + column: $table.checked, + builder: (column) => ColumnOrderings(column), + ); + $$AccountsTableOrderingComposer get accountId { final $$AccountsTableOrderingComposer composer = $composerBuilder( composer: this, @@ -2084,6 +2151,9 @@ class $$TransactionsTableAnnotationComposer GeneratedColumn get amount => $composableBuilder(column: $table.amount, builder: (column) => column); + GeneratedColumn get checked => + $composableBuilder(column: $table.checked, builder: (column) => column); + $$AccountsTableAnnotationComposer get accountId { final $$AccountsTableAnnotationComposer composer = $composerBuilder( composer: this, @@ -2164,6 +2234,7 @@ class $$TransactionsTableTableManager Value name = const Value.absent(), Value date = const Value.absent(), Value amount = const Value.absent(), + Value checked = const Value.absent(), Value accountId = const Value.absent(), Value recurringTransactionId = const Value.absent(), }) => TransactionsCompanion( @@ -2171,6 +2242,7 @@ class $$TransactionsTableTableManager name: name, date: date, amount: amount, + checked: checked, accountId: accountId, recurringTransactionId: recurringTransactionId, ), @@ -2180,6 +2252,7 @@ class $$TransactionsTableTableManager Value name = const Value.absent(), Value date = const Value.absent(), Value amount = const Value.absent(), + Value checked = const Value.absent(), required int accountId, Value recurringTransactionId = const Value.absent(), }) => TransactionsCompanion.insert( @@ -2187,6 +2260,7 @@ class $$TransactionsTableTableManager name: name, date: date, amount: amount, + checked: checked, accountId: accountId, recurringTransactionId: recurringTransactionId, ),