source: src/FinkiChattery/FinkiChattery.Queries/Questioning/GetQuestionState/GetQuestionStateQuery.cs@ b25b9ea

dev
Last change on this file since b25b9ea was b25b9ea, checked in by Стојков Марко <mst@…>, 3 years ago

Get question state endpoint

  • Property mode set to 100644
File size: 1020 bytes
Line 
1using FinkiChattery.Common.Mediator.Contracs;
2using FinkiChattery.Persistence.Repositories;
3using FinkiChattery.Persistence.Repositories.Contracts;
4using System;
5using System.Threading;
6using System.Threading.Tasks;
7
8namespace FinkiChattery.Queries.Questioning
9{
10 public class GetQuestionStateQuery : IQuery<QuestionStateDto>
11 {
12 public GetQuestionStateQuery(Guid questionUid)
13 {
14 QuestionUid = questionUid;
15 }
16
17 public Guid QuestionUid { get; }
18 }
19
20 public class GetQuestionStateQueryHandler : IQueryHandler<GetQuestionStateQuery, QuestionStateDto>
21 {
22 public GetQuestionStateQueryHandler(IQuestionRepo questionRepo)
23 {
24 QuestionRepo = questionRepo;
25 }
26
27 public IQuestionRepo QuestionRepo { get; }
28
29 public async Task<QuestionStateDto> Handle(GetQuestionStateQuery request, CancellationToken cancellationToken)
30 {
31 return await QuestionRepo.GetQuestionState(request.QuestionUid);
32 }
33 }
34}
Note: See TracBrowser for help on using the repository browser.