Files
Tomas Dvorak 37ffb93923 feat: Complete Phase 1 - Full Flutter app implementation with comprehensive features
Version: 1.1.0

Major changes:
- Implemented complete Flutter app structure with all core features
- Added comprehensive UI screens for auth, countdown, goals, profile, settings, and social features
- Integrated Supabase backend with authentication and data repositories
- Added offline support with Hive caching and local storage
- Implemented comprehensive routing with go_router
- Added location services with Google Maps integration
- Implemented notifications and home widget support
- Added voice recording capabilities and AI chat features
- Created comprehensive test suite and documentation
- Added Android and iOS platform configurations
- Implemented achievements system and social features
- Added calendar integration and bucket list functionality

This represents a complete Phase 1 milestone with 3,775 additions across 31 files.
2026-01-04 14:33:54 +01:00

70 lines
1.7 KiB
Dart

import 'package:supabase_flutter/supabase_flutter.dart' as supabase;
import '../models/calendar_entry_model.dart';
import '../../core/errors/failure.dart';
class CalendarRepository {
final supabase.SupabaseClient _client;
CalendarRepository(this._client);
Future<List<CalendarEntry>> getEntriesForDate({
required String userId,
required DateTime date,
}) async {
try {
final dateStr = date.toIso8601String().split('T').first;
final response = await _client
.from('calendar_entries')
.select()
.eq('user_id', userId)
.eq('entry_date', dateStr)
.order('created_at', ascending: true);
return (response as List)
.map((json) => CalendarEntry.fromJson(json))
.toList();
} catch (e) {
throw _handleError(e);
}
}
Future<CalendarEntry> addEntry({
required String userId,
required DateTime date,
required String title,
String? note,
String entryType = 'note',
String? goalId,
}) async {
try {
final dateStr = date.toIso8601String().split('T').first;
final response = await _client
.from('calendar_entries')
.insert({
'user_id': userId,
'goal_id': goalId,
'entry_date': dateStr,
'title': title,
'note': note,
'entry_type': entryType,
})
.select()
.single();
return CalendarEntry.fromJson(response);
} catch (e) {
throw _handleError(e);
}
}
Failure _handleError(dynamic error) {
if (error is supabase.PostgrestException) {
return ServerFailure(error.message);
}
return UnknownFailure(error.toString());
}
}