i'm sorry guys it's stupid commit...

This commit is contained in:
Вячеслав 2025-05-31 00:05:45 +05:00
parent 77cfacb95e
commit 4b4739ce89
13 changed files with 174 additions and 1 deletions

View file

@ -0,0 +1,20 @@
using SurveyBackend.DTOs.Answer;
using SurveyLib.Core.Models;
namespace SurveyBackend.Mappers;
public static class AnswerMapper
{
public static Answer CreateDtoToModel(AnswerCreateDto dto) => new Answer
{
QuestionId = dto.QuestionId,
AnswerText = dto.AnswerText,
};
public static AnswerOutputDto ModelToOutputDto(Answer model) => new AnswerOutputDto
{
QuestionId = model.QuestionId,
AnswerText = model.AnswerText,
CompletionId = model.CompletionId,
};
}

View file

@ -0,0 +1,21 @@
using SurveyBackend.DTOs.Completion;
using SurveyLib.Core.Models;
namespace SurveyBackend.Mappers;
public static class CompletionMapper
{
public static Completion CreateDtoToModel(CompletionCreateDto dto, int surveyId, int? performerId) => new Completion
{
SurveyId = surveyId,
CompletedBy = performerId,
Answers = dto.Answers.Select(AnswerMapper.CreateDtoToModel).ToList(),
};
public static CompletionOutputDto ModelToOutputDto(Completion model) => new CompletionOutputDto
{
CompletedBy = model.CompletedBy,
FinishedAt = model.FinishedAt,
Answers = model.Answers.Select(AnswerMapper.ModelToOutputDto).ToList(),
};
}