test(03-01): add failing tests for DailyPlanDao cross-room query and completion count
- 7 failing tests for watchAllTasksWithRoomName and watchCompletionsToday - DAO stub with UnimplementedError methods registered in AppDatabase - TaskWithRoom and DailyPlanState model classes defined Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
24
lib/features/home/data/daily_plan_dao.dart
Normal file
24
lib/features/home/data/daily_plan_dao.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
import '../../../core/database/database.dart';
|
||||
import '../domain/daily_plan_models.dart';
|
||||
|
||||
part 'daily_plan_dao.g.dart';
|
||||
|
||||
@DriftAccessor(tables: [Tasks, Rooms, TaskCompletions])
|
||||
class DailyPlanDao extends DatabaseAccessor<AppDatabase>
|
||||
with _$DailyPlanDaoMixin {
|
||||
DailyPlanDao(super.attachedDatabase);
|
||||
|
||||
/// Watch all tasks joined with room name, sorted by nextDueDate ascending.
|
||||
Stream<List<TaskWithRoom>> watchAllTasksWithRoomName() {
|
||||
// TODO: implement
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
/// Count task completions recorded today.
|
||||
Stream<int> watchCompletionsToday({DateTime? today}) {
|
||||
// TODO: implement
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
25
lib/features/home/data/daily_plan_dao.g.dart
Normal file
25
lib/features/home/data/daily_plan_dao.g.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'daily_plan_dao.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
mixin _$DailyPlanDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||
$RoomsTable get rooms => attachedDatabase.rooms;
|
||||
$TasksTable get tasks => attachedDatabase.tasks;
|
||||
$TaskCompletionsTable get taskCompletions => attachedDatabase.taskCompletions;
|
||||
DailyPlanDaoManager get managers => DailyPlanDaoManager(this);
|
||||
}
|
||||
|
||||
class DailyPlanDaoManager {
|
||||
final _$DailyPlanDaoMixin _db;
|
||||
DailyPlanDaoManager(this._db);
|
||||
$$RoomsTableTableManager get rooms =>
|
||||
$$RoomsTableTableManager(_db.attachedDatabase, _db.rooms);
|
||||
$$TasksTableTableManager get tasks =>
|
||||
$$TasksTableTableManager(_db.attachedDatabase, _db.tasks);
|
||||
$$TaskCompletionsTableTableManager get taskCompletions =>
|
||||
$$TaskCompletionsTableTableManager(
|
||||
_db.attachedDatabase,
|
||||
_db.taskCompletions,
|
||||
);
|
||||
}
|
||||
31
lib/features/home/domain/daily_plan_models.dart
Normal file
31
lib/features/home/domain/daily_plan_models.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:household_keeper/core/database/database.dart';
|
||||
|
||||
/// A task paired with its room for daily plan display.
|
||||
class TaskWithRoom {
|
||||
final Task task;
|
||||
final String roomName;
|
||||
final int roomId;
|
||||
|
||||
const TaskWithRoom({
|
||||
required this.task,
|
||||
required this.roomName,
|
||||
required this.roomId,
|
||||
});
|
||||
}
|
||||
|
||||
/// Daily plan data categorized into sections with progress tracking.
|
||||
class DailyPlanState {
|
||||
final List<TaskWithRoom> overdueTasks;
|
||||
final List<TaskWithRoom> todayTasks;
|
||||
final List<TaskWithRoom> tomorrowTasks;
|
||||
final int completedTodayCount;
|
||||
final int totalTodayCount;
|
||||
|
||||
const DailyPlanState({
|
||||
required this.overdueTasks,
|
||||
required this.todayTasks,
|
||||
required this.tomorrowTasks,
|
||||
required this.completedTodayCount,
|
||||
required this.totalTodayCount,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user