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

@@ -1,5 +1,25 @@
/// Events for message-related operations in the MessageBloc.
///
/// This file defines all possible events that can be dispatched to the MessageBloc
/// to trigger message-related state changes and operations such as loading messages,
/// sending messages, managing reactions, and performing CRUD operations on chat messages.
///
/// Event Categories:
/// - **Loading Events**: LoadMessages
/// - **Message Operations**: SendMessage, DeleteMessage, UpdateMessage
/// - **Reaction Management**: ReactToMessage, RemoveReaction
///
/// All events support real-time group chat functionality with features like
/// message editing, deletion, and emoji reactions.
///
/// All events extend [MessageEvent] and implement [Equatable] for proper
/// equality comparison in the BLoC pattern.
import 'package:equatable/equatable.dart';
/// Base class for all message-related events.
///
/// All message events must extend this class and implement the [props] getter
/// for proper equality comparison in the BLoC pattern.
abstract class MessageEvent extends Equatable {
const MessageEvent();
@@ -7,21 +27,59 @@ abstract class MessageEvent extends Equatable {
List<Object?> get props => [];
}
/// Event to load messages for a specific group with real-time updates.
///
/// This event initializes the message stream for a group, providing real-time
/// updates as new messages are sent, edited, or deleted. The stream will
/// continue until the bloc is closed or a new LoadMessages event is dispatched.
///
/// Args:
/// [groupId]: The unique identifier of the group whose messages should be loaded
class LoadMessages extends MessageEvent {
/// The unique identifier of the group
final String groupId;
/// Creates a LoadMessages event.
///
/// Args:
/// [groupId]: The group ID to load messages for
const LoadMessages(this.groupId);
@override
List<Object?> get props => [groupId];
}
/// Event to send a new message to a group chat.
///
/// This event creates and sends a new message to the specified group.
/// The message will be immediately visible to all group members through
/// the real-time message stream.
///
/// Args:
/// [groupId]: The unique identifier of the target group
/// [text]: The content of the message to send
/// [senderId]: The unique identifier of the user sending the message
/// [senderName]: The display name of the user sending the message
class SendMessage extends MessageEvent {
/// The unique identifier of the group
final String groupId;
/// The content of the message
final String text;
/// The unique identifier of the sender
final String senderId;
/// The display name of the sender
final String senderName;
/// Creates a SendMessage event.
///
/// Args:
/// [groupId]: The target group ID
/// [text]: The message content
/// [senderId]: The sender's user ID
/// [senderName]: The sender's display name
const SendMessage({
required this.groupId,
required this.text,
@@ -33,10 +91,27 @@ class SendMessage extends MessageEvent {
List<Object?> get props => [groupId, text, senderId, senderName];
}
/// Event to delete a message from the group chat.
///
/// This event permanently removes a message from the chat. The deletion
/// will be immediately reflected for all group members through the
/// real-time message stream. This action cannot be undone.
///
/// Args:
/// [groupId]: The unique identifier of the group containing the message
/// [messageId]: The unique identifier of the message to delete
class DeleteMessage extends MessageEvent {
/// The unique identifier of the group
final String groupId;
/// The unique identifier of the message to delete
final String messageId;
/// Creates a DeleteMessage event.
///
/// Args:
/// [groupId]: The group ID containing the message
/// [messageId]: The message ID to delete
const DeleteMessage({
required this.groupId,
required this.messageId,
@@ -46,11 +121,32 @@ class DeleteMessage extends MessageEvent {
List<Object?> get props => [groupId, messageId];
}
/// Event to update/edit an existing message in the group chat.
///
/// This event allows users to modify the content of a previously sent message.
/// The updated message will be immediately visible to all group members
/// through the real-time message stream, typically with an "edited" indicator.
///
/// Args:
/// [groupId]: The unique identifier of the group containing the message
/// [messageId]: The unique identifier of the message to update
/// [newText]: The new content for the message
class UpdateMessage extends MessageEvent {
/// The unique identifier of the group
final String groupId;
/// The unique identifier of the message to update
final String messageId;
/// The new content for the message
final String newText;
/// Creates an UpdateMessage event.
///
/// Args:
/// [groupId]: The group ID containing the message
/// [messageId]: The message ID to update
/// [newText]: The new message content
const UpdateMessage({
required this.groupId,
required this.messageId,
@@ -61,12 +157,37 @@ class UpdateMessage extends MessageEvent {
List<Object?> get props => [groupId, messageId, newText];
}
/// Event to add an emoji reaction to a message.
///
/// This event allows users to react to messages with emojis, providing
/// a quick way to express emotions or acknowledgment without sending
/// a full message. The reaction will be immediately visible to all group members.
///
/// Args:
/// [groupId]: The unique identifier of the group containing the message
/// [messageId]: The unique identifier of the message to react to
/// [userId]: The unique identifier of the user adding the reaction
/// [reaction]: The emoji or reaction string to add
class ReactToMessage extends MessageEvent {
/// The unique identifier of the group
final String groupId;
/// The unique identifier of the message
final String messageId;
/// The unique identifier of the user adding the reaction
final String userId;
/// The emoji or reaction string
final String reaction;
/// Creates a ReactToMessage event.
///
/// Args:
/// [groupId]: The group ID containing the message
/// [messageId]: The message ID to react to
/// [userId]: The user ID adding the reaction
/// [reaction]: The emoji/reaction to add
const ReactToMessage({
required this.groupId,
required this.messageId,
@@ -78,11 +199,32 @@ class ReactToMessage extends MessageEvent {
List<Object?> get props => [groupId, messageId, userId, reaction];
}
/// Event to remove a user's reaction from a message.
///
/// This event removes a previously added emoji reaction from a message.
/// Only the user who added the reaction can remove it. The removal will
/// be immediately reflected for all group members through the real-time stream.
///
/// Args:
/// [groupId]: The unique identifier of the group containing the message
/// [messageId]: The unique identifier of the message with the reaction
/// [userId]: The unique identifier of the user removing their reaction
class RemoveReaction extends MessageEvent {
/// The unique identifier of the group
final String groupId;
/// The unique identifier of the message
final String messageId;
/// The unique identifier of the user removing the reaction
final String userId;
/// Creates a RemoveReaction event.
///
/// Args:
/// [groupId]: The group ID containing the message
/// [messageId]: The message ID with the reaction
/// [userId]: The user ID removing the reaction
const RemoveReaction({
required this.groupId,
required this.messageId,