public HomeController(IProjectRepository projectRepository, IProjectCommentsRepository commentsRepository,
                       IProjectCategoriesRepository categoriesRepository, IProjectParticipantsRepository participantsRepository,
                       IProjectFollowRepository projectFollowRepository, IProjectResultRepository resultsRepository,
                       IProjectWinnersRepository winnersRepository, IUserFeedbackRepository feedbackRepository,
                       IUserRolesRepository userRolesRepository, BaseSettings settings,
                       IPersonalDataService personalDataService, IStreamsIdRepository streamsIdRepository,
                       IEmailSender emailSender, ITermsPageRepository termsPageRepository,
                       IPublicFeedbackRepository publicFeedbackRepository)
 {
     _projectRepository       = projectRepository;
     _commentsRepository      = commentsRepository;
     _categoriesRepository    = categoriesRepository;
     _participantsRepository  = participantsRepository;
     _projectFollowRepository = projectFollowRepository;
     _resultsRepository       = resultsRepository;
     _winnersRepository       = winnersRepository;
     _feedbackRepository      = feedbackRepository;
     _userRolesRepository     = userRolesRepository;
     _settings                 = settings;
     _personalDataService      = personalDataService;
     _streamsIdRepository      = streamsIdRepository;
     _emailSender              = emailSender;
     _termsPageRepository      = termsPageRepository;
     _publicFeedbackRepository = publicFeedbackRepository;
 }
Example #2
0
        // In order to deal with the async data fetch, use this method instead of a constructor (factory pattern)
        // e.g. var compactProjectList = await CreateCompactProject(baseProjectList)
        public static Task <CompactProjectList> CreateCompactProjectList(
            IEnumerable <IProjectData> baseProjectList,
            IProjectCommentsRepository commentsRepository,
            IProjectParticipantsRepository participantsRepository,
            IProjectFollowRepository projectFollowRepository,
            IProjectResultRepository resultsRepository,
            IProjectWinnersRepository winnersRepository,
            string userEmail,
            IPersonalDataService personalDataService,
            IStreamsIdRepository streamsIdRepository
            )
        {
            var returnCompactProjectList = new CompactProjectList(baseProjectList);

            return(returnCompactProjectList.FetchData(
                       commentsRepository,
                       participantsRepository,
                       projectFollowRepository,
                       resultsRepository,
                       winnersRepository,
                       userEmail,
                       personalDataService,
                       streamsIdRepository
                       ));
        }
Example #3
0
        /*
         * TODO: Refactor? Tradeoff is seamless list creation on construction instead of separate function to populate all the data,
         * downside is having to pass in a lot of arguments to a model
         */
        private async Task <CompactProjectList> FetchData(
            IProjectCommentsRepository commentsRepository,
            IProjectParticipantsRepository participantsRepository,
            IProjectFollowRepository projectFollowRepository,
            IProjectResultRepository resultsRepository,
            IProjectWinnersRepository winnersRepository,
            string userEmail,
            IPersonalDataService personalDataService,
            IStreamsIdRepository streamsIdRepository
            )
        {
            foreach (var compactProject in _compactProjectsModelList)
            {
                compactProject.CommentsCount = await commentsRepository.GetProjectCommentsCountAsync(compactProject.BaseProjectData.Id);

                compactProject.ParticipantsCount = await participantsRepository.GetProjectParticipantsCountAsync(compactProject.BaseProjectData.Id);

                compactProject.ResultsCount = await resultsRepository.GetResultsCountAsync(compactProject.BaseProjectData.Id);

                compactProject.WinnersCount = await winnersRepository.GetWinnersCountAsync(compactProject.BaseProjectData.Id);

                compactProject.Tags        = FetchTags(compactProject.BaseProjectData.Tags);
                compactProject.IsFollowing = await CheckIsFollowing(projectFollowRepository, userEmail,
                                                                    compactProject.BaseProjectData.Id);
            }

            _compactProjectsModelList = await FetchAuthorAvatars(_compactProjectsModelList, personalDataService);

            _compactProjectsModelList = await FetchAuthorStreamsIds(_compactProjectsModelList, streamsIdRepository);

            return(this);
        }
        public ProjectDetailsController(IProjectCommentsRepository commentsRepository, IProjectFileRepository fileRepository,
                                        IProjectFileInfoRepository fileInfoRepository, IProjectVoteRepository voteRepository,
                                        IProjectRepository projectRepository, IProjectParticipantsRepository participantsRepository,
                                        IProjectResultRepository resultRepository, IProjectResultVoteRepository resultVoteRepository,
                                        IProjectFollowRepository projectFollowRepository, IFollowMailSentRepository mailSentRepository,
                                        IQueueExt emailsQueue, IUserRolesRepository userRolesRepository,
                                        IProjectWinnersRepository winnersRepository, ILogFactory logFactory,
                                        IEmailSender emailSender,
                                        BaseSettings settings, IStreamsIdRepository streamsIdRepository)
        {
            _commentsRepository      = commentsRepository;
            _fileRepository          = fileRepository;
            _fileInfoRepository      = fileInfoRepository;
            _voteRepository          = voteRepository;
            _projectRepository       = projectRepository;
            _participantsRepository  = participantsRepository;
            _resultRepository        = resultRepository;
            _resultVoteRepository    = resultVoteRepository;
            _projectFollowRepository = projectFollowRepository;
            _mailSentRepository      = mailSentRepository;
            _emailsQueue             = emailsQueue;
            _userRolesRepository     = userRolesRepository;
            _winnersRepository       = winnersRepository;
            _settings            = settings;
            _emailSender         = emailSender;
            _streamsIdRepository = streamsIdRepository;

            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }
            _log = logFactory.CreateLog(this);
        }
