feat(api): DTOs et enums pour système de messagerie
Ajout des DTOs et enums nécessaires au système de communication/messaging. Enums (communication): - ConversationType: INDIVIDUAL, GROUP, BROADCAST, ANNOUNCEMENT - MessageType: INDIVIDUAL, BROADCAST, TARGETED, SYSTEM - MessageStatus: SENT, DELIVERED, READ, FAILED - MessagePriority: NORMAL, HIGH, URGENT DTOs Request: - CreateConversationRequest: name, description, type, participantIds, organisationId - SendMessageRequest: conversationId, content, type, priority, recipientIds, etc. DTOs Response: - ConversationResponse: données complètes conversation + lastMessage + unreadCount - MessageResponse: données complètes message Tâche: #60 - Communication Backend (Part 1/2 - API) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package dev.lions.unionflow.server.api.dto.communication.request;
|
||||||
|
|
||||||
|
import dev.lions.unionflow.server.api.enums.communication.ConversationType;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Builder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request DTO pour créer une conversation
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
@Builder
|
||||||
|
public record CreateConversationRequest(
|
||||||
|
@NotBlank @Size(max = 255) String name,
|
||||||
|
@Size(max = 1000) String description,
|
||||||
|
@NotNull ConversationType type,
|
||||||
|
@NotEmpty List<UUID> participantIds,
|
||||||
|
UUID organisationId
|
||||||
|
) {}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package dev.lions.unionflow.server.api.dto.communication.request;
|
||||||
|
|
||||||
|
import dev.lions.unionflow.server.api.enums.communication.MessagePriority;
|
||||||
|
import dev.lions.unionflow.server.api.enums.communication.MessageType;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Builder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request DTO pour envoyer un message
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
@Builder
|
||||||
|
public record SendMessageRequest(
|
||||||
|
@NotNull UUID conversationId,
|
||||||
|
@NotBlank @Size(max = 10000) String content,
|
||||||
|
MessageType type,
|
||||||
|
MessagePriority priority,
|
||||||
|
List<UUID> recipientIds,
|
||||||
|
List<String> recipientRoles,
|
||||||
|
List<String> attachments
|
||||||
|
) {}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package dev.lions.unionflow.server.api.dto.communication.response;
|
||||||
|
|
||||||
|
import dev.lions.unionflow.server.api.enums.communication.ConversationType;
|
||||||
|
import lombok.Builder;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response DTO pour Conversation
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
@Builder
|
||||||
|
public record ConversationResponse(
|
||||||
|
UUID id,
|
||||||
|
String name,
|
||||||
|
String description,
|
||||||
|
ConversationType type,
|
||||||
|
List<UUID> participantIds,
|
||||||
|
UUID organisationId,
|
||||||
|
MessageResponse lastMessage,
|
||||||
|
int unreadCount,
|
||||||
|
boolean isMuted,
|
||||||
|
boolean isPinned,
|
||||||
|
boolean isArchived,
|
||||||
|
LocalDateTime createdAt,
|
||||||
|
LocalDateTime updatedAt,
|
||||||
|
String avatarUrl
|
||||||
|
) {}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package dev.lions.unionflow.server.api.dto.communication.response;
|
||||||
|
|
||||||
|
import dev.lions.unionflow.server.api.enums.communication.MessagePriority;
|
||||||
|
import dev.lions.unionflow.server.api.enums.communication.MessageStatus;
|
||||||
|
import dev.lions.unionflow.server.api.enums.communication.MessageType;
|
||||||
|
import lombok.Builder;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response DTO pour Message
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
@Builder
|
||||||
|
public record MessageResponse(
|
||||||
|
UUID id,
|
||||||
|
UUID conversationId,
|
||||||
|
UUID senderId,
|
||||||
|
String senderName,
|
||||||
|
String senderAvatar,
|
||||||
|
String content,
|
||||||
|
MessageType type,
|
||||||
|
MessageStatus status,
|
||||||
|
MessagePriority priority,
|
||||||
|
List<UUID> recipientIds,
|
||||||
|
List<String> recipientRoles,
|
||||||
|
UUID organisationId,
|
||||||
|
LocalDateTime createdAt,
|
||||||
|
LocalDateTime readAt,
|
||||||
|
List<String> attachments,
|
||||||
|
boolean isEdited,
|
||||||
|
LocalDateTime editedAt,
|
||||||
|
boolean isDeleted
|
||||||
|
) {}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package dev.lions.unionflow.server.api.enums.communication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de conversation dans le système de messagerie
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
public enum ConversationType {
|
||||||
|
/**
|
||||||
|
* Conversation individuelle (1-1)
|
||||||
|
*/
|
||||||
|
INDIVIDUAL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conversation de groupe
|
||||||
|
*/
|
||||||
|
GROUP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Canal broadcast (lecture seule pour la plupart)
|
||||||
|
*/
|
||||||
|
BROADCAST,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Canal d'annonces organisation
|
||||||
|
*/
|
||||||
|
ANNOUNCEMENT
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package dev.lions.unionflow.server.api.enums.communication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Priorité du message
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
public enum MessagePriority {
|
||||||
|
/**
|
||||||
|
* Priorité normale
|
||||||
|
*/
|
||||||
|
NORMAL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Priorité élevée (important)
|
||||||
|
*/
|
||||||
|
HIGH,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Priorité urgente (critique)
|
||||||
|
*/
|
||||||
|
URGENT
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package dev.lions.unionflow.server.api.enums.communication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Statut de lecture du message
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
public enum MessageStatus {
|
||||||
|
/**
|
||||||
|
* Envoyé mais non lu
|
||||||
|
*/
|
||||||
|
SENT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Livré (reçu par le serveur)
|
||||||
|
*/
|
||||||
|
DELIVERED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lu par le destinataire
|
||||||
|
*/
|
||||||
|
READ,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Échec d'envoi
|
||||||
|
*/
|
||||||
|
FAILED
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package dev.lions.unionflow.server.api.enums.communication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de message
|
||||||
|
*
|
||||||
|
* @author UnionFlow Team
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2026-03-16
|
||||||
|
*/
|
||||||
|
public enum MessageType {
|
||||||
|
/**
|
||||||
|
* Message individuel (membre à membre)
|
||||||
|
*/
|
||||||
|
INDIVIDUAL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Broadcast organisation (OrgAdmin → tous)
|
||||||
|
*/
|
||||||
|
BROADCAST,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message ciblé par rôle (Moderator → groupe)
|
||||||
|
*/
|
||||||
|
TARGETED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification système
|
||||||
|
*/
|
||||||
|
SYSTEM
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user