public RemarkVoteSubmittedHandler(IHandler handler,
                                   IRemarkStatisticsRepository remarkStatisticsRepository,
                                   IUserStatisticsRepository userStatisticsRepository,
                                   IServiceClient serviceClient)
 {
     _handler = handler;
     _remarkStatisticsRepository = remarkStatisticsRepository;
     _userStatisticsRepository   = userStatisticsRepository;
     _serviceClient = serviceClient;
 }
示例#2
0
 public RemarkProcessedHandler(IHandler handler,
                               IRemarkStatisticsRepository remarkStatisticsRepository,
                               IUserStatisticsRepository userStatisticsRepository,
                               ICategoryStatisticsRepository categoryStatisticsRepository,
                               ITagStatisticsRepository tagStatisticsRepository,
                               IServiceClient serviceClient) :
     base(handler, remarkStatisticsRepository,
          userStatisticsRepository, categoryStatisticsRepository,
          tagStatisticsRepository, serviceClient)
 {
     Setup(x => { x.Remarks.IncreaseProcessing(); },
           x => { x.Remarks.IncreaseProcessing(); },
           x => { x.Remarks.IncreaseProcessing(); });
 }
示例#3
0
 public RemarkResolvedHandler(IHandler handler,
                              IRemarkStatisticsRepository remarkStatisticsRepository,
                              IUserStatisticsRepository userStatisticsRepository,
                              ICategoryStatisticsRepository categoryStatisticsRepository,
                              ITagStatisticsRepository tagStatisticsRepository,
                              IServiceClient serviceClient) :
     base(handler, remarkStatisticsRepository,
          userStatisticsRepository, categoryStatisticsRepository,
          tagStatisticsRepository, serviceClient)
 {
     Setup(x => { x.Remarks.IncreaseResolved(); x.Remarks.DecreaseNew(); },
           x => { x.Remarks.IncreaseResolved(); x.Remarks.DecreaseNew(); },
           x => { x.Remarks.IncreaseResolved(); x.Remarks.DecreaseNew(); });
 }
 public RemarkStateChangedBaseHandler(IHandler handler,
                                      IRemarkStatisticsRepository remarkStatisticsRepository,
                                      IUserStatisticsRepository userStatisticsRepository,
                                      ICategoryStatisticsRepository categoryStatisticsRepository,
                                      ITagStatisticsRepository tagStatisticsRepository,
                                      IServiceClient serviceClient)
 {
     _handler = handler;
     _remarkStatisticsRepository   = remarkStatisticsRepository;
     _userStatisticsRepository     = userStatisticsRepository;
     _categoryStatisticsRepository = categoryStatisticsRepository;
     _tagStatisticsRepository      = tagStatisticsRepository;
     _serviceClient = serviceClient;
 }
        public StatisticsModule(IRemarkStatisticsRepository remarkStatisticsRepository,
                                IUserStatisticsRepository userStatisticsRepository,
                                ICategoryStatisticsRepository categoryStatisticsRepository,
                                ITagStatisticsRepository tagStatisticsRepository,
                                IMapper mapper) : base(mapper, "statistics")
        {
            Get("remarks", async args => await FetchCollection <BrowseRemarkStatistics, RemarkStatistics>
                    (async x => await remarkStatisticsRepository.BrowseAsync(x))
                .MapTo <RemarkStatistics>()
                .HandleAsync());

            Get("remarks/{id}", async args => await Fetch <GetRemarkStatistics, RemarkStatistics>
                    (async x => await remarkStatisticsRepository.GetAsync(x.Id))
                .MapTo <RemarkStatistics>()
                .HandleAsync());

            Get("remarks/general", async args => await Fetch <GetRemarkGeneralStatistics, RemarksCountStatistics>
                    (async x => await remarkStatisticsRepository.GetGeneralStatisticsAsync(x))
                .MapTo <RemarksCountStatisticsDto>()
                .HandleAsync());

            Get("categories", async args => await FetchCollection <BrowseCategoryStatistics, CategoryStatistics>
                    (async x => await categoryStatisticsRepository.BrowseAsync(x))
                .MapTo <CategoryStatisticsDto>()
                .HandleAsync());

            Get("tags", async args => await FetchCollection <BrowseTagStatistics, TagStatistics>
                    (async x => await tagStatisticsRepository.BrowseAsync(x))
                .MapTo <TagStatisticsDto>()
                .HandleAsync());

            Get("users", async args => await FetchCollection <BrowseUserStatistics, UserStatistics>
                    (async x => await userStatisticsRepository.BrowseAsync(x))
                .MapTo <UserStatisticsDto>()
                .HandleAsync());

            Get("users/{id}", async args => await Fetch <GetUserStatistics, UserStatistics>
                    (async x => await userStatisticsRepository.GetByIdAsync(x.Id))
                .MapTo <UserStatisticsDto>()
                .HandleAsync());
        }