Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/database/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import 'package:tattoo/database/database.dart';

/// Reusable database operations shared across repositories.
extension DatabaseActions on AppDatabase {
/// Returns the authenticated user's profile.
Future<User?> getUser() {
return select(users).getSingleOrNull();
}

/// Drops and recreates all tables, fully resetting the database.
Future<void> deleteEverything() async {
await transaction(() async {
Expand Down Expand Up @@ -32,6 +37,7 @@ extension DatabaseActions on AppDatabase {
fetchedAt: Value(null),
semestersFetchedAt: Value(null),
scoreDataFetchedAt: Value(null),
calendarFetchedAt: Value(null),
),
);
});
Expand Down
1 change: 1 addition & 0 deletions lib/database/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ final databaseProvider = Provider<AppDatabase>((ref) {
UserSemesterSummaryTutors,
UserSemesterSummaryCadreRoles,
UserSemesterRankings,
CalendarEvents,
],
views: [
CourseTableSlots,
Expand Down
Loading
Loading