Feat: Fügt eine Tabelle für Synchronisationsstatusmeldungen hinzu
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:drift_flutter/drift_flutter.dart';
|
import 'package:drift_flutter/drift_flutter.dart';
|
||||||
|
|
||||||
|
import 'sync_log_type_enum.dart';
|
||||||
import 'time_frame_enum.dart';
|
import 'time_frame_enum.dart';
|
||||||
|
|
||||||
part 'drift_database.g.dart';
|
part 'drift_database.g.dart';
|
||||||
@@ -13,7 +14,7 @@ class Accounts extends Table {
|
|||||||
/// Name des Kontos
|
/// Name des Kontos
|
||||||
TextColumn get name => text().withDefault(const Constant(''))();
|
TextColumn get name => text().withDefault(const Constant(''))();
|
||||||
|
|
||||||
/// Wann das Konto das letzte mal geupdated wurde.
|
/// Wann das Konto das letzte mal geupdated wurde
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ class Transactions extends Table {
|
|||||||
IntColumn get recurringTransactionId =>
|
IntColumn get recurringTransactionId =>
|
||||||
integer().nullable().references(RecurringTransactions, #id)();
|
integer().nullable().references(RecurringTransactions, #id)();
|
||||||
|
|
||||||
/// Wann die Transaktion das letzte mal geupdated wurde.
|
/// Wann die Transaktion das letzte mal geupdated wurde
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +67,22 @@ class RecurringTransactions extends Table {
|
|||||||
/// Fremdschlüssel zum zugehörigen Konto
|
/// Fremdschlüssel zum zugehörigen Konto
|
||||||
IntColumn get accountId => integer().references(Accounts, #id)();
|
IntColumn get accountId => integer().references(Accounts, #id)();
|
||||||
|
|
||||||
/// Wann die wiederkehrende Transaktion das letzte mal geupdated wurde.
|
/// Wann die wiederkehrende Transaktion das letzte mal geupdated wurde
|
||||||
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Eine Tabelle um den Status der Synchronisation zu loggen
|
||||||
|
class SyncLog extends Table {
|
||||||
|
/// Eindeutige ID des SyncLogs
|
||||||
|
IntColumn get id => integer().autoIncrement()();
|
||||||
|
|
||||||
|
/// Der Typ des SyncLogs
|
||||||
|
IntColumn get type => intEnum<SyncLogTypeEnum>()();
|
||||||
|
|
||||||
|
/// Die Beschreibung der Eintragung des SyncLogs
|
||||||
|
TextColumn get description => text().withDefault(const Constant(''))();
|
||||||
|
|
||||||
|
/// Wann dieser SyncLog das letzte mal geupdated wurde
|
||||||
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class $AccountsTable extends Accounts with TableInfo<$AccountsTable, Account> {
|
|||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultValue: currentDateAndTime,
|
defaultValue: currentDateAndTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, name, updatedAt];
|
List<GeneratedColumn> get $columns => [id, name, updatedAt];
|
||||||
@override
|
@override
|
||||||
@@ -110,9 +109,8 @@ class Account extends DataClass implements Insertable<Account> {
|
|||||||
/// Name des Kontos
|
/// Name des Kontos
|
||||||
final String name;
|
final String name;
|
||||||
|
|
||||||
/// Wann das Konto das letzte mal geupdated wurde.
|
/// Wann das Konto das letzte mal geupdated wurde
|
||||||
final DateTime updatedAt;
|
final DateTime updatedAt;
|
||||||
|
|
||||||
const Account({
|
const Account({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
@@ -172,8 +170,9 @@ class Account extends DataClass implements Insertable<Account> {
|
|||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return (StringBuffer('Account(')
|
return (StringBuffer('Account(')
|
||||||
..write('id: $id, ')..write('name: $name, ')..write(
|
..write('id: $id, ')
|
||||||
'updatedAt: $updatedAt')
|
..write('name: $name, ')
|
||||||
|
..write('updatedAt: $updatedAt')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
@@ -245,8 +244,9 @@ class AccountsCompanion extends UpdateCompanion<Account> {
|
|||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return (StringBuffer('AccountsCompanion(')
|
return (StringBuffer('AccountsCompanion(')
|
||||||
..write('id: $id, ')..write('name: $name, ')..write(
|
..write('id: $id, ')
|
||||||
'updatedAt: $updatedAt')
|
..write('name: $name, ')
|
||||||
|
..write('updatedAt: $updatedAt')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
@@ -467,7 +467,7 @@ class RecurringTransaction extends DataClass
|
|||||||
/// Fremdschlüssel zum zugehörigen Konto
|
/// Fremdschlüssel zum zugehörigen Konto
|
||||||
final int accountId;
|
final int accountId;
|
||||||
|
|
||||||
/// Wann die wiederkehrende Transaktion das letzte mal geupdated wurde.
|
/// Wann die wiederkehrende Transaktion das letzte mal geupdated wurde
|
||||||
final DateTime updatedAt;
|
final DateTime updatedAt;
|
||||||
const RecurringTransaction({
|
const RecurringTransaction({
|
||||||
required this.id,
|
required this.id,
|
||||||
@@ -579,9 +579,8 @@ class RecurringTransaction extends DataClass
|
|||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('name: $name, ')
|
..write('name: $name, ')
|
||||||
..write('startDate: $startDate, ')
|
..write('startDate: $startDate, ')
|
||||||
..write('timeFrame: $timeFrame, ')
|
..write('timeFrame: $timeFrame, ')..write('amount: $amount, ')..write(
|
||||||
..write('amount: $amount, ')..write('accountId: $accountId, ')..write(
|
'accountId: $accountId, ')..write('updatedAt: $updatedAt')
|
||||||
'updatedAt: $updatedAt')
|
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
@@ -705,9 +704,8 @@ class RecurringTransactionsCompanion
|
|||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('name: $name, ')
|
..write('name: $name, ')
|
||||||
..write('startDate: $startDate, ')
|
..write('startDate: $startDate, ')
|
||||||
..write('timeFrame: $timeFrame, ')
|
..write('timeFrame: $timeFrame, ')..write('amount: $amount, ')..write(
|
||||||
..write('amount: $amount, ')..write('accountId: $accountId, ')..write(
|
'accountId: $accountId, ')..write('updatedAt: $updatedAt')
|
||||||
'updatedAt: $updatedAt')
|
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
@@ -961,7 +959,7 @@ class Transaction extends DataClass implements Insertable<Transaction> {
|
|||||||
/// falls vorhanden
|
/// falls vorhanden
|
||||||
final int? recurringTransactionId;
|
final int? recurringTransactionId;
|
||||||
|
|
||||||
/// Wann die Transaktion das letzte mal geupdated wurde.
|
/// Wann die Transaktion das letzte mal geupdated wurde
|
||||||
final DateTime updatedAt;
|
final DateTime updatedAt;
|
||||||
const Transaction({
|
const Transaction({
|
||||||
required this.id,
|
required this.id,
|
||||||
@@ -1079,10 +1077,9 @@ class Transaction extends DataClass implements Insertable<Transaction> {
|
|||||||
String toString() {
|
String toString() {
|
||||||
return (StringBuffer('Transaction(')
|
return (StringBuffer('Transaction(')
|
||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('name: $name, ')
|
..write('name: $name, ')..write('date: $date, ')..write(
|
||||||
..write('date: $date, ')..write('amount: $amount, ')..write(
|
'amount: $amount, ')..write('checked: $checked, ')..write(
|
||||||
'checked: $checked, ')
|
'accountId: $accountId, ')..write(
|
||||||
..write('accountId: $accountId, ')..write(
|
|
||||||
'recurringTransactionId: $recurringTransactionId, ')..write(
|
'recurringTransactionId: $recurringTransactionId, ')..write(
|
||||||
'updatedAt: $updatedAt')
|
'updatedAt: $updatedAt')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
@@ -1225,10 +1222,9 @@ class TransactionsCompanion extends UpdateCompanion<Transaction> {
|
|||||||
String toString() {
|
String toString() {
|
||||||
return (StringBuffer('TransactionsCompanion(')
|
return (StringBuffer('TransactionsCompanion(')
|
||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('name: $name, ')
|
..write('name: $name, ')..write('date: $date, ')..write(
|
||||||
..write('date: $date, ')..write('amount: $amount, ')..write(
|
'amount: $amount, ')..write('checked: $checked, ')..write(
|
||||||
'checked: $checked, ')
|
'accountId: $accountId, ')..write(
|
||||||
..write('accountId: $accountId, ')..write(
|
|
||||||
'recurringTransactionId: $recurringTransactionId, ')..write(
|
'recurringTransactionId: $recurringTransactionId, ')..write(
|
||||||
'updatedAt: $updatedAt')
|
'updatedAt: $updatedAt')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
|
|||||||
15
lib/Entities/sync_log_type_enum.dart
Normal file
15
lib/Entities/sync_log_type_enum.dart
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/// Eine Enum um den Typ der Lognachrichten
|
||||||
|
/// für den Synchronisationsstatus festzulegen
|
||||||
|
enum SyncLogTypeEnum {
|
||||||
|
/// Eine Info
|
||||||
|
info,
|
||||||
|
|
||||||
|
/// Ein Fehler
|
||||||
|
error,
|
||||||
|
|
||||||
|
/// Der Start des Prozesses
|
||||||
|
start,
|
||||||
|
|
||||||
|
/// Das Ende des Prozesses
|
||||||
|
end,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user