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,14 +1,37 @@
|
||||
import 'group_member.dart';
|
||||
|
||||
/// Model representing a travel group.
|
||||
///
|
||||
/// A group is a collection of travelers who are part of a specific trip.
|
||||
/// It contains information about group members, creation details, and
|
||||
/// provides methods for serialization with Firestore.
|
||||
class Group {
|
||||
/// Unique identifier for the group
|
||||
final String id;
|
||||
|
||||
/// Display name of the group
|
||||
final String name;
|
||||
|
||||
/// ID of the trip this group belongs to
|
||||
final String tripId;
|
||||
|
||||
/// ID of the user who created this group
|
||||
final String createdBy;
|
||||
|
||||
/// Timestamp when the group was created
|
||||
final DateTime createdAt;
|
||||
|
||||
/// Timestamp when the group was last updated
|
||||
final DateTime updatedAt;
|
||||
|
||||
/// List of members in this group
|
||||
final List<GroupMember> members;
|
||||
|
||||
/// Creates a new [Group] instance.
|
||||
///
|
||||
/// [id], [name], [tripId], and [createdBy] are required.
|
||||
/// [createdAt] and [updatedAt] default to current time if not provided.
|
||||
/// [members] defaults to empty list if not provided.
|
||||
Group({
|
||||
required this.id,
|
||||
required this.name,
|
||||
@@ -21,6 +44,12 @@ class Group {
|
||||
updatedAt = updatedAt ?? DateTime.now(),
|
||||
members = members ?? [];
|
||||
|
||||
/// Creates a [Group] instance from a Firestore document map.
|
||||
///
|
||||
/// [map] - The document data from Firestore
|
||||
/// [id] - The document ID from Firestore
|
||||
///
|
||||
/// Returns a new [Group] instance with data from the map.
|
||||
factory Group.fromMap(Map<String, dynamic> map, String id) {
|
||||
return Group(
|
||||
id: id,
|
||||
|
||||
Reference in New Issue
Block a user