From cc9e3e9ea12b0b98d30ee7c648305fe45a070b82 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Wed, 15 Apr 2026 12:23:00 +0100 Subject: [PATCH] Added and mapped date into dto for all challenges past of user --- BeReadyBackend/DTO/Users/GetUserChallengeDto.cs | 1 + BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BeReadyBackend/DTO/Users/GetUserChallengeDto.cs b/BeReadyBackend/DTO/Users/GetUserChallengeDto.cs index e7beb1e..102011b 100644 --- a/BeReadyBackend/DTO/Users/GetUserChallengeDto.cs +++ b/BeReadyBackend/DTO/Users/GetUserChallengeDto.cs @@ -5,4 +5,5 @@ public class GetUserChallengeDto public string? ChallengeTitle { get; set; } public string? ChallengeDescription { get; set; } public int ChallengeDuration { get; set; } + public DateOnly ChallengeStartDate { get; set; } } \ No newline at end of file diff --git a/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs b/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs index 8796070..abc2f39 100644 --- a/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs +++ b/BeReadyBackend/MappingProfiles/EntityToDtoMappings.cs @@ -36,12 +36,14 @@ public class EntityToDtoMappings : Profile CreateMap() .ForMember(dest => dest.ChallengeTitle, opt => opt.MapFrom(src => src.Libelle)) - .ForMember(dest => dest.ChallengeDuration, opt => opt.MapFrom(src => src.Duration)); + .ForMember(dest => dest.ChallengeDuration, opt => opt.MapFrom(src => src.Duration)) + .ForMember(dest => dest.ChallengeStartDate, opt => opt.MapFrom(src => DateOnly.FromDateTime(src.GeneratedAt!.Value))); CreateMap() .ForMember(dest => dest.ChallengeTitle, opt => opt.MapFrom(src => src.Title)) .ForMember(dest => dest.ChallengeDescription, opt => opt.MapFrom(src => src.Description)) - .ForMember(dest => dest.ChallengeDuration, opt => opt.MapFrom(src => src.Duration)); + .ForMember(dest => dest.ChallengeDuration, opt => opt.MapFrom(src => src.Duration)) + .ForMember(dest => dest.ChallengeStartDate, opt => opt.MapFrom(src => DateOnly.FromDateTime(src.CreationDate))); CreateMap() .ForMember(dest => dest.Username, opt => opt.MapFrom(src => src.Friend!.Username))