From fe10067761f452d4c73f2441111387a4b84b522c Mon Sep 17 00:00:00 2001 From: bvandeusen Date: Tue, 28 Apr 2026 21:22:06 -0400 Subject: [PATCH] =?UTF-8?q?feat(offline):=20tier=202=20phase=202=20?= =?UTF-8?q?=E2=80=94=20extend=20cache=20to=20tasks/projects/milestones/eve?= =?UTF-8?q?nts/conversations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 1 cached only notes. Phase 2 brings the read-through pattern to every domain the app reads in bulk: - Drift schema v2: 5 new cached_* tables + onUpgrade migration. Calendar events use range-scoped read/write (replaceEventsInRange) so disjoint month fetches don't clobber each other; milestones are per-project. - Wrap TasksRepository, ProjectsRepository, MilestonesRepository, and ChatRepository (conversation list only) with NetworkException fallback. Writes hit the API then sync the cache. - New EventsRepository wrapping EventsApi; calendar_provider and event_form_sheet repointed at the repository. - OfflineBanner now surfaces getLatestSync() — most-recent timestamp across all domains — so the hint reads sensibly regardless of screen. flutter analyze clean; existing tests pass. Phase 3 (offline write queue) and Phase 4 (read-only UI indicators) still to come. Co-Authored-By: Claude Opus 4.7 --- lib/data/local/database.dart | 542 +- lib/data/local/database.g.dart | 4569 +++++++++++++++++ lib/data/repositories/chat_repository.dart | 31 +- lib/data/repositories/events_repository.dart | 45 + .../repositories/milestones_repository.dart | 61 +- lib/data/repositories/notes_repository.dart | 5 - .../repositories/projects_repository.dart | 84 +- lib/data/repositories/tasks_repository.dart | 95 +- lib/providers/api_client_provider.dart | 28 +- lib/providers/calendar_provider.dart | 6 +- lib/screens/calendar/event_form_sheet.dart | 8 +- lib/widgets/offline_banner.dart | 6 +- 12 files changed, 5376 insertions(+), 104 deletions(-) create mode 100644 lib/data/repositories/events_repository.dart diff --git a/lib/data/local/database.dart b/lib/data/local/database.dart index baf5030..de84957 100644 --- a/lib/data/local/database.dart +++ b/lib/data/local/database.dart @@ -7,16 +7,24 @@ import 'package:path/path.dart' as p; import 'package:path_provider/path_provider.dart'; import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart'; +import '../models/calendar_event.dart'; +import '../models/conversation.dart'; +import '../models/milestone.dart'; import '../models/note.dart'; +import '../models/project.dart'; +import '../models/task.dart'; part 'database.g.dart'; -/// Local cache of server-side Notes for offline reads. -/// -/// Mirrors the shape of [Note] one-to-one. Tags are stored as a JSON-encoded -/// string because SQLite has no native list type and Drift's typed converters -/// add ceremony we don't need for a simple read cache. `cachedAt` tracks when -/// the row was last written from a successful API response. +// ── Tables ─────────────────────────────────────────────────────────────────── +// +// Each cached_* table mirrors the corresponding model 1:1. Tags / list fields +// are stored as JSON-encoded text; SQLite lacks a native list type and +// Drift's typed converters add ceremony we don't need for read-side caching. +// `cachedAt` tracks when the row was last written from a successful API +// response; the SyncMetadata table tracks the per-domain "last bulk fetch" +// timestamp used by the OfflineBanner. + class CachedNotes extends Table { IntColumn get id => integer()(); TextColumn get title => text()(); @@ -34,9 +42,92 @@ class CachedNotes extends Table { Set get primaryKey => {id}; } -/// Per-domain sync timestamp. Keyed by a short domain string ('notes', -/// 'tasks', 'projects', 'events', etc.) so the OfflineBanner and any -/// stale-while-revalidate logic can ask "when did we last fetch this". +class CachedTasks extends Table { + IntColumn get id => integer()(); + TextColumn get title => text()(); + TextColumn get description => text().nullable()(); + TextColumn get status => text()(); + TextColumn get priority => text()(); + DateTimeColumn get dueDate => dateTime().nullable()(); + IntColumn get projectId => integer().nullable()(); + IntColumn get milestoneId => integer().nullable()(); + IntColumn get parentId => integer().nullable()(); + DateTimeColumn get createdAt => dateTime()(); + DateTimeColumn get updatedAt => dateTime()(); + DateTimeColumn get cachedAt => + dateTime().clientDefault(() => DateTime.now())(); + + @override + Set get primaryKey => {id}; +} + +class CachedProjects extends Table { + IntColumn get id => integer()(); + TextColumn get title => text()(); + TextColumn get description => text().nullable()(); + TextColumn get goal => text().nullable()(); + TextColumn get status => text()(); + TextColumn get color => text().nullable()(); + TextColumn get autoSummary => text().nullable()(); + DateTimeColumn get createdAt => dateTime()(); + DateTimeColumn get updatedAt => dateTime()(); + DateTimeColumn get cachedAt => + dateTime().clientDefault(() => DateTime.now())(); + + @override + Set get primaryKey => {id}; +} + +class CachedMilestones extends Table { + IntColumn get id => integer()(); + IntColumn get projectId => integer()(); + TextColumn get title => text()(); + TextColumn get description => text().nullable()(); + TextColumn get status => text()(); + IntColumn get orderIndex => integer().withDefault(const Constant(0))(); + IntColumn get total => integer().withDefault(const Constant(0))(); + IntColumn get completed => integer().withDefault(const Constant(0))(); + RealColumn get pct => real().withDefault(const Constant(0.0))(); + DateTimeColumn get createdAt => dateTime()(); + DateTimeColumn get updatedAt => dateTime()(); + DateTimeColumn get cachedAt => + dateTime().clientDefault(() => DateTime.now())(); + + @override + Set get primaryKey => {id}; +} + +class CachedCalendarEvents extends Table { + IntColumn get id => integer()(); + TextColumn get title => text()(); + DateTimeColumn get startDt => dateTime()(); + DateTimeColumn get endDt => dateTime().nullable()(); + BoolColumn get allDay => boolean().withDefault(const Constant(false))(); + TextColumn get description => text().withDefault(const Constant(''))(); + TextColumn get location => text().withDefault(const Constant(''))(); + TextColumn get color => text().withDefault(const Constant(''))(); + TextColumn get recurrence => text().nullable()(); + IntColumn get projectId => integer().nullable()(); + IntColumn get reminderMinutes => integer().nullable()(); + DateTimeColumn get cachedAt => + dateTime().clientDefault(() => DateTime.now())(); + + @override + Set get primaryKey => {id}; +} + +class CachedConversations extends Table { + IntColumn get id => integer()(); + TextColumn get title => text()(); + DateTimeColumn get createdAt => dateTime()(); + DateTimeColumn get updatedAt => dateTime()(); + DateTimeColumn get cachedAt => + dateTime().clientDefault(() => DateTime.now())(); + + @override + Set get primaryKey => {id}; +} + class SyncMetadata extends Table { TextColumn get domain => text()(); DateTimeColumn get lastSyncedAt => dateTime()(); @@ -46,14 +137,42 @@ class SyncMetadata extends Table { } const String kSyncDomainNotes = 'notes'; +const String kSyncDomainTasks = 'tasks'; +const String kSyncDomainProjects = 'projects'; +const String kSyncDomainMilestones = 'milestones'; +const String kSyncDomainEvents = 'events'; +const String kSyncDomainConversations = 'conversations'; -@DriftDatabase(tables: [CachedNotes, SyncMetadata]) +@DriftDatabase(tables: [ + CachedNotes, + CachedTasks, + CachedProjects, + CachedMilestones, + CachedCalendarEvents, + CachedConversations, + SyncMetadata, +]) class FabledDatabase extends _$FabledDatabase { FabledDatabase() : super(_openConnection()); FabledDatabase.forTesting(super.executor); @override - int get schemaVersion => 1; + int get schemaVersion => 2; + + @override + MigrationStrategy get migration => MigrationStrategy( + onCreate: (m) => m.createAll(), + onUpgrade: (m, from, to) async { + // v1 → v2: added the per-domain caches beyond notes. + if (from < 2) { + await m.createTable(cachedTasks); + await m.createTable(cachedProjects); + await m.createTable(cachedMilestones); + await m.createTable(cachedCalendarEvents); + await m.createTable(cachedConversations); + } + }, + ); // ── Notes ──────────────────────────────────────────────────────────────── @@ -70,33 +189,237 @@ class FabledDatabase extends _$FabledDatabase { return row == null ? null : _noteFromRow(row); } - /// Replace the entire notes cache with the latest server snapshot. - /// Used after a successful `getAll()` so the cache reflects deletions - /// (a row that's gone from the server should be gone locally too). Future replaceAllNotes(List notes) async { await transaction(() async { await delete(cachedNotes).go(); if (notes.isNotEmpty) { await batch((b) { - b.insertAll( - cachedNotes, - notes.map(_companionFromNote).toList(), - ); + b.insertAll(cachedNotes, notes.map(_noteToCompanion).toList()); }); } await _setLastSyncIn(kSyncDomainNotes, DateTime.now()); }); } - /// Upsert a single note (after a successful create / update / getOne). Future upsertNote(Note note) async { - await into(cachedNotes).insertOnConflictUpdate(_companionFromNote(note)); + await into(cachedNotes).insertOnConflictUpdate(_noteToCompanion(note)); } Future deleteNote(int id) async { await (delete(cachedNotes)..where((t) => t.id.equals(id))).go(); } + // ── Tasks ──────────────────────────────────────────────────────────────── + + Future> getAllTasks() async { + final rows = await (select(cachedTasks) + ..orderBy([(t) => OrderingTerm.desc(t.updatedAt)])) + .get(); + return rows.map(_taskFromRow).toList(); + } + + Future getTask(int id) async { + final row = await (select(cachedTasks)..where((t) => t.id.equals(id))) + .getSingleOrNull(); + return row == null ? null : _taskFromRow(row); + } + + Future> getTasksByProject(int projectId) async { + final rows = await (select(cachedTasks) + ..where((t) => t.projectId.equals(projectId)) + ..orderBy([(t) => OrderingTerm.desc(t.updatedAt)])) + .get(); + return rows.map(_taskFromRow).toList(); + } + + Future> getSubTasks(int parentId) async { + final rows = await (select(cachedTasks) + ..where((t) => t.parentId.equals(parentId)) + ..orderBy([(t) => OrderingTerm.desc(t.updatedAt)])) + .get(); + return rows.map(_taskFromRow).toList(); + } + + Future replaceAllTasks(List tasks) async { + await transaction(() async { + await delete(cachedTasks).go(); + if (tasks.isNotEmpty) { + await batch((b) { + b.insertAll(cachedTasks, tasks.map(_taskToCompanion).toList()); + }); + } + await _setLastSyncIn(kSyncDomainTasks, DateTime.now()); + }); + } + + Future upsertTask(Task task) async { + await into(cachedTasks).insertOnConflictUpdate(_taskToCompanion(task)); + } + + Future deleteTask(int id) async { + await (delete(cachedTasks)..where((t) => t.id.equals(id))).go(); + } + + // ── Projects ───────────────────────────────────────────────────────────── + + Future> getAllProjects() async { + final rows = await (select(cachedProjects) + ..orderBy([(t) => OrderingTerm.desc(t.updatedAt)])) + .get(); + return rows.map(_projectFromRow).toList(); + } + + Future getProject(int id) async { + final row = await (select(cachedProjects)..where((t) => t.id.equals(id))) + .getSingleOrNull(); + return row == null ? null : _projectFromRow(row); + } + + Future replaceAllProjects(List projects) async { + await transaction(() async { + await delete(cachedProjects).go(); + if (projects.isNotEmpty) { + await batch((b) { + b.insertAll( + cachedProjects, + projects.map(_projectToCompanion).toList(), + ); + }); + } + await _setLastSyncIn(kSyncDomainProjects, DateTime.now()); + }); + } + + Future upsertProject(Project project) async { + await into(cachedProjects) + .insertOnConflictUpdate(_projectToCompanion(project)); + } + + Future deleteProject(int id) async { + await (delete(cachedProjects)..where((t) => t.id.equals(id))).go(); + } + + // ── Milestones ─────────────────────────────────────────────────────────── + + Future> getMilestonesForProject(int projectId) async { + final rows = await (select(cachedMilestones) + ..where((t) => t.projectId.equals(projectId)) + ..orderBy([(t) => OrderingTerm.asc(t.orderIndex)])) + .get(); + return rows.map(_milestoneFromRow).toList(); + } + + Future replaceMilestonesForProject( + int projectId, + List milestones, + ) async { + await transaction(() async { + await (delete(cachedMilestones) + ..where((t) => t.projectId.equals(projectId))) + .go(); + if (milestones.isNotEmpty) { + await batch((b) { + b.insertAll( + cachedMilestones, + milestones.map(_milestoneToCompanion).toList(), + ); + }); + } + await _setLastSyncIn(kSyncDomainMilestones, DateTime.now()); + }); + } + + Future upsertMilestone(Milestone milestone) async { + await into(cachedMilestones) + .insertOnConflictUpdate(_milestoneToCompanion(milestone)); + } + + Future deleteMilestone(int id) async { + await (delete(cachedMilestones)..where((t) => t.id.equals(id))).go(); + } + + // ── Calendar events ────────────────────────────────────────────────────── + + /// Returns events whose start_dt falls within [from, to). Recurrence + /// expansion still happens server-side; a stored event that has a + /// non-null recurrence rule will only have one row in cache (its + /// canonical instance), so cached date-range queries on recurring + /// events are best-effort and may miss future occurrences. + Future> getEventsInRange( + DateTime from, DateTime to) async { + final rows = await (select(cachedCalendarEvents) + ..where((t) => + t.startDt.isBiggerOrEqualValue(from) & + t.startDt.isSmallerThanValue(to)) + ..orderBy([(t) => OrderingTerm.asc(t.startDt)])) + .get(); + return rows.map(_eventFromRow).toList(); + } + + /// Replace the cache for the given range. Events outside [from, to) + /// are left alone — this matches the API's range-scoped semantics so + /// repeated fetches over disjoint ranges don't clobber each other. + Future replaceEventsInRange( + DateTime from, + DateTime to, + List events, + ) async { + await transaction(() async { + await (delete(cachedCalendarEvents) + ..where((t) => + t.startDt.isBiggerOrEqualValue(from) & + t.startDt.isSmallerThanValue(to))) + .go(); + if (events.isNotEmpty) { + await batch((b) { + b.insertAll( + cachedCalendarEvents, + events.map(_eventToCompanion).toList(), + ); + }); + } + await _setLastSyncIn(kSyncDomainEvents, DateTime.now()); + }); + } + + Future upsertEvent(CalendarEvent event) async { + await into(cachedCalendarEvents) + .insertOnConflictUpdate(_eventToCompanion(event)); + } + + Future deleteEvent(int id) async { + await (delete(cachedCalendarEvents)..where((t) => t.id.equals(id))).go(); + } + + // ── Conversations (chat list — not messages) ───────────────────────────── + + Future> getAllConversations() async { + final rows = await (select(cachedConversations) + ..orderBy([(t) => OrderingTerm.desc(t.updatedAt)])) + .get(); + return rows.map(_conversationFromRow).toList(); + } + + Future replaceAllConversations( + List conversations) async { + await transaction(() async { + await delete(cachedConversations).go(); + if (conversations.isNotEmpty) { + await batch((b) { + b.insertAll( + cachedConversations, + conversations.map(_conversationToCompanion).toList(), + ); + }); + } + await _setLastSyncIn(kSyncDomainConversations, DateTime.now()); + }); + } + + Future deleteConversation(int id) async { + await (delete(cachedConversations)..where((t) => t.id.equals(id))).go(); + } + // ── Sync metadata ──────────────────────────────────────────────────────── Future getLastSync(String domain) async { @@ -106,6 +429,17 @@ class FabledDatabase extends _$FabledDatabase { return row?.lastSyncedAt; } + /// Most recent sync across all domains. Used by the OfflineBanner so the + /// hint reads as "your data was current as of X" regardless of which + /// screen the user happens to be on. + Future getLatestSync() async { + final row = await (select(syncMetadata) + ..orderBy([(t) => OrderingTerm.desc(t.lastSyncedAt)]) + ..limit(1)) + .getSingleOrNull(); + return row?.lastSyncedAt; + } + Future _setLastSyncIn(String domain, DateTime timestamp) { return into(syncMetadata).insertOnConflictUpdate( SyncMetadataCompanion( @@ -116,28 +450,156 @@ class FabledDatabase extends _$FabledDatabase { } } -CachedNotesCompanion _companionFromNote(Note note) => CachedNotesCompanion( - id: Value(note.id), - title: Value(note.title), - body: Value(note.body), - tagsJson: Value(jsonEncode(note.tags)), - noteType: Value(note.noteType), - projectId: Value(note.projectId), - milestoneId: Value(note.milestoneId), - createdAt: Value(note.createdAt), - updatedAt: Value(note.updatedAt), +// ── Row ↔ model converters ────────────────────────────────────────────────── + +CachedNotesCompanion _noteToCompanion(Note n) => CachedNotesCompanion( + id: Value(n.id), + title: Value(n.title), + body: Value(n.body), + tagsJson: Value(jsonEncode(n.tags)), + noteType: Value(n.noteType), + projectId: Value(n.projectId), + milestoneId: Value(n.milestoneId), + createdAt: Value(n.createdAt), + updatedAt: Value(n.updatedAt), ); -Note _noteFromRow(CachedNote row) => Note( - id: row.id, - title: row.title, - body: row.body, - tags: (jsonDecode(row.tagsJson) as List).cast(), - noteType: row.noteType, - projectId: row.projectId, - milestoneId: row.milestoneId, - createdAt: row.createdAt, - updatedAt: row.updatedAt, +Note _noteFromRow(CachedNote r) => Note( + id: r.id, + title: r.title, + body: r.body, + tags: (jsonDecode(r.tagsJson) as List).cast(), + noteType: r.noteType, + projectId: r.projectId, + milestoneId: r.milestoneId, + createdAt: r.createdAt, + updatedAt: r.updatedAt, + ); + +CachedTasksCompanion _taskToCompanion(Task t) => CachedTasksCompanion( + id: Value(t.id), + title: Value(t.title), + description: Value(t.description), + status: Value(t.status.value), + priority: Value(t.priority.value), + dueDate: Value(t.dueDate), + projectId: Value(t.projectId), + milestoneId: Value(t.milestoneId), + parentId: Value(t.parentId), + createdAt: Value(t.createdAt), + updatedAt: Value(t.updatedAt), + ); + +Task _taskFromRow(CachedTask r) => Task( + id: r.id, + title: r.title, + description: r.description, + status: TaskStatusExtension.fromString(r.status), + priority: TaskPriorityExtension.fromString(r.priority), + dueDate: r.dueDate, + projectId: r.projectId, + milestoneId: r.milestoneId, + parentId: r.parentId, + createdAt: r.createdAt, + updatedAt: r.updatedAt, + ); + +CachedProjectsCompanion _projectToCompanion(Project p) => + CachedProjectsCompanion( + id: Value(p.id), + title: Value(p.title), + description: Value(p.description), + goal: Value(p.goal), + status: Value(p.status), + color: Value(p.color), + autoSummary: Value(p.autoSummary), + createdAt: Value(p.createdAt), + updatedAt: Value(p.updatedAt), + ); + +Project _projectFromRow(CachedProject r) => Project( + id: r.id, + title: r.title, + description: r.description, + goal: r.goal, + status: r.status, + color: r.color, + autoSummary: r.autoSummary, + createdAt: r.createdAt, + updatedAt: r.updatedAt, + ); + +CachedMilestonesCompanion _milestoneToCompanion(Milestone m) => + CachedMilestonesCompanion( + id: Value(m.id), + projectId: Value(m.projectId), + title: Value(m.title), + description: Value(m.description), + status: Value(m.status), + orderIndex: Value(m.orderIndex), + total: Value(m.total), + completed: Value(m.completed), + pct: Value(m.pct), + createdAt: Value(m.createdAt), + updatedAt: Value(m.updatedAt), + ); + +Milestone _milestoneFromRow(CachedMilestone r) => Milestone( + id: r.id, + projectId: r.projectId, + title: r.title, + description: r.description, + status: r.status, + orderIndex: r.orderIndex, + total: r.total, + completed: r.completed, + pct: r.pct, + createdAt: r.createdAt, + updatedAt: r.updatedAt, + ); + +CachedCalendarEventsCompanion _eventToCompanion(CalendarEvent e) => + CachedCalendarEventsCompanion( + id: Value(e.id), + title: Value(e.title), + startDt: Value(e.startDt), + endDt: Value(e.endDt), + allDay: Value(e.allDay), + description: Value(e.description), + location: Value(e.location), + color: Value(e.color), + recurrence: Value(e.recurrence), + projectId: Value(e.projectId), + reminderMinutes: Value(e.reminderMinutes), + ); + +CalendarEvent _eventFromRow(CachedCalendarEvent r) => CalendarEvent( + id: r.id, + title: r.title, + startDt: r.startDt, + endDt: r.endDt, + allDay: r.allDay, + description: r.description, + location: r.location, + color: r.color, + recurrence: r.recurrence, + projectId: r.projectId, + reminderMinutes: r.reminderMinutes, + ); + +CachedConversationsCompanion _conversationToCompanion(Conversation c) => + CachedConversationsCompanion( + id: Value(c.id), + title: Value(c.title), + createdAt: Value(c.createdAt), + updatedAt: Value(c.updatedAt), + ); + +Conversation _conversationFromRow(CachedConversation r) => Conversation( + id: r.id, + title: r.title, + createdAt: r.createdAt, + updatedAt: r.updatedAt, ); LazyDatabase _openConnection() { diff --git a/lib/data/local/database.g.dart b/lib/data/local/database.g.dart index 8c99cff..2598bca 100644 --- a/lib/data/local/database.g.dart +++ b/lib/data/local/database.g.dart @@ -594,6 +594,3021 @@ class CachedNotesCompanion extends UpdateCompanion { } } +class $CachedTasksTable extends CachedTasks + with TableInfo<$CachedTasksTable, CachedTask> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $CachedTasksTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _titleMeta = const VerificationMeta('title'); + @override + late final GeneratedColumn title = GeneratedColumn( + 'title', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _descriptionMeta = const VerificationMeta( + 'description', + ); + @override + late final GeneratedColumn description = GeneratedColumn( + 'description', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _statusMeta = const VerificationMeta('status'); + @override + late final GeneratedColumn status = GeneratedColumn( + 'status', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _priorityMeta = const VerificationMeta( + 'priority', + ); + @override + late final GeneratedColumn priority = GeneratedColumn( + 'priority', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _dueDateMeta = const VerificationMeta( + 'dueDate', + ); + @override + late final GeneratedColumn dueDate = GeneratedColumn( + 'due_date', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + static const VerificationMeta _projectIdMeta = const VerificationMeta( + 'projectId', + ); + @override + late final GeneratedColumn projectId = GeneratedColumn( + 'project_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _milestoneIdMeta = const VerificationMeta( + 'milestoneId', + ); + @override + late final GeneratedColumn milestoneId = GeneratedColumn( + 'milestone_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _parentIdMeta = const VerificationMeta( + 'parentId', + ); + @override + late final GeneratedColumn parentId = GeneratedColumn( + 'parent_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); + @override + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _updatedAtMeta = const VerificationMeta( + 'updatedAt', + ); + @override + late final GeneratedColumn updatedAt = GeneratedColumn( + 'updated_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _cachedAtMeta = const VerificationMeta( + 'cachedAt', + ); + @override + late final GeneratedColumn cachedAt = GeneratedColumn( + 'cached_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + clientDefault: () => DateTime.now(), + ); + @override + List get $columns => [ + id, + title, + description, + status, + priority, + dueDate, + projectId, + milestoneId, + parentId, + createdAt, + updatedAt, + cachedAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'cached_tasks'; + @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)); + } + if (data.containsKey('title')) { + context.handle( + _titleMeta, + title.isAcceptableOrUnknown(data['title']!, _titleMeta), + ); + } else if (isInserting) { + context.missing(_titleMeta); + } + if (data.containsKey('description')) { + context.handle( + _descriptionMeta, + description.isAcceptableOrUnknown( + data['description']!, + _descriptionMeta, + ), + ); + } + if (data.containsKey('status')) { + context.handle( + _statusMeta, + status.isAcceptableOrUnknown(data['status']!, _statusMeta), + ); + } else if (isInserting) { + context.missing(_statusMeta); + } + if (data.containsKey('priority')) { + context.handle( + _priorityMeta, + priority.isAcceptableOrUnknown(data['priority']!, _priorityMeta), + ); + } else if (isInserting) { + context.missing(_priorityMeta); + } + if (data.containsKey('due_date')) { + context.handle( + _dueDateMeta, + dueDate.isAcceptableOrUnknown(data['due_date']!, _dueDateMeta), + ); + } + if (data.containsKey('project_id')) { + context.handle( + _projectIdMeta, + projectId.isAcceptableOrUnknown(data['project_id']!, _projectIdMeta), + ); + } + if (data.containsKey('milestone_id')) { + context.handle( + _milestoneIdMeta, + milestoneId.isAcceptableOrUnknown( + data['milestone_id']!, + _milestoneIdMeta, + ), + ); + } + if (data.containsKey('parent_id')) { + context.handle( + _parentIdMeta, + parentId.isAcceptableOrUnknown(data['parent_id']!, _parentIdMeta), + ); + } + if (data.containsKey('created_at')) { + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); + } else if (isInserting) { + context.missing(_createdAtMeta); + } + if (data.containsKey('updated_at')) { + context.handle( + _updatedAtMeta, + updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta), + ); + } else if (isInserting) { + context.missing(_updatedAtMeta); + } + if (data.containsKey('cached_at')) { + context.handle( + _cachedAtMeta, + cachedAt.isAcceptableOrUnknown(data['cached_at']!, _cachedAtMeta), + ); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + CachedTask map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return CachedTask( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + title: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}title'], + )!, + description: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}description'], + ), + status: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}status'], + )!, + priority: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}priority'], + )!, + dueDate: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}due_date'], + ), + projectId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}project_id'], + ), + milestoneId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}milestone_id'], + ), + parentId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}parent_id'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + updatedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}updated_at'], + )!, + cachedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}cached_at'], + )!, + ); + } + + @override + $CachedTasksTable createAlias(String alias) { + return $CachedTasksTable(attachedDatabase, alias); + } +} + +class CachedTask extends DataClass implements Insertable { + final int id; + final String title; + final String? description; + final String status; + final String priority; + final DateTime? dueDate; + final int? projectId; + final int? milestoneId; + final int? parentId; + final DateTime createdAt; + final DateTime updatedAt; + final DateTime cachedAt; + const CachedTask({ + required this.id, + required this.title, + this.description, + required this.status, + required this.priority, + this.dueDate, + this.projectId, + this.milestoneId, + this.parentId, + required this.createdAt, + required this.updatedAt, + required this.cachedAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || description != null) { + map['description'] = Variable(description); + } + map['status'] = Variable(status); + map['priority'] = Variable(priority); + if (!nullToAbsent || dueDate != null) { + map['due_date'] = Variable(dueDate); + } + if (!nullToAbsent || projectId != null) { + map['project_id'] = Variable(projectId); + } + if (!nullToAbsent || milestoneId != null) { + map['milestone_id'] = Variable(milestoneId); + } + if (!nullToAbsent || parentId != null) { + map['parent_id'] = Variable(parentId); + } + map['created_at'] = Variable(createdAt); + map['updated_at'] = Variable(updatedAt); + map['cached_at'] = Variable(cachedAt); + return map; + } + + CachedTasksCompanion toCompanion(bool nullToAbsent) { + return CachedTasksCompanion( + id: Value(id), + title: Value(title), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + status: Value(status), + priority: Value(priority), + dueDate: dueDate == null && nullToAbsent + ? const Value.absent() + : Value(dueDate), + projectId: projectId == null && nullToAbsent + ? const Value.absent() + : Value(projectId), + milestoneId: milestoneId == null && nullToAbsent + ? const Value.absent() + : Value(milestoneId), + parentId: parentId == null && nullToAbsent + ? const Value.absent() + : Value(parentId), + createdAt: Value(createdAt), + updatedAt: Value(updatedAt), + cachedAt: Value(cachedAt), + ); + } + + factory CachedTask.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return CachedTask( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + status: serializer.fromJson(json['status']), + priority: serializer.fromJson(json['priority']), + dueDate: serializer.fromJson(json['dueDate']), + projectId: serializer.fromJson(json['projectId']), + milestoneId: serializer.fromJson(json['milestoneId']), + parentId: serializer.fromJson(json['parentId']), + createdAt: serializer.fromJson(json['createdAt']), + updatedAt: serializer.fromJson(json['updatedAt']), + cachedAt: serializer.fromJson(json['cachedAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'status': serializer.toJson(status), + 'priority': serializer.toJson(priority), + 'dueDate': serializer.toJson(dueDate), + 'projectId': serializer.toJson(projectId), + 'milestoneId': serializer.toJson(milestoneId), + 'parentId': serializer.toJson(parentId), + 'createdAt': serializer.toJson(createdAt), + 'updatedAt': serializer.toJson(updatedAt), + 'cachedAt': serializer.toJson(cachedAt), + }; + } + + CachedTask copyWith({ + int? id, + String? title, + Value description = const Value.absent(), + String? status, + String? priority, + Value dueDate = const Value.absent(), + Value projectId = const Value.absent(), + Value milestoneId = const Value.absent(), + Value parentId = const Value.absent(), + DateTime? createdAt, + DateTime? updatedAt, + DateTime? cachedAt, + }) => CachedTask( + id: id ?? this.id, + title: title ?? this.title, + description: description.present ? description.value : this.description, + status: status ?? this.status, + priority: priority ?? this.priority, + dueDate: dueDate.present ? dueDate.value : this.dueDate, + projectId: projectId.present ? projectId.value : this.projectId, + milestoneId: milestoneId.present ? milestoneId.value : this.milestoneId, + parentId: parentId.present ? parentId.value : this.parentId, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + CachedTask copyWithCompanion(CachedTasksCompanion data) { + return CachedTask( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: data.description.present + ? data.description.value + : this.description, + status: data.status.present ? data.status.value : this.status, + priority: data.priority.present ? data.priority.value : this.priority, + dueDate: data.dueDate.present ? data.dueDate.value : this.dueDate, + projectId: data.projectId.present ? data.projectId.value : this.projectId, + milestoneId: data.milestoneId.present + ? data.milestoneId.value + : this.milestoneId, + parentId: data.parentId.present ? data.parentId.value : this.parentId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt, + cachedAt: data.cachedAt.present ? data.cachedAt.value : this.cachedAt, + ); + } + + @override + String toString() { + return (StringBuffer('CachedTask(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('status: $status, ') + ..write('priority: $priority, ') + ..write('dueDate: $dueDate, ') + ..write('projectId: $projectId, ') + ..write('milestoneId: $milestoneId, ') + ..write('parentId: $parentId, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + status, + priority, + dueDate, + projectId, + milestoneId, + parentId, + createdAt, + updatedAt, + cachedAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is CachedTask && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.status == this.status && + other.priority == this.priority && + other.dueDate == this.dueDate && + other.projectId == this.projectId && + other.milestoneId == this.milestoneId && + other.parentId == this.parentId && + other.createdAt == this.createdAt && + other.updatedAt == this.updatedAt && + other.cachedAt == this.cachedAt); +} + +class CachedTasksCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value status; + final Value priority; + final Value dueDate; + final Value projectId; + final Value milestoneId; + final Value parentId; + final Value createdAt; + final Value updatedAt; + final Value cachedAt; + const CachedTasksCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.status = const Value.absent(), + this.priority = const Value.absent(), + this.dueDate = const Value.absent(), + this.projectId = const Value.absent(), + this.milestoneId = const Value.absent(), + this.parentId = const Value.absent(), + this.createdAt = const Value.absent(), + this.updatedAt = const Value.absent(), + this.cachedAt = const Value.absent(), + }); + CachedTasksCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.description = const Value.absent(), + required String status, + required String priority, + this.dueDate = const Value.absent(), + this.projectId = const Value.absent(), + this.milestoneId = const Value.absent(), + this.parentId = const Value.absent(), + required DateTime createdAt, + required DateTime updatedAt, + this.cachedAt = const Value.absent(), + }) : title = Value(title), + status = Value(status), + priority = Value(priority), + createdAt = Value(createdAt), + updatedAt = Value(updatedAt); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? status, + Expression? priority, + Expression? dueDate, + Expression? projectId, + Expression? milestoneId, + Expression? parentId, + Expression? createdAt, + Expression? updatedAt, + Expression? cachedAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'description': description, + if (status != null) 'status': status, + if (priority != null) 'priority': priority, + if (dueDate != null) 'due_date': dueDate, + if (projectId != null) 'project_id': projectId, + if (milestoneId != null) 'milestone_id': milestoneId, + if (parentId != null) 'parent_id': parentId, + if (createdAt != null) 'created_at': createdAt, + if (updatedAt != null) 'updated_at': updatedAt, + if (cachedAt != null) 'cached_at': cachedAt, + }); + } + + CachedTasksCompanion copyWith({ + Value? id, + Value? title, + Value? description, + Value? status, + Value? priority, + Value? dueDate, + Value? projectId, + Value? milestoneId, + Value? parentId, + Value? createdAt, + Value? updatedAt, + Value? cachedAt, + }) { + return CachedTasksCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + status: status ?? this.status, + priority: priority ?? this.priority, + dueDate: dueDate ?? this.dueDate, + projectId: projectId ?? this.projectId, + milestoneId: milestoneId ?? this.milestoneId, + parentId: parentId ?? this.parentId, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['description'] = Variable(description.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (priority.present) { + map['priority'] = Variable(priority.value); + } + if (dueDate.present) { + map['due_date'] = Variable(dueDate.value); + } + if (projectId.present) { + map['project_id'] = Variable(projectId.value); + } + if (milestoneId.present) { + map['milestone_id'] = Variable(milestoneId.value); + } + if (parentId.present) { + map['parent_id'] = Variable(parentId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (updatedAt.present) { + map['updated_at'] = Variable(updatedAt.value); + } + if (cachedAt.present) { + map['cached_at'] = Variable(cachedAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('CachedTasksCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('status: $status, ') + ..write('priority: $priority, ') + ..write('dueDate: $dueDate, ') + ..write('projectId: $projectId, ') + ..write('milestoneId: $milestoneId, ') + ..write('parentId: $parentId, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } +} + +class $CachedProjectsTable extends CachedProjects + with TableInfo<$CachedProjectsTable, CachedProject> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $CachedProjectsTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _titleMeta = const VerificationMeta('title'); + @override + late final GeneratedColumn title = GeneratedColumn( + 'title', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _descriptionMeta = const VerificationMeta( + 'description', + ); + @override + late final GeneratedColumn description = GeneratedColumn( + 'description', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _goalMeta = const VerificationMeta('goal'); + @override + late final GeneratedColumn goal = GeneratedColumn( + 'goal', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _statusMeta = const VerificationMeta('status'); + @override + late final GeneratedColumn status = GeneratedColumn( + 'status', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _colorMeta = const VerificationMeta('color'); + @override + late final GeneratedColumn color = GeneratedColumn( + 'color', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _autoSummaryMeta = const VerificationMeta( + 'autoSummary', + ); + @override + late final GeneratedColumn autoSummary = GeneratedColumn( + 'auto_summary', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); + @override + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _updatedAtMeta = const VerificationMeta( + 'updatedAt', + ); + @override + late final GeneratedColumn updatedAt = GeneratedColumn( + 'updated_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _cachedAtMeta = const VerificationMeta( + 'cachedAt', + ); + @override + late final GeneratedColumn cachedAt = GeneratedColumn( + 'cached_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + clientDefault: () => DateTime.now(), + ); + @override + List get $columns => [ + id, + title, + description, + goal, + status, + color, + autoSummary, + createdAt, + updatedAt, + cachedAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'cached_projects'; + @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)); + } + if (data.containsKey('title')) { + context.handle( + _titleMeta, + title.isAcceptableOrUnknown(data['title']!, _titleMeta), + ); + } else if (isInserting) { + context.missing(_titleMeta); + } + if (data.containsKey('description')) { + context.handle( + _descriptionMeta, + description.isAcceptableOrUnknown( + data['description']!, + _descriptionMeta, + ), + ); + } + if (data.containsKey('goal')) { + context.handle( + _goalMeta, + goal.isAcceptableOrUnknown(data['goal']!, _goalMeta), + ); + } + if (data.containsKey('status')) { + context.handle( + _statusMeta, + status.isAcceptableOrUnknown(data['status']!, _statusMeta), + ); + } else if (isInserting) { + context.missing(_statusMeta); + } + if (data.containsKey('color')) { + context.handle( + _colorMeta, + color.isAcceptableOrUnknown(data['color']!, _colorMeta), + ); + } + if (data.containsKey('auto_summary')) { + context.handle( + _autoSummaryMeta, + autoSummary.isAcceptableOrUnknown( + data['auto_summary']!, + _autoSummaryMeta, + ), + ); + } + if (data.containsKey('created_at')) { + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); + } else if (isInserting) { + context.missing(_createdAtMeta); + } + if (data.containsKey('updated_at')) { + context.handle( + _updatedAtMeta, + updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta), + ); + } else if (isInserting) { + context.missing(_updatedAtMeta); + } + if (data.containsKey('cached_at')) { + context.handle( + _cachedAtMeta, + cachedAt.isAcceptableOrUnknown(data['cached_at']!, _cachedAtMeta), + ); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + CachedProject map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return CachedProject( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + title: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}title'], + )!, + description: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}description'], + ), + goal: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}goal'], + ), + status: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}status'], + )!, + color: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}color'], + ), + autoSummary: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}auto_summary'], + ), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + updatedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}updated_at'], + )!, + cachedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}cached_at'], + )!, + ); + } + + @override + $CachedProjectsTable createAlias(String alias) { + return $CachedProjectsTable(attachedDatabase, alias); + } +} + +class CachedProject extends DataClass implements Insertable { + final int id; + final String title; + final String? description; + final String? goal; + final String status; + final String? color; + final String? autoSummary; + final DateTime createdAt; + final DateTime updatedAt; + final DateTime cachedAt; + const CachedProject({ + required this.id, + required this.title, + this.description, + this.goal, + required this.status, + this.color, + this.autoSummary, + required this.createdAt, + required this.updatedAt, + required this.cachedAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + if (!nullToAbsent || description != null) { + map['description'] = Variable(description); + } + if (!nullToAbsent || goal != null) { + map['goal'] = Variable(goal); + } + map['status'] = Variable(status); + if (!nullToAbsent || color != null) { + map['color'] = Variable(color); + } + if (!nullToAbsent || autoSummary != null) { + map['auto_summary'] = Variable(autoSummary); + } + map['created_at'] = Variable(createdAt); + map['updated_at'] = Variable(updatedAt); + map['cached_at'] = Variable(cachedAt); + return map; + } + + CachedProjectsCompanion toCompanion(bool nullToAbsent) { + return CachedProjectsCompanion( + id: Value(id), + title: Value(title), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + goal: goal == null && nullToAbsent ? const Value.absent() : Value(goal), + status: Value(status), + color: color == null && nullToAbsent + ? const Value.absent() + : Value(color), + autoSummary: autoSummary == null && nullToAbsent + ? const Value.absent() + : Value(autoSummary), + createdAt: Value(createdAt), + updatedAt: Value(updatedAt), + cachedAt: Value(cachedAt), + ); + } + + factory CachedProject.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return CachedProject( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + goal: serializer.fromJson(json['goal']), + status: serializer.fromJson(json['status']), + color: serializer.fromJson(json['color']), + autoSummary: serializer.fromJson(json['autoSummary']), + createdAt: serializer.fromJson(json['createdAt']), + updatedAt: serializer.fromJson(json['updatedAt']), + cachedAt: serializer.fromJson(json['cachedAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'goal': serializer.toJson(goal), + 'status': serializer.toJson(status), + 'color': serializer.toJson(color), + 'autoSummary': serializer.toJson(autoSummary), + 'createdAt': serializer.toJson(createdAt), + 'updatedAt': serializer.toJson(updatedAt), + 'cachedAt': serializer.toJson(cachedAt), + }; + } + + CachedProject copyWith({ + int? id, + String? title, + Value description = const Value.absent(), + Value goal = const Value.absent(), + String? status, + Value color = const Value.absent(), + Value autoSummary = const Value.absent(), + DateTime? createdAt, + DateTime? updatedAt, + DateTime? cachedAt, + }) => CachedProject( + id: id ?? this.id, + title: title ?? this.title, + description: description.present ? description.value : this.description, + goal: goal.present ? goal.value : this.goal, + status: status ?? this.status, + color: color.present ? color.value : this.color, + autoSummary: autoSummary.present ? autoSummary.value : this.autoSummary, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + CachedProject copyWithCompanion(CachedProjectsCompanion data) { + return CachedProject( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + description: data.description.present + ? data.description.value + : this.description, + goal: data.goal.present ? data.goal.value : this.goal, + status: data.status.present ? data.status.value : this.status, + color: data.color.present ? data.color.value : this.color, + autoSummary: data.autoSummary.present + ? data.autoSummary.value + : this.autoSummary, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt, + cachedAt: data.cachedAt.present ? data.cachedAt.value : this.cachedAt, + ); + } + + @override + String toString() { + return (StringBuffer('CachedProject(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('goal: $goal, ') + ..write('status: $status, ') + ..write('color: $color, ') + ..write('autoSummary: $autoSummary, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + description, + goal, + status, + color, + autoSummary, + createdAt, + updatedAt, + cachedAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is CachedProject && + other.id == this.id && + other.title == this.title && + other.description == this.description && + other.goal == this.goal && + other.status == this.status && + other.color == this.color && + other.autoSummary == this.autoSummary && + other.createdAt == this.createdAt && + other.updatedAt == this.updatedAt && + other.cachedAt == this.cachedAt); +} + +class CachedProjectsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value description; + final Value goal; + final Value status; + final Value color; + final Value autoSummary; + final Value createdAt; + final Value updatedAt; + final Value cachedAt; + const CachedProjectsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.goal = const Value.absent(), + this.status = const Value.absent(), + this.color = const Value.absent(), + this.autoSummary = const Value.absent(), + this.createdAt = const Value.absent(), + this.updatedAt = const Value.absent(), + this.cachedAt = const Value.absent(), + }); + CachedProjectsCompanion.insert({ + this.id = const Value.absent(), + required String title, + this.description = const Value.absent(), + this.goal = const Value.absent(), + required String status, + this.color = const Value.absent(), + this.autoSummary = const Value.absent(), + required DateTime createdAt, + required DateTime updatedAt, + this.cachedAt = const Value.absent(), + }) : title = Value(title), + status = Value(status), + createdAt = Value(createdAt), + updatedAt = Value(updatedAt); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? description, + Expression? goal, + Expression? status, + Expression? color, + Expression? autoSummary, + Expression? createdAt, + Expression? updatedAt, + Expression? cachedAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (description != null) 'description': description, + if (goal != null) 'goal': goal, + if (status != null) 'status': status, + if (color != null) 'color': color, + if (autoSummary != null) 'auto_summary': autoSummary, + if (createdAt != null) 'created_at': createdAt, + if (updatedAt != null) 'updated_at': updatedAt, + if (cachedAt != null) 'cached_at': cachedAt, + }); + } + + CachedProjectsCompanion copyWith({ + Value? id, + Value? title, + Value? description, + Value? goal, + Value? status, + Value? color, + Value? autoSummary, + Value? createdAt, + Value? updatedAt, + Value? cachedAt, + }) { + return CachedProjectsCompanion( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + goal: goal ?? this.goal, + status: status ?? this.status, + color: color ?? this.color, + autoSummary: autoSummary ?? this.autoSummary, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['description'] = Variable(description.value); + } + if (goal.present) { + map['goal'] = Variable(goal.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (color.present) { + map['color'] = Variable(color.value); + } + if (autoSummary.present) { + map['auto_summary'] = Variable(autoSummary.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (updatedAt.present) { + map['updated_at'] = Variable(updatedAt.value); + } + if (cachedAt.present) { + map['cached_at'] = Variable(cachedAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('CachedProjectsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('goal: $goal, ') + ..write('status: $status, ') + ..write('color: $color, ') + ..write('autoSummary: $autoSummary, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } +} + +class $CachedMilestonesTable extends CachedMilestones + with TableInfo<$CachedMilestonesTable, CachedMilestone> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $CachedMilestonesTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _projectIdMeta = const VerificationMeta( + 'projectId', + ); + @override + late final GeneratedColumn projectId = GeneratedColumn( + 'project_id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: true, + ); + static const VerificationMeta _titleMeta = const VerificationMeta('title'); + @override + late final GeneratedColumn title = GeneratedColumn( + 'title', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _descriptionMeta = const VerificationMeta( + 'description', + ); + @override + late final GeneratedColumn description = GeneratedColumn( + 'description', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _statusMeta = const VerificationMeta('status'); + @override + late final GeneratedColumn status = GeneratedColumn( + 'status', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _orderIndexMeta = const VerificationMeta( + 'orderIndex', + ); + @override + late final GeneratedColumn orderIndex = GeneratedColumn( + 'order_index', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + static const VerificationMeta _totalMeta = const VerificationMeta('total'); + @override + late final GeneratedColumn total = GeneratedColumn( + 'total', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + static const VerificationMeta _completedMeta = const VerificationMeta( + 'completed', + ); + @override + late final GeneratedColumn completed = GeneratedColumn( + 'completed', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0), + ); + static const VerificationMeta _pctMeta = const VerificationMeta('pct'); + @override + late final GeneratedColumn pct = GeneratedColumn( + 'pct', + aliasedName, + false, + type: DriftSqlType.double, + requiredDuringInsert: false, + defaultValue: const Constant(0.0), + ); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); + @override + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _updatedAtMeta = const VerificationMeta( + 'updatedAt', + ); + @override + late final GeneratedColumn updatedAt = GeneratedColumn( + 'updated_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _cachedAtMeta = const VerificationMeta( + 'cachedAt', + ); + @override + late final GeneratedColumn cachedAt = GeneratedColumn( + 'cached_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + clientDefault: () => DateTime.now(), + ); + @override + List get $columns => [ + id, + projectId, + title, + description, + status, + orderIndex, + total, + completed, + pct, + createdAt, + updatedAt, + cachedAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'cached_milestones'; + @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)); + } + if (data.containsKey('project_id')) { + context.handle( + _projectIdMeta, + projectId.isAcceptableOrUnknown(data['project_id']!, _projectIdMeta), + ); + } else if (isInserting) { + context.missing(_projectIdMeta); + } + if (data.containsKey('title')) { + context.handle( + _titleMeta, + title.isAcceptableOrUnknown(data['title']!, _titleMeta), + ); + } else if (isInserting) { + context.missing(_titleMeta); + } + if (data.containsKey('description')) { + context.handle( + _descriptionMeta, + description.isAcceptableOrUnknown( + data['description']!, + _descriptionMeta, + ), + ); + } + if (data.containsKey('status')) { + context.handle( + _statusMeta, + status.isAcceptableOrUnknown(data['status']!, _statusMeta), + ); + } else if (isInserting) { + context.missing(_statusMeta); + } + if (data.containsKey('order_index')) { + context.handle( + _orderIndexMeta, + orderIndex.isAcceptableOrUnknown(data['order_index']!, _orderIndexMeta), + ); + } + if (data.containsKey('total')) { + context.handle( + _totalMeta, + total.isAcceptableOrUnknown(data['total']!, _totalMeta), + ); + } + if (data.containsKey('completed')) { + context.handle( + _completedMeta, + completed.isAcceptableOrUnknown(data['completed']!, _completedMeta), + ); + } + if (data.containsKey('pct')) { + context.handle( + _pctMeta, + pct.isAcceptableOrUnknown(data['pct']!, _pctMeta), + ); + } + if (data.containsKey('created_at')) { + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); + } else if (isInserting) { + context.missing(_createdAtMeta); + } + if (data.containsKey('updated_at')) { + context.handle( + _updatedAtMeta, + updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta), + ); + } else if (isInserting) { + context.missing(_updatedAtMeta); + } + if (data.containsKey('cached_at')) { + context.handle( + _cachedAtMeta, + cachedAt.isAcceptableOrUnknown(data['cached_at']!, _cachedAtMeta), + ); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + CachedMilestone map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return CachedMilestone( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + projectId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}project_id'], + )!, + title: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}title'], + )!, + description: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}description'], + ), + status: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}status'], + )!, + orderIndex: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}order_index'], + )!, + total: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}total'], + )!, + completed: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}completed'], + )!, + pct: attachedDatabase.typeMapping.read( + DriftSqlType.double, + data['${effectivePrefix}pct'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + updatedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}updated_at'], + )!, + cachedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}cached_at'], + )!, + ); + } + + @override + $CachedMilestonesTable createAlias(String alias) { + return $CachedMilestonesTable(attachedDatabase, alias); + } +} + +class CachedMilestone extends DataClass implements Insertable { + final int id; + final int projectId; + final String title; + final String? description; + final String status; + final int orderIndex; + final int total; + final int completed; + final double pct; + final DateTime createdAt; + final DateTime updatedAt; + final DateTime cachedAt; + const CachedMilestone({ + required this.id, + required this.projectId, + required this.title, + this.description, + required this.status, + required this.orderIndex, + required this.total, + required this.completed, + required this.pct, + required this.createdAt, + required this.updatedAt, + required this.cachedAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['project_id'] = Variable(projectId); + map['title'] = Variable(title); + if (!nullToAbsent || description != null) { + map['description'] = Variable(description); + } + map['status'] = Variable(status); + map['order_index'] = Variable(orderIndex); + map['total'] = Variable(total); + map['completed'] = Variable(completed); + map['pct'] = Variable(pct); + map['created_at'] = Variable(createdAt); + map['updated_at'] = Variable(updatedAt); + map['cached_at'] = Variable(cachedAt); + return map; + } + + CachedMilestonesCompanion toCompanion(bool nullToAbsent) { + return CachedMilestonesCompanion( + id: Value(id), + projectId: Value(projectId), + title: Value(title), + description: description == null && nullToAbsent + ? const Value.absent() + : Value(description), + status: Value(status), + orderIndex: Value(orderIndex), + total: Value(total), + completed: Value(completed), + pct: Value(pct), + createdAt: Value(createdAt), + updatedAt: Value(updatedAt), + cachedAt: Value(cachedAt), + ); + } + + factory CachedMilestone.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return CachedMilestone( + id: serializer.fromJson(json['id']), + projectId: serializer.fromJson(json['projectId']), + title: serializer.fromJson(json['title']), + description: serializer.fromJson(json['description']), + status: serializer.fromJson(json['status']), + orderIndex: serializer.fromJson(json['orderIndex']), + total: serializer.fromJson(json['total']), + completed: serializer.fromJson(json['completed']), + pct: serializer.fromJson(json['pct']), + createdAt: serializer.fromJson(json['createdAt']), + updatedAt: serializer.fromJson(json['updatedAt']), + cachedAt: serializer.fromJson(json['cachedAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'projectId': serializer.toJson(projectId), + 'title': serializer.toJson(title), + 'description': serializer.toJson(description), + 'status': serializer.toJson(status), + 'orderIndex': serializer.toJson(orderIndex), + 'total': serializer.toJson(total), + 'completed': serializer.toJson(completed), + 'pct': serializer.toJson(pct), + 'createdAt': serializer.toJson(createdAt), + 'updatedAt': serializer.toJson(updatedAt), + 'cachedAt': serializer.toJson(cachedAt), + }; + } + + CachedMilestone copyWith({ + int? id, + int? projectId, + String? title, + Value description = const Value.absent(), + String? status, + int? orderIndex, + int? total, + int? completed, + double? pct, + DateTime? createdAt, + DateTime? updatedAt, + DateTime? cachedAt, + }) => CachedMilestone( + id: id ?? this.id, + projectId: projectId ?? this.projectId, + title: title ?? this.title, + description: description.present ? description.value : this.description, + status: status ?? this.status, + orderIndex: orderIndex ?? this.orderIndex, + total: total ?? this.total, + completed: completed ?? this.completed, + pct: pct ?? this.pct, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + CachedMilestone copyWithCompanion(CachedMilestonesCompanion data) { + return CachedMilestone( + id: data.id.present ? data.id.value : this.id, + projectId: data.projectId.present ? data.projectId.value : this.projectId, + title: data.title.present ? data.title.value : this.title, + description: data.description.present + ? data.description.value + : this.description, + status: data.status.present ? data.status.value : this.status, + orderIndex: data.orderIndex.present + ? data.orderIndex.value + : this.orderIndex, + total: data.total.present ? data.total.value : this.total, + completed: data.completed.present ? data.completed.value : this.completed, + pct: data.pct.present ? data.pct.value : this.pct, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt, + cachedAt: data.cachedAt.present ? data.cachedAt.value : this.cachedAt, + ); + } + + @override + String toString() { + return (StringBuffer('CachedMilestone(') + ..write('id: $id, ') + ..write('projectId: $projectId, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('status: $status, ') + ..write('orderIndex: $orderIndex, ') + ..write('total: $total, ') + ..write('completed: $completed, ') + ..write('pct: $pct, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + projectId, + title, + description, + status, + orderIndex, + total, + completed, + pct, + createdAt, + updatedAt, + cachedAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is CachedMilestone && + other.id == this.id && + other.projectId == this.projectId && + other.title == this.title && + other.description == this.description && + other.status == this.status && + other.orderIndex == this.orderIndex && + other.total == this.total && + other.completed == this.completed && + other.pct == this.pct && + other.createdAt == this.createdAt && + other.updatedAt == this.updatedAt && + other.cachedAt == this.cachedAt); +} + +class CachedMilestonesCompanion extends UpdateCompanion { + final Value id; + final Value projectId; + final Value title; + final Value description; + final Value status; + final Value orderIndex; + final Value total; + final Value completed; + final Value pct; + final Value createdAt; + final Value updatedAt; + final Value cachedAt; + const CachedMilestonesCompanion({ + this.id = const Value.absent(), + this.projectId = const Value.absent(), + this.title = const Value.absent(), + this.description = const Value.absent(), + this.status = const Value.absent(), + this.orderIndex = const Value.absent(), + this.total = const Value.absent(), + this.completed = const Value.absent(), + this.pct = const Value.absent(), + this.createdAt = const Value.absent(), + this.updatedAt = const Value.absent(), + this.cachedAt = const Value.absent(), + }); + CachedMilestonesCompanion.insert({ + this.id = const Value.absent(), + required int projectId, + required String title, + this.description = const Value.absent(), + required String status, + this.orderIndex = const Value.absent(), + this.total = const Value.absent(), + this.completed = const Value.absent(), + this.pct = const Value.absent(), + required DateTime createdAt, + required DateTime updatedAt, + this.cachedAt = const Value.absent(), + }) : projectId = Value(projectId), + title = Value(title), + status = Value(status), + createdAt = Value(createdAt), + updatedAt = Value(updatedAt); + static Insertable custom({ + Expression? id, + Expression? projectId, + Expression? title, + Expression? description, + Expression? status, + Expression? orderIndex, + Expression? total, + Expression? completed, + Expression? pct, + Expression? createdAt, + Expression? updatedAt, + Expression? cachedAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (projectId != null) 'project_id': projectId, + if (title != null) 'title': title, + if (description != null) 'description': description, + if (status != null) 'status': status, + if (orderIndex != null) 'order_index': orderIndex, + if (total != null) 'total': total, + if (completed != null) 'completed': completed, + if (pct != null) 'pct': pct, + if (createdAt != null) 'created_at': createdAt, + if (updatedAt != null) 'updated_at': updatedAt, + if (cachedAt != null) 'cached_at': cachedAt, + }); + } + + CachedMilestonesCompanion copyWith({ + Value? id, + Value? projectId, + Value? title, + Value? description, + Value? status, + Value? orderIndex, + Value? total, + Value? completed, + Value? pct, + Value? createdAt, + Value? updatedAt, + Value? cachedAt, + }) { + return CachedMilestonesCompanion( + id: id ?? this.id, + projectId: projectId ?? this.projectId, + title: title ?? this.title, + description: description ?? this.description, + status: status ?? this.status, + orderIndex: orderIndex ?? this.orderIndex, + total: total ?? this.total, + completed: completed ?? this.completed, + pct: pct ?? this.pct, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (projectId.present) { + map['project_id'] = Variable(projectId.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (description.present) { + map['description'] = Variable(description.value); + } + if (status.present) { + map['status'] = Variable(status.value); + } + if (orderIndex.present) { + map['order_index'] = Variable(orderIndex.value); + } + if (total.present) { + map['total'] = Variable(total.value); + } + if (completed.present) { + map['completed'] = Variable(completed.value); + } + if (pct.present) { + map['pct'] = Variable(pct.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (updatedAt.present) { + map['updated_at'] = Variable(updatedAt.value); + } + if (cachedAt.present) { + map['cached_at'] = Variable(cachedAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('CachedMilestonesCompanion(') + ..write('id: $id, ') + ..write('projectId: $projectId, ') + ..write('title: $title, ') + ..write('description: $description, ') + ..write('status: $status, ') + ..write('orderIndex: $orderIndex, ') + ..write('total: $total, ') + ..write('completed: $completed, ') + ..write('pct: $pct, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } +} + +class $CachedCalendarEventsTable extends CachedCalendarEvents + with TableInfo<$CachedCalendarEventsTable, CachedCalendarEvent> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $CachedCalendarEventsTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _titleMeta = const VerificationMeta('title'); + @override + late final GeneratedColumn title = GeneratedColumn( + 'title', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _startDtMeta = const VerificationMeta( + 'startDt', + ); + @override + late final GeneratedColumn startDt = GeneratedColumn( + 'start_dt', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _endDtMeta = const VerificationMeta('endDt'); + @override + late final GeneratedColumn endDt = GeneratedColumn( + 'end_dt', + aliasedName, + true, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + ); + static const VerificationMeta _allDayMeta = const VerificationMeta('allDay'); + @override + late final GeneratedColumn allDay = GeneratedColumn( + 'all_day', + aliasedName, + false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("all_day" IN (0, 1))', + ), + defaultValue: const Constant(false), + ); + static const VerificationMeta _descriptionMeta = const VerificationMeta( + 'description', + ); + @override + late final GeneratedColumn description = GeneratedColumn( + 'description', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant(''), + ); + static const VerificationMeta _locationMeta = const VerificationMeta( + 'location', + ); + @override + late final GeneratedColumn location = GeneratedColumn( + 'location', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant(''), + ); + static const VerificationMeta _colorMeta = const VerificationMeta('color'); + @override + late final GeneratedColumn color = GeneratedColumn( + 'color', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant(''), + ); + static const VerificationMeta _recurrenceMeta = const VerificationMeta( + 'recurrence', + ); + @override + late final GeneratedColumn recurrence = GeneratedColumn( + 'recurrence', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); + static const VerificationMeta _projectIdMeta = const VerificationMeta( + 'projectId', + ); + @override + late final GeneratedColumn projectId = GeneratedColumn( + 'project_id', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _reminderMinutesMeta = const VerificationMeta( + 'reminderMinutes', + ); + @override + late final GeneratedColumn reminderMinutes = GeneratedColumn( + 'reminder_minutes', + aliasedName, + true, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _cachedAtMeta = const VerificationMeta( + 'cachedAt', + ); + @override + late final GeneratedColumn cachedAt = GeneratedColumn( + 'cached_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + clientDefault: () => DateTime.now(), + ); + @override + List get $columns => [ + id, + title, + startDt, + endDt, + allDay, + description, + location, + color, + recurrence, + projectId, + reminderMinutes, + cachedAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'cached_calendar_events'; + @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)); + } + if (data.containsKey('title')) { + context.handle( + _titleMeta, + title.isAcceptableOrUnknown(data['title']!, _titleMeta), + ); + } else if (isInserting) { + context.missing(_titleMeta); + } + if (data.containsKey('start_dt')) { + context.handle( + _startDtMeta, + startDt.isAcceptableOrUnknown(data['start_dt']!, _startDtMeta), + ); + } else if (isInserting) { + context.missing(_startDtMeta); + } + if (data.containsKey('end_dt')) { + context.handle( + _endDtMeta, + endDt.isAcceptableOrUnknown(data['end_dt']!, _endDtMeta), + ); + } + if (data.containsKey('all_day')) { + context.handle( + _allDayMeta, + allDay.isAcceptableOrUnknown(data['all_day']!, _allDayMeta), + ); + } + if (data.containsKey('description')) { + context.handle( + _descriptionMeta, + description.isAcceptableOrUnknown( + data['description']!, + _descriptionMeta, + ), + ); + } + if (data.containsKey('location')) { + context.handle( + _locationMeta, + location.isAcceptableOrUnknown(data['location']!, _locationMeta), + ); + } + if (data.containsKey('color')) { + context.handle( + _colorMeta, + color.isAcceptableOrUnknown(data['color']!, _colorMeta), + ); + } + if (data.containsKey('recurrence')) { + context.handle( + _recurrenceMeta, + recurrence.isAcceptableOrUnknown(data['recurrence']!, _recurrenceMeta), + ); + } + if (data.containsKey('project_id')) { + context.handle( + _projectIdMeta, + projectId.isAcceptableOrUnknown(data['project_id']!, _projectIdMeta), + ); + } + if (data.containsKey('reminder_minutes')) { + context.handle( + _reminderMinutesMeta, + reminderMinutes.isAcceptableOrUnknown( + data['reminder_minutes']!, + _reminderMinutesMeta, + ), + ); + } + if (data.containsKey('cached_at')) { + context.handle( + _cachedAtMeta, + cachedAt.isAcceptableOrUnknown(data['cached_at']!, _cachedAtMeta), + ); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + CachedCalendarEvent map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return CachedCalendarEvent( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + title: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}title'], + )!, + startDt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}start_dt'], + )!, + endDt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}end_dt'], + ), + allDay: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}all_day'], + )!, + description: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}description'], + )!, + location: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}location'], + )!, + color: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}color'], + )!, + recurrence: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}recurrence'], + ), + projectId: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}project_id'], + ), + reminderMinutes: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}reminder_minutes'], + ), + cachedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}cached_at'], + )!, + ); + } + + @override + $CachedCalendarEventsTable createAlias(String alias) { + return $CachedCalendarEventsTable(attachedDatabase, alias); + } +} + +class CachedCalendarEvent extends DataClass + implements Insertable { + final int id; + final String title; + final DateTime startDt; + final DateTime? endDt; + final bool allDay; + final String description; + final String location; + final String color; + final String? recurrence; + final int? projectId; + final int? reminderMinutes; + final DateTime cachedAt; + const CachedCalendarEvent({ + required this.id, + required this.title, + required this.startDt, + this.endDt, + required this.allDay, + required this.description, + required this.location, + required this.color, + this.recurrence, + this.projectId, + this.reminderMinutes, + required this.cachedAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['start_dt'] = Variable(startDt); + if (!nullToAbsent || endDt != null) { + map['end_dt'] = Variable(endDt); + } + map['all_day'] = Variable(allDay); + map['description'] = Variable(description); + map['location'] = Variable(location); + map['color'] = Variable(color); + if (!nullToAbsent || recurrence != null) { + map['recurrence'] = Variable(recurrence); + } + if (!nullToAbsent || projectId != null) { + map['project_id'] = Variable(projectId); + } + if (!nullToAbsent || reminderMinutes != null) { + map['reminder_minutes'] = Variable(reminderMinutes); + } + map['cached_at'] = Variable(cachedAt); + return map; + } + + CachedCalendarEventsCompanion toCompanion(bool nullToAbsent) { + return CachedCalendarEventsCompanion( + id: Value(id), + title: Value(title), + startDt: Value(startDt), + endDt: endDt == null && nullToAbsent + ? const Value.absent() + : Value(endDt), + allDay: Value(allDay), + description: Value(description), + location: Value(location), + color: Value(color), + recurrence: recurrence == null && nullToAbsent + ? const Value.absent() + : Value(recurrence), + projectId: projectId == null && nullToAbsent + ? const Value.absent() + : Value(projectId), + reminderMinutes: reminderMinutes == null && nullToAbsent + ? const Value.absent() + : Value(reminderMinutes), + cachedAt: Value(cachedAt), + ); + } + + factory CachedCalendarEvent.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return CachedCalendarEvent( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + startDt: serializer.fromJson(json['startDt']), + endDt: serializer.fromJson(json['endDt']), + allDay: serializer.fromJson(json['allDay']), + description: serializer.fromJson(json['description']), + location: serializer.fromJson(json['location']), + color: serializer.fromJson(json['color']), + recurrence: serializer.fromJson(json['recurrence']), + projectId: serializer.fromJson(json['projectId']), + reminderMinutes: serializer.fromJson(json['reminderMinutes']), + cachedAt: serializer.fromJson(json['cachedAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'startDt': serializer.toJson(startDt), + 'endDt': serializer.toJson(endDt), + 'allDay': serializer.toJson(allDay), + 'description': serializer.toJson(description), + 'location': serializer.toJson(location), + 'color': serializer.toJson(color), + 'recurrence': serializer.toJson(recurrence), + 'projectId': serializer.toJson(projectId), + 'reminderMinutes': serializer.toJson(reminderMinutes), + 'cachedAt': serializer.toJson(cachedAt), + }; + } + + CachedCalendarEvent copyWith({ + int? id, + String? title, + DateTime? startDt, + Value endDt = const Value.absent(), + bool? allDay, + String? description, + String? location, + String? color, + Value recurrence = const Value.absent(), + Value projectId = const Value.absent(), + Value reminderMinutes = const Value.absent(), + DateTime? cachedAt, + }) => CachedCalendarEvent( + id: id ?? this.id, + title: title ?? this.title, + startDt: startDt ?? this.startDt, + endDt: endDt.present ? endDt.value : this.endDt, + allDay: allDay ?? this.allDay, + description: description ?? this.description, + location: location ?? this.location, + color: color ?? this.color, + recurrence: recurrence.present ? recurrence.value : this.recurrence, + projectId: projectId.present ? projectId.value : this.projectId, + reminderMinutes: reminderMinutes.present + ? reminderMinutes.value + : this.reminderMinutes, + cachedAt: cachedAt ?? this.cachedAt, + ); + CachedCalendarEvent copyWithCompanion(CachedCalendarEventsCompanion data) { + return CachedCalendarEvent( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + startDt: data.startDt.present ? data.startDt.value : this.startDt, + endDt: data.endDt.present ? data.endDt.value : this.endDt, + allDay: data.allDay.present ? data.allDay.value : this.allDay, + description: data.description.present + ? data.description.value + : this.description, + location: data.location.present ? data.location.value : this.location, + color: data.color.present ? data.color.value : this.color, + recurrence: data.recurrence.present + ? data.recurrence.value + : this.recurrence, + projectId: data.projectId.present ? data.projectId.value : this.projectId, + reminderMinutes: data.reminderMinutes.present + ? data.reminderMinutes.value + : this.reminderMinutes, + cachedAt: data.cachedAt.present ? data.cachedAt.value : this.cachedAt, + ); + } + + @override + String toString() { + return (StringBuffer('CachedCalendarEvent(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('startDt: $startDt, ') + ..write('endDt: $endDt, ') + ..write('allDay: $allDay, ') + ..write('description: $description, ') + ..write('location: $location, ') + ..write('color: $color, ') + ..write('recurrence: $recurrence, ') + ..write('projectId: $projectId, ') + ..write('reminderMinutes: $reminderMinutes, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + title, + startDt, + endDt, + allDay, + description, + location, + color, + recurrence, + projectId, + reminderMinutes, + cachedAt, + ); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is CachedCalendarEvent && + other.id == this.id && + other.title == this.title && + other.startDt == this.startDt && + other.endDt == this.endDt && + other.allDay == this.allDay && + other.description == this.description && + other.location == this.location && + other.color == this.color && + other.recurrence == this.recurrence && + other.projectId == this.projectId && + other.reminderMinutes == this.reminderMinutes && + other.cachedAt == this.cachedAt); +} + +class CachedCalendarEventsCompanion + extends UpdateCompanion { + final Value id; + final Value title; + final Value startDt; + final Value endDt; + final Value allDay; + final Value description; + final Value location; + final Value color; + final Value recurrence; + final Value projectId; + final Value reminderMinutes; + final Value cachedAt; + const CachedCalendarEventsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.startDt = const Value.absent(), + this.endDt = const Value.absent(), + this.allDay = const Value.absent(), + this.description = const Value.absent(), + this.location = const Value.absent(), + this.color = const Value.absent(), + this.recurrence = const Value.absent(), + this.projectId = const Value.absent(), + this.reminderMinutes = const Value.absent(), + this.cachedAt = const Value.absent(), + }); + CachedCalendarEventsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required DateTime startDt, + this.endDt = const Value.absent(), + this.allDay = const Value.absent(), + this.description = const Value.absent(), + this.location = const Value.absent(), + this.color = const Value.absent(), + this.recurrence = const Value.absent(), + this.projectId = const Value.absent(), + this.reminderMinutes = const Value.absent(), + this.cachedAt = const Value.absent(), + }) : title = Value(title), + startDt = Value(startDt); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? startDt, + Expression? endDt, + Expression? allDay, + Expression? description, + Expression? location, + Expression? color, + Expression? recurrence, + Expression? projectId, + Expression? reminderMinutes, + Expression? cachedAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (startDt != null) 'start_dt': startDt, + if (endDt != null) 'end_dt': endDt, + if (allDay != null) 'all_day': allDay, + if (description != null) 'description': description, + if (location != null) 'location': location, + if (color != null) 'color': color, + if (recurrence != null) 'recurrence': recurrence, + if (projectId != null) 'project_id': projectId, + if (reminderMinutes != null) 'reminder_minutes': reminderMinutes, + if (cachedAt != null) 'cached_at': cachedAt, + }); + } + + CachedCalendarEventsCompanion copyWith({ + Value? id, + Value? title, + Value? startDt, + Value? endDt, + Value? allDay, + Value? description, + Value? location, + Value? color, + Value? recurrence, + Value? projectId, + Value? reminderMinutes, + Value? cachedAt, + }) { + return CachedCalendarEventsCompanion( + id: id ?? this.id, + title: title ?? this.title, + startDt: startDt ?? this.startDt, + endDt: endDt ?? this.endDt, + allDay: allDay ?? this.allDay, + description: description ?? this.description, + location: location ?? this.location, + color: color ?? this.color, + recurrence: recurrence ?? this.recurrence, + projectId: projectId ?? this.projectId, + reminderMinutes: reminderMinutes ?? this.reminderMinutes, + cachedAt: cachedAt ?? this.cachedAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (startDt.present) { + map['start_dt'] = Variable(startDt.value); + } + if (endDt.present) { + map['end_dt'] = Variable(endDt.value); + } + if (allDay.present) { + map['all_day'] = Variable(allDay.value); + } + if (description.present) { + map['description'] = Variable(description.value); + } + if (location.present) { + map['location'] = Variable(location.value); + } + if (color.present) { + map['color'] = Variable(color.value); + } + if (recurrence.present) { + map['recurrence'] = Variable(recurrence.value); + } + if (projectId.present) { + map['project_id'] = Variable(projectId.value); + } + if (reminderMinutes.present) { + map['reminder_minutes'] = Variable(reminderMinutes.value); + } + if (cachedAt.present) { + map['cached_at'] = Variable(cachedAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('CachedCalendarEventsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('startDt: $startDt, ') + ..write('endDt: $endDt, ') + ..write('allDay: $allDay, ') + ..write('description: $description, ') + ..write('location: $location, ') + ..write('color: $color, ') + ..write('recurrence: $recurrence, ') + ..write('projectId: $projectId, ') + ..write('reminderMinutes: $reminderMinutes, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } +} + +class $CachedConversationsTable extends CachedConversations + with TableInfo<$CachedConversationsTable, CachedConversation> { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + $CachedConversationsTable(this.attachedDatabase, [this._alias]); + static const VerificationMeta _idMeta = const VerificationMeta('id'); + @override + late final GeneratedColumn id = GeneratedColumn( + 'id', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + ); + static const VerificationMeta _titleMeta = const VerificationMeta('title'); + @override + late final GeneratedColumn title = GeneratedColumn( + 'title', + aliasedName, + false, + type: DriftSqlType.string, + requiredDuringInsert: true, + ); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); + @override + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _updatedAtMeta = const VerificationMeta( + 'updatedAt', + ); + @override + late final GeneratedColumn updatedAt = GeneratedColumn( + 'updated_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: true, + ); + static const VerificationMeta _cachedAtMeta = const VerificationMeta( + 'cachedAt', + ); + @override + late final GeneratedColumn cachedAt = GeneratedColumn( + 'cached_at', + aliasedName, + false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + clientDefault: () => DateTime.now(), + ); + @override + List get $columns => [ + id, + title, + createdAt, + updatedAt, + cachedAt, + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'cached_conversations'; + @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)); + } + if (data.containsKey('title')) { + context.handle( + _titleMeta, + title.isAcceptableOrUnknown(data['title']!, _titleMeta), + ); + } else if (isInserting) { + context.missing(_titleMeta); + } + if (data.containsKey('created_at')) { + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); + } else if (isInserting) { + context.missing(_createdAtMeta); + } + if (data.containsKey('updated_at')) { + context.handle( + _updatedAtMeta, + updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta), + ); + } else if (isInserting) { + context.missing(_updatedAtMeta); + } + if (data.containsKey('cached_at')) { + context.handle( + _cachedAtMeta, + cachedAt.isAcceptableOrUnknown(data['cached_at']!, _cachedAtMeta), + ); + } + return context; + } + + @override + Set get $primaryKey => {id}; + @override + CachedConversation map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return CachedConversation( + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + title: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}title'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}created_at'], + )!, + updatedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}updated_at'], + )!, + cachedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}cached_at'], + )!, + ); + } + + @override + $CachedConversationsTable createAlias(String alias) { + return $CachedConversationsTable(attachedDatabase, alias); + } +} + +class CachedConversation extends DataClass + implements Insertable { + final int id; + final String title; + final DateTime createdAt; + final DateTime updatedAt; + final DateTime cachedAt; + const CachedConversation({ + required this.id, + required this.title, + required this.createdAt, + required this.updatedAt, + required this.cachedAt, + }); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['title'] = Variable(title); + map['created_at'] = Variable(createdAt); + map['updated_at'] = Variable(updatedAt); + map['cached_at'] = Variable(cachedAt); + return map; + } + + CachedConversationsCompanion toCompanion(bool nullToAbsent) { + return CachedConversationsCompanion( + id: Value(id), + title: Value(title), + createdAt: Value(createdAt), + updatedAt: Value(updatedAt), + cachedAt: Value(cachedAt), + ); + } + + factory CachedConversation.fromJson( + Map json, { + ValueSerializer? serializer, + }) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return CachedConversation( + id: serializer.fromJson(json['id']), + title: serializer.fromJson(json['title']), + createdAt: serializer.fromJson(json['createdAt']), + updatedAt: serializer.fromJson(json['updatedAt']), + cachedAt: serializer.fromJson(json['cachedAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'title': serializer.toJson(title), + 'createdAt': serializer.toJson(createdAt), + 'updatedAt': serializer.toJson(updatedAt), + 'cachedAt': serializer.toJson(cachedAt), + }; + } + + CachedConversation copyWith({ + int? id, + String? title, + DateTime? createdAt, + DateTime? updatedAt, + DateTime? cachedAt, + }) => CachedConversation( + id: id ?? this.id, + title: title ?? this.title, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + CachedConversation copyWithCompanion(CachedConversationsCompanion data) { + return CachedConversation( + id: data.id.present ? data.id.value : this.id, + title: data.title.present ? data.title.value : this.title, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt, + cachedAt: data.cachedAt.present ? data.cachedAt.value : this.cachedAt, + ); + } + + @override + String toString() { + return (StringBuffer('CachedConversation(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, title, createdAt, updatedAt, cachedAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is CachedConversation && + other.id == this.id && + other.title == this.title && + other.createdAt == this.createdAt && + other.updatedAt == this.updatedAt && + other.cachedAt == this.cachedAt); +} + +class CachedConversationsCompanion extends UpdateCompanion { + final Value id; + final Value title; + final Value createdAt; + final Value updatedAt; + final Value cachedAt; + const CachedConversationsCompanion({ + this.id = const Value.absent(), + this.title = const Value.absent(), + this.createdAt = const Value.absent(), + this.updatedAt = const Value.absent(), + this.cachedAt = const Value.absent(), + }); + CachedConversationsCompanion.insert({ + this.id = const Value.absent(), + required String title, + required DateTime createdAt, + required DateTime updatedAt, + this.cachedAt = const Value.absent(), + }) : title = Value(title), + createdAt = Value(createdAt), + updatedAt = Value(updatedAt); + static Insertable custom({ + Expression? id, + Expression? title, + Expression? createdAt, + Expression? updatedAt, + Expression? cachedAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (createdAt != null) 'created_at': createdAt, + if (updatedAt != null) 'updated_at': updatedAt, + if (cachedAt != null) 'cached_at': cachedAt, + }); + } + + CachedConversationsCompanion copyWith({ + Value? id, + Value? title, + Value? createdAt, + Value? updatedAt, + Value? cachedAt, + }) { + return CachedConversationsCompanion( + id: id ?? this.id, + title: title ?? this.title, + createdAt: createdAt ?? this.createdAt, + updatedAt: updatedAt ?? this.updatedAt, + cachedAt: cachedAt ?? this.cachedAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (title.present) { + map['title'] = Variable(title.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (updatedAt.present) { + map['updated_at'] = Variable(updatedAt.value); + } + if (cachedAt.present) { + map['cached_at'] = Variable(cachedAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('CachedConversationsCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('createdAt: $createdAt, ') + ..write('updatedAt: $updatedAt, ') + ..write('cachedAt: $cachedAt') + ..write(')')) + .toString(); + } +} + class $SyncMetadataTable extends SyncMetadata with TableInfo<$SyncMetadataTable, SyncMetadataData> { @override @@ -820,6 +3835,15 @@ abstract class _$FabledDatabase extends GeneratedDatabase { _$FabledDatabase(QueryExecutor e) : super(e); $FabledDatabaseManager get managers => $FabledDatabaseManager(this); late final $CachedNotesTable cachedNotes = $CachedNotesTable(this); + late final $CachedTasksTable cachedTasks = $CachedTasksTable(this); + late final $CachedProjectsTable cachedProjects = $CachedProjectsTable(this); + late final $CachedMilestonesTable cachedMilestones = $CachedMilestonesTable( + this, + ); + late final $CachedCalendarEventsTable cachedCalendarEvents = + $CachedCalendarEventsTable(this); + late final $CachedConversationsTable cachedConversations = + $CachedConversationsTable(this); late final $SyncMetadataTable syncMetadata = $SyncMetadataTable(this); @override Iterable> get allTables => @@ -827,6 +3851,11 @@ abstract class _$FabledDatabase extends GeneratedDatabase { @override List get allSchemaEntities => [ cachedNotes, + cachedTasks, + cachedProjects, + cachedMilestones, + cachedCalendarEvents, + cachedConversations, syncMetadata, ]; } @@ -1122,6 +4151,1536 @@ typedef $$CachedNotesTableProcessedTableManager = CachedNote, PrefetchHooks Function() >; +typedef $$CachedTasksTableCreateCompanionBuilder = + CachedTasksCompanion Function({ + Value id, + required String title, + Value description, + required String status, + required String priority, + Value dueDate, + Value projectId, + Value milestoneId, + Value parentId, + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt, + }); +typedef $$CachedTasksTableUpdateCompanionBuilder = + CachedTasksCompanion Function({ + Value id, + Value title, + Value description, + Value status, + Value priority, + Value dueDate, + Value projectId, + Value milestoneId, + Value parentId, + Value createdAt, + Value updatedAt, + Value cachedAt, + }); + +class $$CachedTasksTableFilterComposer + extends Composer<_$FabledDatabase, $CachedTasksTable> { + $$CachedTasksTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get priority => $composableBuilder( + column: $table.priority, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get dueDate => $composableBuilder( + column: $table.dueDate, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get projectId => $composableBuilder( + column: $table.projectId, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get milestoneId => $composableBuilder( + column: $table.milestoneId, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get parentId => $composableBuilder( + column: $table.parentId, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnFilters(column), + ); +} + +class $$CachedTasksTableOrderingComposer + extends Composer<_$FabledDatabase, $CachedTasksTable> { + $$CachedTasksTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get priority => $composableBuilder( + column: $table.priority, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get dueDate => $composableBuilder( + column: $table.dueDate, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get projectId => $composableBuilder( + column: $table.projectId, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get milestoneId => $composableBuilder( + column: $table.milestoneId, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get parentId => $composableBuilder( + column: $table.parentId, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnOrderings(column), + ); +} + +class $$CachedTasksTableAnnotationComposer + extends Composer<_$FabledDatabase, $CachedTasksTable> { + $$CachedTasksTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get description => $composableBuilder( + column: $table.description, + builder: (column) => column, + ); + + GeneratedColumn get status => + $composableBuilder(column: $table.status, builder: (column) => column); + + GeneratedColumn get priority => + $composableBuilder(column: $table.priority, builder: (column) => column); + + GeneratedColumn get dueDate => + $composableBuilder(column: $table.dueDate, builder: (column) => column); + + GeneratedColumn get projectId => + $composableBuilder(column: $table.projectId, builder: (column) => column); + + GeneratedColumn get milestoneId => $composableBuilder( + column: $table.milestoneId, + builder: (column) => column, + ); + + GeneratedColumn get parentId => + $composableBuilder(column: $table.parentId, builder: (column) => column); + + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); + + GeneratedColumn get updatedAt => + $composableBuilder(column: $table.updatedAt, builder: (column) => column); + + GeneratedColumn get cachedAt => + $composableBuilder(column: $table.cachedAt, builder: (column) => column); +} + +class $$CachedTasksTableTableManager + extends + RootTableManager< + _$FabledDatabase, + $CachedTasksTable, + CachedTask, + $$CachedTasksTableFilterComposer, + $$CachedTasksTableOrderingComposer, + $$CachedTasksTableAnnotationComposer, + $$CachedTasksTableCreateCompanionBuilder, + $$CachedTasksTableUpdateCompanionBuilder, + ( + CachedTask, + BaseReferences<_$FabledDatabase, $CachedTasksTable, CachedTask>, + ), + CachedTask, + PrefetchHooks Function() + > { + $$CachedTasksTableTableManager(_$FabledDatabase db, $CachedTasksTable table) + : super( + TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$CachedTasksTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CachedTasksTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$CachedTasksTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: + ({ + Value id = const Value.absent(), + Value title = const Value.absent(), + Value description = const Value.absent(), + Value status = const Value.absent(), + Value priority = const Value.absent(), + Value dueDate = const Value.absent(), + Value projectId = const Value.absent(), + Value milestoneId = const Value.absent(), + Value parentId = const Value.absent(), + Value createdAt = const Value.absent(), + Value updatedAt = const Value.absent(), + Value cachedAt = const Value.absent(), + }) => CachedTasksCompanion( + id: id, + title: title, + description: description, + status: status, + priority: priority, + dueDate: dueDate, + projectId: projectId, + milestoneId: milestoneId, + parentId: parentId, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + createCompanionCallback: + ({ + Value id = const Value.absent(), + required String title, + Value description = const Value.absent(), + required String status, + required String priority, + Value dueDate = const Value.absent(), + Value projectId = const Value.absent(), + Value milestoneId = const Value.absent(), + Value parentId = const Value.absent(), + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt = const Value.absent(), + }) => CachedTasksCompanion.insert( + id: id, + title: title, + description: description, + status: status, + priority: priority, + dueDate: dueDate, + projectId: projectId, + milestoneId: milestoneId, + parentId: parentId, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + ), + ); +} + +typedef $$CachedTasksTableProcessedTableManager = + ProcessedTableManager< + _$FabledDatabase, + $CachedTasksTable, + CachedTask, + $$CachedTasksTableFilterComposer, + $$CachedTasksTableOrderingComposer, + $$CachedTasksTableAnnotationComposer, + $$CachedTasksTableCreateCompanionBuilder, + $$CachedTasksTableUpdateCompanionBuilder, + ( + CachedTask, + BaseReferences<_$FabledDatabase, $CachedTasksTable, CachedTask>, + ), + CachedTask, + PrefetchHooks Function() + >; +typedef $$CachedProjectsTableCreateCompanionBuilder = + CachedProjectsCompanion Function({ + Value id, + required String title, + Value description, + Value goal, + required String status, + Value color, + Value autoSummary, + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt, + }); +typedef $$CachedProjectsTableUpdateCompanionBuilder = + CachedProjectsCompanion Function({ + Value id, + Value title, + Value description, + Value goal, + Value status, + Value color, + Value autoSummary, + Value createdAt, + Value updatedAt, + Value cachedAt, + }); + +class $$CachedProjectsTableFilterComposer + extends Composer<_$FabledDatabase, $CachedProjectsTable> { + $$CachedProjectsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get goal => $composableBuilder( + column: $table.goal, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get color => $composableBuilder( + column: $table.color, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get autoSummary => $composableBuilder( + column: $table.autoSummary, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnFilters(column), + ); +} + +class $$CachedProjectsTableOrderingComposer + extends Composer<_$FabledDatabase, $CachedProjectsTable> { + $$CachedProjectsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get goal => $composableBuilder( + column: $table.goal, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get color => $composableBuilder( + column: $table.color, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get autoSummary => $composableBuilder( + column: $table.autoSummary, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnOrderings(column), + ); +} + +class $$CachedProjectsTableAnnotationComposer + extends Composer<_$FabledDatabase, $CachedProjectsTable> { + $$CachedProjectsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get description => $composableBuilder( + column: $table.description, + builder: (column) => column, + ); + + GeneratedColumn get goal => + $composableBuilder(column: $table.goal, builder: (column) => column); + + GeneratedColumn get status => + $composableBuilder(column: $table.status, builder: (column) => column); + + GeneratedColumn get color => + $composableBuilder(column: $table.color, builder: (column) => column); + + GeneratedColumn get autoSummary => $composableBuilder( + column: $table.autoSummary, + builder: (column) => column, + ); + + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); + + GeneratedColumn get updatedAt => + $composableBuilder(column: $table.updatedAt, builder: (column) => column); + + GeneratedColumn get cachedAt => + $composableBuilder(column: $table.cachedAt, builder: (column) => column); +} + +class $$CachedProjectsTableTableManager + extends + RootTableManager< + _$FabledDatabase, + $CachedProjectsTable, + CachedProject, + $$CachedProjectsTableFilterComposer, + $$CachedProjectsTableOrderingComposer, + $$CachedProjectsTableAnnotationComposer, + $$CachedProjectsTableCreateCompanionBuilder, + $$CachedProjectsTableUpdateCompanionBuilder, + ( + CachedProject, + BaseReferences< + _$FabledDatabase, + $CachedProjectsTable, + CachedProject + >, + ), + CachedProject, + PrefetchHooks Function() + > { + $$CachedProjectsTableTableManager( + _$FabledDatabase db, + $CachedProjectsTable table, + ) : super( + TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$CachedProjectsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CachedProjectsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$CachedProjectsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: + ({ + Value id = const Value.absent(), + Value title = const Value.absent(), + Value description = const Value.absent(), + Value goal = const Value.absent(), + Value status = const Value.absent(), + Value color = const Value.absent(), + Value autoSummary = const Value.absent(), + Value createdAt = const Value.absent(), + Value updatedAt = const Value.absent(), + Value cachedAt = const Value.absent(), + }) => CachedProjectsCompanion( + id: id, + title: title, + description: description, + goal: goal, + status: status, + color: color, + autoSummary: autoSummary, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + createCompanionCallback: + ({ + Value id = const Value.absent(), + required String title, + Value description = const Value.absent(), + Value goal = const Value.absent(), + required String status, + Value color = const Value.absent(), + Value autoSummary = const Value.absent(), + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt = const Value.absent(), + }) => CachedProjectsCompanion.insert( + id: id, + title: title, + description: description, + goal: goal, + status: status, + color: color, + autoSummary: autoSummary, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + ), + ); +} + +typedef $$CachedProjectsTableProcessedTableManager = + ProcessedTableManager< + _$FabledDatabase, + $CachedProjectsTable, + CachedProject, + $$CachedProjectsTableFilterComposer, + $$CachedProjectsTableOrderingComposer, + $$CachedProjectsTableAnnotationComposer, + $$CachedProjectsTableCreateCompanionBuilder, + $$CachedProjectsTableUpdateCompanionBuilder, + ( + CachedProject, + BaseReferences<_$FabledDatabase, $CachedProjectsTable, CachedProject>, + ), + CachedProject, + PrefetchHooks Function() + >; +typedef $$CachedMilestonesTableCreateCompanionBuilder = + CachedMilestonesCompanion Function({ + Value id, + required int projectId, + required String title, + Value description, + required String status, + Value orderIndex, + Value total, + Value completed, + Value pct, + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt, + }); +typedef $$CachedMilestonesTableUpdateCompanionBuilder = + CachedMilestonesCompanion Function({ + Value id, + Value projectId, + Value title, + Value description, + Value status, + Value orderIndex, + Value total, + Value completed, + Value pct, + Value createdAt, + Value updatedAt, + Value cachedAt, + }); + +class $$CachedMilestonesTableFilterComposer + extends Composer<_$FabledDatabase, $CachedMilestonesTable> { + $$CachedMilestonesTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get projectId => $composableBuilder( + column: $table.projectId, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get orderIndex => $composableBuilder( + column: $table.orderIndex, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get total => $composableBuilder( + column: $table.total, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get completed => $composableBuilder( + column: $table.completed, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get pct => $composableBuilder( + column: $table.pct, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnFilters(column), + ); +} + +class $$CachedMilestonesTableOrderingComposer + extends Composer<_$FabledDatabase, $CachedMilestonesTable> { + $$CachedMilestonesTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get projectId => $composableBuilder( + column: $table.projectId, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get orderIndex => $composableBuilder( + column: $table.orderIndex, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get total => $composableBuilder( + column: $table.total, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get completed => $composableBuilder( + column: $table.completed, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get pct => $composableBuilder( + column: $table.pct, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnOrderings(column), + ); +} + +class $$CachedMilestonesTableAnnotationComposer + extends Composer<_$FabledDatabase, $CachedMilestonesTable> { + $$CachedMilestonesTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get projectId => + $composableBuilder(column: $table.projectId, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get description => $composableBuilder( + column: $table.description, + builder: (column) => column, + ); + + GeneratedColumn get status => + $composableBuilder(column: $table.status, builder: (column) => column); + + GeneratedColumn get orderIndex => $composableBuilder( + column: $table.orderIndex, + builder: (column) => column, + ); + + GeneratedColumn get total => + $composableBuilder(column: $table.total, builder: (column) => column); + + GeneratedColumn get completed => + $composableBuilder(column: $table.completed, builder: (column) => column); + + GeneratedColumn get pct => + $composableBuilder(column: $table.pct, builder: (column) => column); + + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); + + GeneratedColumn get updatedAt => + $composableBuilder(column: $table.updatedAt, builder: (column) => column); + + GeneratedColumn get cachedAt => + $composableBuilder(column: $table.cachedAt, builder: (column) => column); +} + +class $$CachedMilestonesTableTableManager + extends + RootTableManager< + _$FabledDatabase, + $CachedMilestonesTable, + CachedMilestone, + $$CachedMilestonesTableFilterComposer, + $$CachedMilestonesTableOrderingComposer, + $$CachedMilestonesTableAnnotationComposer, + $$CachedMilestonesTableCreateCompanionBuilder, + $$CachedMilestonesTableUpdateCompanionBuilder, + ( + CachedMilestone, + BaseReferences< + _$FabledDatabase, + $CachedMilestonesTable, + CachedMilestone + >, + ), + CachedMilestone, + PrefetchHooks Function() + > { + $$CachedMilestonesTableTableManager( + _$FabledDatabase db, + $CachedMilestonesTable table, + ) : super( + TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$CachedMilestonesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CachedMilestonesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$CachedMilestonesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: + ({ + Value id = const Value.absent(), + Value projectId = const Value.absent(), + Value title = const Value.absent(), + Value description = const Value.absent(), + Value status = const Value.absent(), + Value orderIndex = const Value.absent(), + Value total = const Value.absent(), + Value completed = const Value.absent(), + Value pct = const Value.absent(), + Value createdAt = const Value.absent(), + Value updatedAt = const Value.absent(), + Value cachedAt = const Value.absent(), + }) => CachedMilestonesCompanion( + id: id, + projectId: projectId, + title: title, + description: description, + status: status, + orderIndex: orderIndex, + total: total, + completed: completed, + pct: pct, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + createCompanionCallback: + ({ + Value id = const Value.absent(), + required int projectId, + required String title, + Value description = const Value.absent(), + required String status, + Value orderIndex = const Value.absent(), + Value total = const Value.absent(), + Value completed = const Value.absent(), + Value pct = const Value.absent(), + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt = const Value.absent(), + }) => CachedMilestonesCompanion.insert( + id: id, + projectId: projectId, + title: title, + description: description, + status: status, + orderIndex: orderIndex, + total: total, + completed: completed, + pct: pct, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + ), + ); +} + +typedef $$CachedMilestonesTableProcessedTableManager = + ProcessedTableManager< + _$FabledDatabase, + $CachedMilestonesTable, + CachedMilestone, + $$CachedMilestonesTableFilterComposer, + $$CachedMilestonesTableOrderingComposer, + $$CachedMilestonesTableAnnotationComposer, + $$CachedMilestonesTableCreateCompanionBuilder, + $$CachedMilestonesTableUpdateCompanionBuilder, + ( + CachedMilestone, + BaseReferences< + _$FabledDatabase, + $CachedMilestonesTable, + CachedMilestone + >, + ), + CachedMilestone, + PrefetchHooks Function() + >; +typedef $$CachedCalendarEventsTableCreateCompanionBuilder = + CachedCalendarEventsCompanion Function({ + Value id, + required String title, + required DateTime startDt, + Value endDt, + Value allDay, + Value description, + Value location, + Value color, + Value recurrence, + Value projectId, + Value reminderMinutes, + Value cachedAt, + }); +typedef $$CachedCalendarEventsTableUpdateCompanionBuilder = + CachedCalendarEventsCompanion Function({ + Value id, + Value title, + Value startDt, + Value endDt, + Value allDay, + Value description, + Value location, + Value color, + Value recurrence, + Value projectId, + Value reminderMinutes, + Value cachedAt, + }); + +class $$CachedCalendarEventsTableFilterComposer + extends Composer<_$FabledDatabase, $CachedCalendarEventsTable> { + $$CachedCalendarEventsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get startDt => $composableBuilder( + column: $table.startDt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get endDt => $composableBuilder( + column: $table.endDt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get allDay => $composableBuilder( + column: $table.allDay, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get location => $composableBuilder( + column: $table.location, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get color => $composableBuilder( + column: $table.color, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get recurrence => $composableBuilder( + column: $table.recurrence, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get projectId => $composableBuilder( + column: $table.projectId, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get reminderMinutes => $composableBuilder( + column: $table.reminderMinutes, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnFilters(column), + ); +} + +class $$CachedCalendarEventsTableOrderingComposer + extends Composer<_$FabledDatabase, $CachedCalendarEventsTable> { + $$CachedCalendarEventsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get startDt => $composableBuilder( + column: $table.startDt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get endDt => $composableBuilder( + column: $table.endDt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get allDay => $composableBuilder( + column: $table.allDay, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get description => $composableBuilder( + column: $table.description, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get location => $composableBuilder( + column: $table.location, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get color => $composableBuilder( + column: $table.color, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get recurrence => $composableBuilder( + column: $table.recurrence, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get projectId => $composableBuilder( + column: $table.projectId, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get reminderMinutes => $composableBuilder( + column: $table.reminderMinutes, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnOrderings(column), + ); +} + +class $$CachedCalendarEventsTableAnnotationComposer + extends Composer<_$FabledDatabase, $CachedCalendarEventsTable> { + $$CachedCalendarEventsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get startDt => + $composableBuilder(column: $table.startDt, builder: (column) => column); + + GeneratedColumn get endDt => + $composableBuilder(column: $table.endDt, builder: (column) => column); + + GeneratedColumn get allDay => + $composableBuilder(column: $table.allDay, builder: (column) => column); + + GeneratedColumn get description => $composableBuilder( + column: $table.description, + builder: (column) => column, + ); + + GeneratedColumn get location => + $composableBuilder(column: $table.location, builder: (column) => column); + + GeneratedColumn get color => + $composableBuilder(column: $table.color, builder: (column) => column); + + GeneratedColumn get recurrence => $composableBuilder( + column: $table.recurrence, + builder: (column) => column, + ); + + GeneratedColumn get projectId => + $composableBuilder(column: $table.projectId, builder: (column) => column); + + GeneratedColumn get reminderMinutes => $composableBuilder( + column: $table.reminderMinutes, + builder: (column) => column, + ); + + GeneratedColumn get cachedAt => + $composableBuilder(column: $table.cachedAt, builder: (column) => column); +} + +class $$CachedCalendarEventsTableTableManager + extends + RootTableManager< + _$FabledDatabase, + $CachedCalendarEventsTable, + CachedCalendarEvent, + $$CachedCalendarEventsTableFilterComposer, + $$CachedCalendarEventsTableOrderingComposer, + $$CachedCalendarEventsTableAnnotationComposer, + $$CachedCalendarEventsTableCreateCompanionBuilder, + $$CachedCalendarEventsTableUpdateCompanionBuilder, + ( + CachedCalendarEvent, + BaseReferences< + _$FabledDatabase, + $CachedCalendarEventsTable, + CachedCalendarEvent + >, + ), + CachedCalendarEvent, + PrefetchHooks Function() + > { + $$CachedCalendarEventsTableTableManager( + _$FabledDatabase db, + $CachedCalendarEventsTable table, + ) : super( + TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$CachedCalendarEventsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CachedCalendarEventsTableOrderingComposer( + $db: db, + $table: table, + ), + createComputedFieldComposer: () => + $$CachedCalendarEventsTableAnnotationComposer( + $db: db, + $table: table, + ), + updateCompanionCallback: + ({ + Value id = const Value.absent(), + Value title = const Value.absent(), + Value startDt = const Value.absent(), + Value endDt = const Value.absent(), + Value allDay = const Value.absent(), + Value description = const Value.absent(), + Value location = const Value.absent(), + Value color = const Value.absent(), + Value recurrence = const Value.absent(), + Value projectId = const Value.absent(), + Value reminderMinutes = const Value.absent(), + Value cachedAt = const Value.absent(), + }) => CachedCalendarEventsCompanion( + id: id, + title: title, + startDt: startDt, + endDt: endDt, + allDay: allDay, + description: description, + location: location, + color: color, + recurrence: recurrence, + projectId: projectId, + reminderMinutes: reminderMinutes, + cachedAt: cachedAt, + ), + createCompanionCallback: + ({ + Value id = const Value.absent(), + required String title, + required DateTime startDt, + Value endDt = const Value.absent(), + Value allDay = const Value.absent(), + Value description = const Value.absent(), + Value location = const Value.absent(), + Value color = const Value.absent(), + Value recurrence = const Value.absent(), + Value projectId = const Value.absent(), + Value reminderMinutes = const Value.absent(), + Value cachedAt = const Value.absent(), + }) => CachedCalendarEventsCompanion.insert( + id: id, + title: title, + startDt: startDt, + endDt: endDt, + allDay: allDay, + description: description, + location: location, + color: color, + recurrence: recurrence, + projectId: projectId, + reminderMinutes: reminderMinutes, + cachedAt: cachedAt, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + ), + ); +} + +typedef $$CachedCalendarEventsTableProcessedTableManager = + ProcessedTableManager< + _$FabledDatabase, + $CachedCalendarEventsTable, + CachedCalendarEvent, + $$CachedCalendarEventsTableFilterComposer, + $$CachedCalendarEventsTableOrderingComposer, + $$CachedCalendarEventsTableAnnotationComposer, + $$CachedCalendarEventsTableCreateCompanionBuilder, + $$CachedCalendarEventsTableUpdateCompanionBuilder, + ( + CachedCalendarEvent, + BaseReferences< + _$FabledDatabase, + $CachedCalendarEventsTable, + CachedCalendarEvent + >, + ), + CachedCalendarEvent, + PrefetchHooks Function() + >; +typedef $$CachedConversationsTableCreateCompanionBuilder = + CachedConversationsCompanion Function({ + Value id, + required String title, + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt, + }); +typedef $$CachedConversationsTableUpdateCompanionBuilder = + CachedConversationsCompanion Function({ + Value id, + Value title, + Value createdAt, + Value updatedAt, + Value cachedAt, + }); + +class $$CachedConversationsTableFilterComposer + extends Composer<_$FabledDatabase, $CachedConversationsTable> { + $$CachedConversationsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnFilters(column), + ); + + ColumnFilters get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnFilters(column), + ); +} + +class $$CachedConversationsTableOrderingComposer + extends Composer<_$FabledDatabase, $CachedConversationsTable> { + $$CachedConversationsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get title => $composableBuilder( + column: $table.title, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnOrderings(column), + ); + + ColumnOrderings get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnOrderings(column), + ); +} + +class $$CachedConversationsTableAnnotationComposer + extends Composer<_$FabledDatabase, $CachedConversationsTable> { + $$CachedConversationsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); + + GeneratedColumn get updatedAt => + $composableBuilder(column: $table.updatedAt, builder: (column) => column); + + GeneratedColumn get cachedAt => + $composableBuilder(column: $table.cachedAt, builder: (column) => column); +} + +class $$CachedConversationsTableTableManager + extends + RootTableManager< + _$FabledDatabase, + $CachedConversationsTable, + CachedConversation, + $$CachedConversationsTableFilterComposer, + $$CachedConversationsTableOrderingComposer, + $$CachedConversationsTableAnnotationComposer, + $$CachedConversationsTableCreateCompanionBuilder, + $$CachedConversationsTableUpdateCompanionBuilder, + ( + CachedConversation, + BaseReferences< + _$FabledDatabase, + $CachedConversationsTable, + CachedConversation + >, + ), + CachedConversation, + PrefetchHooks Function() + > { + $$CachedConversationsTableTableManager( + _$FabledDatabase db, + $CachedConversationsTable table, + ) : super( + TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + $$CachedConversationsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$CachedConversationsTableOrderingComposer( + $db: db, + $table: table, + ), + createComputedFieldComposer: () => + $$CachedConversationsTableAnnotationComposer( + $db: db, + $table: table, + ), + updateCompanionCallback: + ({ + Value id = const Value.absent(), + Value title = const Value.absent(), + Value createdAt = const Value.absent(), + Value updatedAt = const Value.absent(), + Value cachedAt = const Value.absent(), + }) => CachedConversationsCompanion( + id: id, + title: title, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + createCompanionCallback: + ({ + Value id = const Value.absent(), + required String title, + required DateTime createdAt, + required DateTime updatedAt, + Value cachedAt = const Value.absent(), + }) => CachedConversationsCompanion.insert( + id: id, + title: title, + createdAt: createdAt, + updatedAt: updatedAt, + cachedAt: cachedAt, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + ), + ); +} + +typedef $$CachedConversationsTableProcessedTableManager = + ProcessedTableManager< + _$FabledDatabase, + $CachedConversationsTable, + CachedConversation, + $$CachedConversationsTableFilterComposer, + $$CachedConversationsTableOrderingComposer, + $$CachedConversationsTableAnnotationComposer, + $$CachedConversationsTableCreateCompanionBuilder, + $$CachedConversationsTableUpdateCompanionBuilder, + ( + CachedConversation, + BaseReferences< + _$FabledDatabase, + $CachedConversationsTable, + CachedConversation + >, + ), + CachedConversation, + PrefetchHooks Function() + >; typedef $$SyncMetadataTableCreateCompanionBuilder = SyncMetadataCompanion Function({ required String domain, @@ -1277,6 +5836,16 @@ class $FabledDatabaseManager { $FabledDatabaseManager(this._db); $$CachedNotesTableTableManager get cachedNotes => $$CachedNotesTableTableManager(_db, _db.cachedNotes); + $$CachedTasksTableTableManager get cachedTasks => + $$CachedTasksTableTableManager(_db, _db.cachedTasks); + $$CachedProjectsTableTableManager get cachedProjects => + $$CachedProjectsTableTableManager(_db, _db.cachedProjects); + $$CachedMilestonesTableTableManager get cachedMilestones => + $$CachedMilestonesTableTableManager(_db, _db.cachedMilestones); + $$CachedCalendarEventsTableTableManager get cachedCalendarEvents => + $$CachedCalendarEventsTableTableManager(_db, _db.cachedCalendarEvents); + $$CachedConversationsTableTableManager get cachedConversations => + $$CachedConversationsTableTableManager(_db, _db.cachedConversations); $$SyncMetadataTableTableManager get syncMetadata => $$SyncMetadataTableTableManager(_db, _db.syncMetadata); } diff --git a/lib/data/repositories/chat_repository.dart b/lib/data/repositories/chat_repository.dart index 8e0bc10..7223779 100644 --- a/lib/data/repositories/chat_repository.dart +++ b/lib/data/repositories/chat_repository.dart @@ -1,21 +1,46 @@ +import '../../core/exceptions.dart'; import '../api/chat_api.dart'; export '../api/chat_api.dart' show ChatStreamEvent, ChatTextChunk, ChatStatusUpdate, ChatToolCall; +import '../local/database.dart'; import '../models/conversation.dart'; import '../models/message.dart'; +/// Chat repository with read-through caching for the conversation list only. +/// Messages and the live SSE stream are intentionally not cached — they are +/// per-conversation, large, and require a live network anyway. class ChatRepository { final ChatApi _api; - const ChatRepository(this._api); + final FabledDatabase _db; + + const ChatRepository(this._api, this._db); + + Future> getConversations() async { + try { + final conversations = await _api.getConversations(); + await _db.replaceAllConversations(conversations); + return conversations; + } on NetworkException { + final cached = await _db.getAllConversations(); + if (cached.isEmpty) rethrow; + return cached; + } + } - Future> getConversations() => _api.getConversations(); Future createConversation(String title) => _api.createConversation(title); - Future deleteConversation(int id) => _api.deleteConversation(id); + + Future deleteConversation(int id) async { + await _api.deleteConversation(id); + await _db.deleteConversation(id); + } + Future<(Conversation, List)> getMessages(int conversationId) => _api.getMessages(conversationId); + Future sendMessage(int conversationId, String content) => _api.sendMessage(conversationId, content); + Stream streamGeneration(int conversationId) => _api.streamGeneration(conversationId); } diff --git a/lib/data/repositories/events_repository.dart b/lib/data/repositories/events_repository.dart new file mode 100644 index 0000000..41dd3a4 --- /dev/null +++ b/lib/data/repositories/events_repository.dart @@ -0,0 +1,45 @@ +import '../../core/exceptions.dart'; +import '../api/events_api.dart'; +import '../local/database.dart'; +import '../models/calendar_event.dart'; + +/// Calendar events repository with read-through caching for Tier 2 offline +/// support. Range-scoped: each `getEvents(from, to)` mirrors that window into +/// the cache (events outside the window are left alone) so successive +/// disjoint range fetches don't clobber each other. +class EventsRepository { + final EventsApi _api; + final FabledDatabase _db; + + const EventsRepository(this._api, this._db); + + Future> getEvents(DateTime from, DateTime to) async { + try { + final events = await _api.getEvents(from, to); + await _db.replaceEventsInRange(from, to, events); + return events; + } on NetworkException { + final cached = await _db.getEventsInRange(from, to); + if (cached.isEmpty) rethrow; + return cached; + } + } + + Future createEvent(Map payload) async { + final event = await _api.createEvent(payload); + await _db.upsertEvent(event); + return event; + } + + Future updateEvent( + int id, Map fields) async { + final updated = await _api.updateEvent(id, fields); + await _db.upsertEvent(updated); + return updated; + } + + Future deleteEvent(int id) async { + await _api.deleteEvent(id); + await _db.deleteEvent(id); + } +} diff --git a/lib/data/repositories/milestones_repository.dart b/lib/data/repositories/milestones_repository.dart index 7b14b77..c9eb364 100644 --- a/lib/data/repositories/milestones_repository.dart +++ b/lib/data/repositories/milestones_repository.dart @@ -1,26 +1,67 @@ +import '../../core/exceptions.dart'; import '../api/milestones_api.dart'; +import '../local/database.dart'; import '../models/milestone.dart'; +/// Milestones repository with read-through caching for Tier 2 offline support. +/// Mirrors the pattern in NotesRepository — see that file for full notes. class MilestonesRepository { final MilestonesApi _api; - const MilestonesRepository(this._api); + final FabledDatabase _db; - Future> getAll(int projectId, {String? status}) => - _api.getAll(projectId, status: status); + const MilestonesRepository(this._api, this._db); + + Future> getAll(int projectId, {String? status}) async { + try { + final milestones = await _api.getAll(projectId, status: status); + // Only mirror the full per-project list to cache on the unfiltered + // fetch; a status filter would otherwise drop entries from cache. + if (status == null) { + await _db.replaceMilestonesForProject(projectId, milestones); + } else { + for (final m in milestones) { + await _db.upsertMilestone(m); + } + } + return milestones; + } on NetworkException { + final cached = await _db.getMilestonesForProject(projectId); + if (cached.isEmpty) rethrow; + if (status != null) { + return cached.where((m) => m.status == status).toList(); + } + return cached; + } + } Future create( int projectId, { required String title, String? description, int orderIndex = 0, - }) => - _api.create(projectId, - title: title, description: description, orderIndex: orderIndex); + }) async { + final milestone = await _api.create( + projectId, + title: title, + description: description, + orderIndex: orderIndex, + ); + await _db.upsertMilestone(milestone); + return milestone; + } Future update( - int projectId, int milestoneId, Map fields) => - _api.update(projectId, milestoneId, fields); + int projectId, + int milestoneId, + Map fields, + ) async { + final updated = await _api.update(projectId, milestoneId, fields); + await _db.upsertMilestone(updated); + return updated; + } - Future delete(int projectId, int milestoneId) => - _api.delete(projectId, milestoneId); + Future delete(int projectId, int milestoneId) async { + await _api.delete(projectId, milestoneId); + await _db.deleteMilestone(milestoneId); + } } diff --git a/lib/data/repositories/notes_repository.dart b/lib/data/repositories/notes_repository.dart index 4744748..41042ac 100644 --- a/lib/data/repositories/notes_repository.dart +++ b/lib/data/repositories/notes_repository.dart @@ -90,9 +90,4 @@ class NotesRepository { await _api.delete(id); await _db.deleteNote(id); } - - /// Last successful `getAll` sync timestamp. Surfaced by the OfflineBanner - /// when the network is unreachable so the user knows how stale the - /// cached notes list is. - Future lastSyncedAt() => _db.getLastSync(kSyncDomainNotes); } diff --git a/lib/data/repositories/projects_repository.dart b/lib/data/repositories/projects_repository.dart index ca93578..e6b617d 100644 --- a/lib/data/repositories/projects_repository.dart +++ b/lib/data/repositories/projects_repository.dart @@ -1,31 +1,87 @@ +import '../../core/exceptions.dart'; import '../api/projects_api.dart'; +import '../local/database.dart'; import '../models/project.dart'; +/// Projects repository with read-through caching for Tier 2 offline support. +/// Mirrors the pattern in NotesRepository — see that file for full notes. +/// +/// `getAll`'s sort/order/status query parameters are server-side filters; the +/// cache stores the unfiltered list as last seen. Offline fallback returns +/// the full cache regardless of the requested filters — close enough for a +/// "view what you had" experience while disconnected. class ProjectsRepository { final ProjectsApi _api; - const ProjectsRepository(this._api); + final FabledDatabase _db; + + const ProjectsRepository(this._api, this._db); Future> getAll({ String? status, String sort = 'updated_at', String order = 'desc', - }) => - _api.getAll(status: status, sort: sort, order: order); - Future getOne(int id) => _api.getOne(id); + }) async { + try { + final projects = + await _api.getAll(status: status, sort: sort, order: order); + // Only refresh the cache on the unfiltered default fetch — otherwise a + // status=archived call would clobber the active-projects cache. + if (status == null) { + await _db.replaceAllProjects(projects); + } else { + for (final p in projects) { + await _db.upsertProject(p); + } + } + return projects; + } on NetworkException { + final cached = await _db.getAllProjects(); + if (cached.isEmpty) rethrow; + if (status != null) { + return cached.where((p) => p.status == status).toList(); + } + return cached; + } + } + + Future getOne(int id) async { + try { + final project = await _api.getOne(id); + await _db.upsertProject(project); + return project; + } on NetworkException { + final cached = await _db.getProject(id); + if (cached == null) rethrow; + return cached; + } + } + Future create({ required String title, String? description, String? goal, String? color, String status = 'active', - }) => - _api.create( - title: title, - description: description, - goal: goal, - color: color, - status: status); - Future update(int id, Map fields) => - _api.update(id, fields); - Future delete(int id) => _api.delete(id); + }) async { + final project = await _api.create( + title: title, + description: description, + goal: goal, + color: color, + status: status, + ); + await _db.upsertProject(project); + return project; + } + + Future update(int id, Map fields) async { + final updated = await _api.update(id, fields); + await _db.upsertProject(updated); + return updated; + } + + Future delete(int id) async { + await _api.delete(id); + await _db.deleteProject(id); + } } diff --git a/lib/data/repositories/tasks_repository.dart b/lib/data/repositories/tasks_repository.dart index c8f3abe..3bb7771 100644 --- a/lib/data/repositories/tasks_repository.dart +++ b/lib/data/repositories/tasks_repository.dart @@ -1,12 +1,63 @@ +import '../../core/exceptions.dart'; import '../api/tasks_api.dart'; +import '../local/database.dart'; import '../models/task.dart'; +/// Tasks repository with read-through caching for Tier 2 offline support. +/// Mirrors the pattern in NotesRepository — see that file for full notes. class TasksRepository { final TasksApi _api; - const TasksRepository(this._api); + final FabledDatabase _db; - Future> getAll() => _api.getAll(); - Future getOne(int id) => _api.getOne(id); + const TasksRepository(this._api, this._db); + + Future> getAll() async { + try { + final tasks = await _api.getAll(); + await _db.replaceAllTasks(tasks); + return tasks; + } on NetworkException { + final cached = await _db.getAllTasks(); + if (cached.isEmpty) rethrow; + return cached; + } + } + + Future getOne(int id) async { + try { + final task = await _api.getOne(id); + await _db.upsertTask(task); + return task; + } on NetworkException { + final cached = await _db.getTask(id); + if (cached == null) rethrow; + return cached; + } + } + + Future> getByProject(int projectId) async { + try { + final tasks = await _api.getByProject(projectId); + for (final t in tasks) { + await _db.upsertTask(t); + } + return tasks; + } on NetworkException { + return _db.getTasksByProject(projectId); + } + } + + Future> getSubTasks(int parentId) async { + try { + final tasks = await _api.getSubTasks(parentId); + for (final t in tasks) { + await _db.upsertTask(t); + } + return tasks; + } on NetworkException { + return _db.getSubTasks(parentId); + } + } Future create({ required String title, @@ -16,22 +67,28 @@ class TasksRepository { DateTime? dueDate, int? projectId, int? parentId, - }) => - _api.create( - title: title, - description: description, - status: status, - priority: priority, - dueDate: dueDate, - projectId: projectId, - parentId: parentId, - ); + }) async { + final task = await _api.create( + title: title, + description: description, + status: status, + priority: priority, + dueDate: dueDate, + projectId: projectId, + parentId: parentId, + ); + await _db.upsertTask(task); + return task; + } - Future> getByProject(int projectId) => _api.getByProject(projectId); - Future> getSubTasks(int parentId) => _api.getSubTasks(parentId); + Future update(int id, Map fields) async { + final updated = await _api.update(id, fields); + await _db.upsertTask(updated); + return updated; + } - Future update(int id, Map fields) => - _api.update(id, fields); - - Future delete(int id) => _api.delete(id); + Future delete(int id) async { + await _api.delete(id); + await _db.deleteTask(id); + } } diff --git a/lib/providers/api_client_provider.dart b/lib/providers/api_client_provider.dart index 6b194b3..1e5ada6 100644 --- a/lib/providers/api_client_provider.dart +++ b/lib/providers/api_client_provider.dart @@ -18,6 +18,7 @@ import '../data/api/tasks_api.dart'; import '../data/local/database.dart'; import '../data/repositories/auth_repository.dart'; import '../data/repositories/chat_repository.dart'; +import '../data/repositories/events_repository.dart'; import '../data/repositories/knowledge_repository.dart'; import '../data/repositories/voice_repository.dart'; import '../data/repositories/milestones_repository.dart'; @@ -82,15 +83,24 @@ final notesRepositoryProvider = Provider((ref) { }); final tasksRepositoryProvider = Provider((ref) { - return TasksRepository(ref.watch(tasksApiProvider)); + return TasksRepository( + ref.watch(tasksApiProvider), + ref.watch(fabledDatabaseProvider), + ); }); final chatRepositoryProvider = Provider((ref) { - return ChatRepository(ref.watch(chatApiProvider)); + return ChatRepository( + ref.watch(chatApiProvider), + ref.watch(fabledDatabaseProvider), + ); }); final projectsRepositoryProvider = Provider((ref) { - return ProjectsRepository(ref.watch(projectsApiProvider)); + return ProjectsRepository( + ref.watch(projectsApiProvider), + ref.watch(fabledDatabaseProvider), + ); }); final milestonesApiProvider = Provider((ref) { @@ -98,7 +108,10 @@ final milestonesApiProvider = Provider((ref) { }); final milestonesRepositoryProvider = Provider((ref) { - return MilestonesRepository(ref.watch(milestonesApiProvider)); + return MilestonesRepository( + ref.watch(milestonesApiProvider), + ref.watch(fabledDatabaseProvider), + ); }); final knowledgeApiProvider = Provider((ref) { @@ -128,3 +141,10 @@ final voiceRepositoryProvider = Provider((ref) { final eventsApiProvider = Provider((ref) { return EventsApi(ref.watch(dioProvider)); }); + +final eventsRepositoryProvider = Provider((ref) { + return EventsRepository( + ref.watch(eventsApiProvider), + ref.watch(fabledDatabaseProvider), + ); +}); diff --git a/lib/providers/calendar_provider.dart b/lib/providers/calendar_provider.dart index 3afc96c..98b0e9d 100644 --- a/lib/providers/calendar_provider.dart +++ b/lib/providers/calendar_provider.dart @@ -47,7 +47,7 @@ class CalendarNotifier extends AsyncNotifier { // Fetch current month ± 1 month as the initial window. final from = DateTime(now.year, now.month - 1, 1); final to = DateTime(now.year, now.month + 2, 0, 23, 59, 59); - final events = await ref.watch(eventsApiProvider).getEvents(from, to); + final events = await ref.watch(eventsRepositoryProvider).getEvents(from, to); return CalendarState( eventsByDay: _groupByDay(events), selectedDay: today, @@ -60,7 +60,7 @@ class CalendarNotifier extends AsyncNotifier { Future refresh() async { final current = state.value; if (current == null) return; - final events = await ref.read(eventsApiProvider).getEvents( + final events = await ref.read(eventsRepositoryProvider).getEvents( current.loadedRange.start, current.loadedRange.end, ); @@ -93,7 +93,7 @@ class CalendarNotifier extends AsyncNotifier { try { final from = DateTime(month.year, month.month, 1); final to = DateTime(month.year, month.month + 1, 0, 23, 59, 59); - final events = await ref.read(eventsApiProvider).getEvents(from, to); + final events = await ref.read(eventsRepositoryProvider).getEvents(from, to); final s = state.value!; final merged = Map>.from(s.eventsByDay); for (final e in events) { diff --git a/lib/screens/calendar/event_form_sheet.dart b/lib/screens/calendar/event_form_sheet.dart index 2bb871e..2090628 100644 --- a/lib/screens/calendar/event_form_sheet.dart +++ b/lib/screens/calendar/event_form_sheet.dart @@ -120,12 +120,12 @@ class _EventFormSheetState extends ConsumerState { 'color': _color, 'recurrence': rrule, }; - final api = ref.read(eventsApiProvider); + final repo = ref.read(eventsRepositoryProvider); if (_isCreate) { - final created = await api.createEvent(payload); + final created = await repo.createEvent(payload); widget.notifier.addEvent(created); } else { - final updated = await api.updateEvent(widget.event!.id, payload); + final updated = await repo.updateEvent(widget.event!.id, payload); widget.notifier.updateEvent(updated); } if (mounted) Navigator.of(context).pop(); @@ -165,7 +165,7 @@ class _EventFormSheetState extends ConsumerState { if (confirmed != true || !mounted) return; setState(() => _saving = true); try { - await ref.read(eventsApiProvider).deleteEvent(widget.event!.id); + await ref.read(eventsRepositoryProvider).deleteEvent(widget.event!.id); widget.notifier.removeEvent(widget.event!.id, widget.event!.startDt); if (mounted) Navigator.of(context).pop(); } catch (_) { diff --git a/lib/widgets/offline_banner.dart b/lib/widgets/offline_banner.dart index 8cfa6f1..a53e97b 100644 --- a/lib/widgets/offline_banner.dart +++ b/lib/widgets/offline_banner.dart @@ -43,8 +43,10 @@ class _OfflineBannerState extends ConsumerState { Future _loadLastSync() async { if (!mounted) return; try { - final ts = - await ref.read(notesRepositoryProvider).lastSyncedAt(); + // Most-recent sync across all cached domains so the hint reads as + // "your data was current as of X" regardless of which screen the + // user is looking at. + final ts = await ref.read(fabledDatabaseProvider).getLatestSync(); if (!mounted) return; setState(() => _lastSync = ts); } catch (_) {