mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-09-01 10:24:08 +00:00
Some checks failed
Flutter analyze & test / flutter_analyze_and_test (push) Has been cancelled
51 lines
1.6 KiB
Dart
51 lines
1.6 KiB
Dart
import 'package:drift/drift.dart';
|
|
import 'package:twonly/src/database/tables/contacts.table.dart';
|
|
import 'package:twonly/src/database/tables/messages.table.dart';
|
|
|
|
@DataClassName('Receipt')
|
|
@TableIndex(name: 'idx_receipts_message_id', columns: {#messageId})
|
|
class Receipts extends Table {
|
|
TextColumn get receiptId => text()();
|
|
|
|
IntColumn get contactId =>
|
|
integer().references(Contacts, #userId, onDelete: KeyAction.cascade)();
|
|
|
|
// in case a message is deleted, it should be also deleted from the receipts table
|
|
TextColumn get messageId => text().nullable().references(
|
|
Messages,
|
|
#messageId,
|
|
onDelete: KeyAction.cascade,
|
|
)();
|
|
|
|
/// This is the protobuf 'Message'
|
|
BlobColumn get message => blob()();
|
|
|
|
BoolColumn get contactWillSendsReceipt =>
|
|
boolean().withDefault(const Constant(true))();
|
|
|
|
BoolColumn get willBeRetriedByMediaUpload =>
|
|
boolean().withDefault(const Constant(false))();
|
|
|
|
DateTimeColumn get markForRetry => dateTime().nullable()();
|
|
DateTimeColumn get markForRetryAfterAccepted => dateTime().nullable()();
|
|
|
|
DateTimeColumn get ackByServerAt => dateTime().nullable()();
|
|
|
|
IntColumn get retryCount => integer().withDefault(const Constant(0))();
|
|
DateTimeColumn get lastRetry => dateTime().nullable()();
|
|
|
|
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
|
|
|
|
@override
|
|
Set<Column> get primaryKey => {receiptId};
|
|
}
|
|
|
|
@DataClassName('ReceivedReceipt')
|
|
class ReceivedReceipts extends Table {
|
|
TextColumn get receiptId => text()();
|
|
|
|
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
|
|
|
|
@override
|
|
Set<Column> get primaryKey => {receiptId};
|
|
}
|