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:
Dayron
2025-10-30 15:56:17 +01:00
parent 1eeea6997e
commit 2faf37f145
46 changed files with 2656 additions and 220 deletions

View File

@@ -3,47 +3,109 @@ import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'expense_split.dart';
/// Enumeration of supported currencies for expenses.
///
/// Each currency includes both a display symbol and standard currency code.
enum ExpenseCurrency {
/// Euro currency
eur('', 'EUR'),
/// US Dollar currency
usd('\$', 'USD'),
/// British Pound currency
gbp('£', 'GBP');
const ExpenseCurrency(this.symbol, this.code);
/// Currency symbol for display (e.g., €, $, £)
final String symbol;
/// Standard currency code (e.g., EUR, USD, GBP)
final String code;
}
/// Enumeration of expense categories with display names and icons.
///
/// Provides predefined categories for organizing travel expenses.
enum ExpenseCategory {
/// Restaurant and food expenses
restaurant('Restaurant', Icons.restaurant),
/// Transportation expenses
transport('Transport', Icons.directions_car),
accommodation('Hébergement', Icons.hotel),
entertainment('Loisirs', Icons.local_activity),
/// Accommodation and lodging expenses
accommodation('Accommodation', Icons.hotel),
/// Entertainment and activity expenses
entertainment('Entertainment', Icons.local_activity),
/// Shopping expenses
shopping('Shopping', Icons.shopping_bag),
other('Autre', Icons.category);
/// Other miscellaneous expenses
other('Other', Icons.category);
const ExpenseCategory(this.displayName, this.icon);
/// Human-readable display name for the category
final String displayName;
/// Icon representing the category
final IconData icon;
}
/// Model representing a travel expense.
///
/// This class encapsulates all information about an expense including
/// amount, currency, category, who paid, how it's split among participants,
/// and receipt information. It extends [Equatable] for value comparison.
class Expense extends Equatable {
/// Unique identifier for the expense
final String id;
/// ID of the group this expense belongs to
final String groupId;
/// Description of the expense
final String description;
/// Amount of the expense in the original currency
final double amount;
/// Currency of the expense
final ExpenseCurrency currency;
final double amountInEur; // Montant converti en EUR
/// Amount converted to EUR for standardized calculations
final double amountInEur;
/// Category of the expense
final ExpenseCategory category;
/// ID of the user who paid for this expense
final String paidById;
/// Name of the user who paid for this expense
final String paidByName;
/// Date when the expense occurred
final DateTime date;
/// Timestamp when the expense was created
final DateTime createdAt;
/// Timestamp when the expense was last edited (null if never edited)
final DateTime? editedAt;
/// Whether this expense has been edited after creation
final bool isEdited;
/// Whether this expense has been archived
final bool isArchived;
/// URL to the receipt image (optional)
final String? receiptUrl;
/// List of expense splits showing how the cost is divided
final List<ExpenseSplit> splits;
/// Creates a new [Expense] instance.
///
/// All parameters except [editedAt] and [receiptUrl] are required.
const Expense({
required this.id,
required this.groupId,