2025-12-13 13:27:05 +00:00
|
|
|
import 'package:drift/drift.dart';
|
2025-12-13 23:35:14 +00:00
|
|
|
import 'package:drift_postgres/drift_postgres.dart';
|
2025-12-13 20:55:50 +00:00
|
|
|
import '../converters.dart' show generateUuid;
|
2025-12-13 13:27:05 +00:00
|
|
|
|
|
|
|
|
/// Таблица ShareRequests - запросы на шаринг через Telegram
|
|
|
|
|
class ShareRequests extends Table {
|
2025-12-13 23:35:14 +00:00
|
|
|
// ID как String, но фактически UUID (генерируется PostgreSQL на стороне БД)
|
2025-12-20 18:26:15 +00:00
|
|
|
TextColumn get id =>
|
|
|
|
|
text().withDefault(const CustomExpression('gen_random_uuid()::text'))();
|
|
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
TextColumn get telegramUserId => text()();
|
|
|
|
|
TextColumn get telegramUsername => text().nullable()();
|
2025-12-20 18:26:15 +00:00
|
|
|
|
|
|
|
|
TextColumn get sharedCardId => text().nullable()();
|
|
|
|
|
|
|
|
|
|
Column<PgDateTime> get requestedAt =>
|
|
|
|
|
customType(PgTypes.timestampWithTimezone).withDefault(now())();
|
|
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
// Audit
|
2025-12-20 18:26:15 +00:00
|
|
|
Column<PgDateTime> get createdAt =>
|
|
|
|
|
customType(PgTypes.timestampWithTimezone).withDefault(now())();
|
|
|
|
|
Column<PgDateTime> get updatedAt =>
|
|
|
|
|
customType(PgTypes.timestampWithTimezone).withDefault(now())();
|
|
|
|
|
|
2025-12-13 20:55:50 +00:00
|
|
|
@override
|
|
|
|
|
Set<Column> get primaryKey => {id};
|
2025-12-13 13:27:05 +00:00
|
|
|
}
|