Added and mapped date into dto for all challenges past of user

This commit is contained in:
2026-04-15 12:23:00 +01:00
parent f80a9489c1
commit cc9e3e9ea1
2 changed files with 5 additions and 2 deletions
@@ -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; }
}
@@ -36,12 +36,14 @@ public class EntityToDtoMappings : Profile
CreateMap<RandomChallenge, GetUserChallengeDto>()
.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<Group, GetUserChallengeDto>()
.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<UserFriend, GetFriendDto>()
.ForMember(dest => dest.Username, opt => opt.MapFrom(src => src.Friend!.Username))