Ejemplo n.º 1
0
        public async Task <ProjectDto> CreateProjectAsync(ProjectDto project)
        {
            await ValidateProject(project);

            var           mappedEntity   = _mapper.Map <ProjectEntity>(project);
            ProjectEntity createdProject = await _projectStorage.CreateAsync(mappedEntity);

            // By default when project is created, there is only 1 ProjectUser
            // the user that created the project aka project owner.
            var projectOwner    = project.ProjectUsers.First();
            var notificationDto = new NotificationDto(projectOwner.UserId)
            {
                NotificationObject = project
            };

            if (project.CommunicationPlatform != "other")
            {
                // send workspace app download link if CommunicationPlatform not
                // set to other
                await _notifier.SendProjectPostedNotificationAsync(notificationDto);
            }

            ProjectDto mappedProject = _mapper.Map <ProjectDto>(createdProject);
            await _messageQueue.SendMessageAsync(mappedProject, "projectpost", queueName : _pubSlackAppQueueName);

            await RecomputeProjectCollaboratorSuggestions(mappedProject, true);

            return(mappedProject);
        }