package com.example.questionbank.service.mapper; import com.example.questionbank.domain.ExamAnswer; import com.example.questionbank.domain.ExamAttempt; import com.example.questionbank.domain.Question; import com.example.questionbank.service.dto.ExamAnswerDTO; import com.example.questionbank.service.dto.ExamAttemptDTO; import com.example.questionbank.service.dto.QuestionDTO; import org.mapstruct.*; /** * Mapper for the entity {@link ExamAnswer} and its DTO {@link ExamAnswerDTO}. */ @Mapper(componentModel = "spring") public interface ExamAnswerMapper extends EntityMapper { @Mapping(target = "question", source = "question", qualifiedByName = "questionId") @Mapping(target = "attempt", source = "attempt", qualifiedByName = "examAttemptId") ExamAnswerDTO toDto(ExamAnswer s); @Named("questionId") @BeanMapping(ignoreByDefault = true) @Mapping(target = "id", source = "id") QuestionDTO toDtoQuestionId(Question question); @Named("examAttemptId") @BeanMapping(ignoreByDefault = true) @Mapping(target = "id", source = "id") ExamAttemptDTO toDtoExamAttemptId(ExamAttempt examAttempt); }