Example #5
0
        public static async Task <List <ProjectCompactViewModel> > FetchAuthorStreamsIds(
            List <ProjectCompactViewModel> compactProjectsModelList, IStreamsIdRepository streamsIdRepository)
        {
            foreach (var project in compactProjectsModelList)
            {
                var authorStreamsId = await streamsIdRepository.GetOrCreateAsync(project.BaseProjectData.AuthorIdentifier);

                project.AuthorStreamsId = authorStreamsId.StreamsId;
            }

            return(compactProjectsModelList);
        }
Example #6
0
        public static async void GenerateStreamsId(IStreamsIdRepository streamsIdRepository, string clientId)
        {
            var streamsId = await streamsIdRepository.GetOrCreateAsync(clientId);

            if (streamsId == null)
            {
                var newEntity = new StreamsIdEntity
                {
                    ClientId = clientId
                };

                await streamsIdRepository.SaveAsync(newEntity);
            }
        }
        public ProjectController(IProjectRepository projectRepository, IProjectCommentsRepository commentsRepository,
                                 IProjectFileRepository fileRepository, IProjectFileInfoRepository fileInfoRepository,
                                 IProjectParticipantsRepository participantsRepository, IProjectCategoriesRepository categoriesRepository,
                                 IProjectResultRepository resultRepository, IProjectFollowRepository projectFollowRepository,
                                 IProjectWinnersRepository winnersRepository, IUserRolesRepository userRolesRepository,
                                 IProjectWinnersService winnersService, IQueueExt emailsQueue,
                                 IProjectResultVoteRepository resultVoteRepository, BaseSettings settings,
                                 IProjectExpertsRepository projectExpertsRepository,
                                 IStreamRepository streamRepository, IPersonalDataService personalDataService,
                                 Lykke.Messages.Email.IEmailSender emailSender,
                                 IStreamsIdRepository streamsIdRepository, IExpertsService expertsService,
                                 IKycProfileServiceV2 kycService, ITermsPageRepository termsPageRepository,
                                 ILogFactory logFactory)
        {
            _projectRepository       = projectRepository;
            _commentsRepository      = commentsRepository;
            _fileRepository          = fileRepository;
            _fileInfoRepository      = fileInfoRepository;
            _participantsRepository  = participantsRepository;
            _categoriesRepository    = categoriesRepository;
            _resultRepository        = resultRepository;
            _projectFollowRepository = projectFollowRepository;
            _winnersRepository       = winnersRepository;
            _userRolesRepository     = userRolesRepository;
            _winnersService          = winnersService;
            _emailsQueue             = emailsQueue;
            _resultVoteRepository    = resultVoteRepository;
            _settings = settings;
            _projectExpertsRepository = projectExpertsRepository;
            _streamRepository         = streamRepository;
            _personalDataService      = personalDataService;
            _emailSender         = emailSender;
            _streamsIdRepository = streamsIdRepository;
            _expertsService      = expertsService;
            _kycService          = kycService;
            _termsPageRepository = termsPageRepository;

            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }
            _log = logFactory.CreateLog(this);
        }
 public UserProfileController(BaseSettings settings, IProjectRepository projectRepository,
                              IProjectCommentsRepository commentsRepository, IProjectParticipantsRepository participantsRepository,
                              IProjectResultRepository resultsRepository, IProjectWinnersRepository winnersRepository,
                              IPersonalDataService personalDataService, IProjectFollowRepository projectFollowRepository,
                              IUserRolesRepository userRolesRepository, IStreamsIdRepository streamsIdRepository,
                              IProjectExpertsRepository expertsRepository)
 {
     _settings                = settings;
     _projectRepository       = projectRepository;
     _commentsRepository      = commentsRepository;
     _participantsRepository  = participantsRepository;
     _resultsRepository       = resultsRepository;
     _winnersRepository       = winnersRepository;
     _personalDataService     = personalDataService;
     _projectFollowRepository = projectFollowRepository;
     _userRolesRepository     = userRolesRepository;
     _streamsIdRepository     = streamsIdRepository;
     _expertsRepository       = expertsRepository;
 }