Enhance model and service documentation with detailed comments and descriptions
- Updated Group, Trip, User, and other model classes to include comprehensive documentation for better understanding and maintainability. - Improved error handling and logging in services, including AuthService, ErrorService, and StorageService. - Added validation and business logic explanations in ExpenseService and TripService. - Refactored method comments to follow a consistent format across the codebase. - Translated error messages and comments from French to English for consistency.
This commit is contained in:
@@ -1,10 +1,42 @@
|
||||
/// A service that handles trip-related business logic and data operations.
|
||||
///
|
||||
/// This service provides functionality for:
|
||||
/// - Trip creation, updating, and deletion
|
||||
/// - Trip validation and business rule enforcement
|
||||
/// - Location-based trip suggestions
|
||||
/// - Trip statistics and analytics
|
||||
/// - Integration with Firebase Firestore for data persistence
|
||||
///
|
||||
/// The service ensures data integrity by validating trip information
|
||||
/// before database operations and provides comprehensive error handling
|
||||
/// and logging through the ErrorService.
|
||||
///
|
||||
/// Example usage:
|
||||
/// ```dart
|
||||
/// final tripService = TripService();
|
||||
///
|
||||
/// // Create a new trip
|
||||
/// final tripId = await tripService.createTrip(newTrip);
|
||||
///
|
||||
/// // Get trip suggestions for a location
|
||||
/// final suggestions = await tripService.getTripSuggestions('Paris');
|
||||
///
|
||||
/// // Calculate trip statistics
|
||||
/// final stats = await tripService.getTripStatistics(tripId);
|
||||
/// ```
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:travel_mate/services/error_service.dart';
|
||||
import '../models/trip.dart';
|
||||
|
||||
/// Service for managing trip-related operations and business logic.
|
||||
class TripService {
|
||||
/// Service for error handling and logging
|
||||
final _errorService = ErrorService();
|
||||
|
||||
/// Firestore instance for database operations
|
||||
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
|
||||
|
||||
/// Collection name for trips in Firestore
|
||||
static const String _tripsCollection = 'trips';
|
||||
|
||||
// Charger tous les voyages
|
||||
|
||||
Reference in New Issue
Block a user