Beispiel #1
0
        public async Task <Model.ChildBug> GenerateChildBug(IAddBugTo command)
        {
            await authorizationService.CheckUserMembership(callContext.UserId, command.ProjectId);

            var issue = new Model.ChildBug(
                id: Guid.NewGuid(),
                projectId: command.ProjectId,
                title: command.Title,
                description: command.Description,
                status: IssueStatus.Todo,
                reporterId: callContext.UserId,
                assigneeId: null,
                createdAt: DateTime.UtcNow,
                updatedAt: DateTime.UtcNow
                );

            if (command.LabelsIds != null)
            {
                var labels = await labelsSearcher.GetLabels(command.ProjectId);

                issue.AssignLabels(command.LabelsIds, labels);
            }

            if (command.AssigneeId != null)
            {
                var assignee = await userRepository.GetAsync(command.AssigneeId.Value);

                await issue.AssignAssignee(assignee, authorizationService);
            }

            command.CreatedId = issue.Id;
            return(issue);
        }
Beispiel #2
0
        public virtual async System.Threading.Tasks.Task Comment(Guid memberId, string content, IMembershipService authorizationService)
        {
            await authorizationService.CheckUserMembership(memberId, ProjectId);

            var comment = new Comment.Comment(memberId, content);

            if (Comments == null)
            {
                Comments = new List <Comment.Comment>();
            }
            Comments.Add(comment);
        }
        public async Task <Model.Sprint> GenerateSprint(CreateSprint command)
        {
            await authorizationService.CheckUserMembership(callContext.UserId, command.ProjectId);

            if (!await projectSearcher.DoesProjectExist(command.ProjectId))
            {
                throw new EntityDoesNotExist(command.ProjectId, nameof(Project.Model.Project));
            }

            var sprint = new Model.Sprint(Guid.NewGuid(), command.ProjectId, command.Name, command.Start, command.End);

            sprint.Created();
            command.CreatedId = sprint.Id;
            return(sprint);
        }
Beispiel #4
0
        public virtual async System.Threading.Tasks.Task MarkAsInProgress(Guid memberId, IMembershipService authorizationService)
        {
            await authorizationService.CheckUserMembership(memberId, ProjectId);

            if (SprintId == null)
            {
                throw new IssueNotAssignedToSprint(Id, DomainInformationProvider.Name);
            }

            if (Status != IssueStatus.Todo)
            {
                throw new CannotChangeIssueStatus(Id, Status, IssueStatus.InProgress, DomainInformationProvider.Name);
            }

            Status    = IssueStatus.InProgress;
            UpdatedAt = DateTime.UtcNow;
        }
Beispiel #5
0
        public virtual async System.Threading.Tasks.Task AssignAssignee(User.Model.Member assignee, IMembershipService authorizationService)
        {
            await authorizationService.CheckUserMembership(assignee.Id, ProjectId);

            AssigneeId = assignee.Id;
        }