Skip to content

Commit

Permalink
Clean up answer models service
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Apr 4, 2024
1 parent c4605db commit 15de462
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions MyApp.ServiceInterface/QuestionServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,16 @@ private List<string> ValidateQuestionTags(List<string>? tags)
return validTags;
}

public async Task<object> Get(GetAllAnswers request)
public async Task<object> Get(GetAllAnswerModels request)
{
var question = await questions.GetQuestionAsync(request.Id);
var modelNames = question.Question?.Answers.Where(x => !string.IsNullOrEmpty(x.Model)).Select(x => x.Model).ToList();
var humanAnswers = question.Question?.Answers.Where(x => string.IsNullOrEmpty(x.Model)).Select(x => x.Id.LeftPart("-")).ToList();
modelNames?.AddRange(humanAnswers ?? []);
var answers = question
.GetAnswerFiles()
.ToList();

return new GetAllAnswersResponse
return new GetAllAnswerModelsResponse
{
Answers = modelNames ?? new List<string>()
Results = modelNames ?? new List<string>()
};
}

Expand Down Expand Up @@ -476,14 +473,13 @@ public class GetAnswerFile
public string Id { get; set; }
}

public class GetAllAnswersResponse
public class GetAllAnswerModelsResponse
{
public string Question { get; set; }
public List<string> Answers { get; set; }
public List<string> Results { get; set; }
}

[ValidateIsAuthenticated]
public class GetAllAnswers : IReturn<GetAllAnswersResponse>, IGet
public class GetAllAnswerModels : IReturn<GetAllAnswerModelsResponse>, IGet
{
public int Id { get; set; }
}

0 comments on commit 15de462

Please sign in to comment.