Configure Maven repository for unionflow-server-api dependency
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
package dev.lions.unionflow.server.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import dev.lions.unionflow.server.entity.Evenement;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour l'API mobile - Mapping des champs de l'entité Evenement vers le format attendu par
|
||||
* l'application mobile Flutter
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 2.0
|
||||
* @since 2025-01-16
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class EvenementMobileDTO {
|
||||
|
||||
private UUID id;
|
||||
private String titre;
|
||||
private String description;
|
||||
private LocalDateTime dateDebut;
|
||||
private LocalDateTime dateFin;
|
||||
private String lieu;
|
||||
private String adresse;
|
||||
private String ville;
|
||||
private String codePostal;
|
||||
|
||||
// Mapping: typeEvenement -> type
|
||||
private String type;
|
||||
|
||||
// Mapping: statut -> statut (OK)
|
||||
private String statut;
|
||||
|
||||
// Mapping: capaciteMax -> maxParticipants
|
||||
private Integer maxParticipants;
|
||||
|
||||
// Nombre de participants actuels (calculé depuis les inscriptions)
|
||||
private Integer participantsActuels;
|
||||
|
||||
// IDs et noms pour les relations
|
||||
private UUID organisateurId;
|
||||
private String organisateurNom;
|
||||
private UUID organisationId;
|
||||
private String organisationNom;
|
||||
|
||||
// Priorité (à ajouter dans l'entité si nécessaire)
|
||||
private String priorite;
|
||||
|
||||
// Mapping: visiblePublic -> estPublic
|
||||
private Boolean estPublic;
|
||||
|
||||
// Mapping: inscriptionRequise -> inscriptionRequise (OK)
|
||||
private Boolean inscriptionRequise;
|
||||
|
||||
// Mapping: prix -> cout
|
||||
private BigDecimal cout;
|
||||
|
||||
// Devise
|
||||
private String devise;
|
||||
|
||||
// Tags (à implémenter si nécessaire)
|
||||
private String[] tags;
|
||||
|
||||
// URLs
|
||||
private String imageUrl;
|
||||
private String documentUrl;
|
||||
|
||||
// Notes
|
||||
private String notes;
|
||||
|
||||
// Dates de création/modification
|
||||
private LocalDateTime dateCreation;
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Actif
|
||||
private Boolean actif;
|
||||
|
||||
/**
|
||||
* Convertit une entité Evenement en DTO mobile
|
||||
*
|
||||
* @param evenement L'entité à convertir
|
||||
* @return Le DTO mobile
|
||||
*/
|
||||
public static EvenementMobileDTO fromEntity(Evenement evenement) {
|
||||
if (evenement == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return EvenementMobileDTO.builder()
|
||||
.id(evenement.getId()) // Utilise getId() depuis BaseEntity
|
||||
.titre(evenement.getTitre())
|
||||
.description(evenement.getDescription())
|
||||
.dateDebut(evenement.getDateDebut())
|
||||
.dateFin(evenement.getDateFin())
|
||||
.lieu(evenement.getLieu())
|
||||
.adresse(evenement.getAdresse())
|
||||
.ville(null) // Pas de champ ville dans l'entité
|
||||
.codePostal(null) // Pas de champ codePostal dans l'entité
|
||||
// Mapping des enums
|
||||
.type(evenement.getTypeEvenement() != null ? evenement.getTypeEvenement().name() : null)
|
||||
.statut(evenement.getStatut() != null ? evenement.getStatut().name() : "PLANIFIE")
|
||||
// Mapping des champs renommés
|
||||
.maxParticipants(evenement.getCapaciteMax())
|
||||
.participantsActuels(evenement.getNombreInscrits())
|
||||
// Relations (gestion sécurisée des lazy loading)
|
||||
.organisateurId(evenement.getOrganisateur() != null ? evenement.getOrganisateur().getId() : null)
|
||||
.organisateurNom(evenement.getOrganisateur() != null ? evenement.getOrganisateur().getNomComplet() : null)
|
||||
.organisationId(evenement.getOrganisation() != null ? evenement.getOrganisation().getId() : null)
|
||||
.organisationNom(evenement.getOrganisation() != null ? evenement.getOrganisation().getNom() : null)
|
||||
// Priorité (valeur par défaut)
|
||||
.priorite("MOYENNE")
|
||||
// Mapping booléens
|
||||
.estPublic(evenement.getVisiblePublic())
|
||||
.inscriptionRequise(evenement.getInscriptionRequise())
|
||||
// Mapping prix -> cout
|
||||
.cout(evenement.getPrix())
|
||||
.devise("XOF")
|
||||
// Tags vides pour l'instant
|
||||
.tags(new String[] {})
|
||||
// URLs (à implémenter si nécessaire)
|
||||
.imageUrl(null)
|
||||
.documentUrl(null)
|
||||
// Notes
|
||||
.notes(evenement.getInstructionsParticulieres())
|
||||
// Dates
|
||||
.dateCreation(evenement.getDateCreation())
|
||||
.dateModification(evenement.getDateModification())
|
||||
// Actif
|
||||
.actif(evenement.getActif())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user