Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public Model.Bug ChildBugToBug(Model.ChildBug childBug)
 {
     return(new Model.Bug(childBug.Id, childBug.ProjectId, childBug.Title, childBug.Description, childBug.Status, childBug.ReporterId, childBug.AssigneeId,
                          childBug.CreatedAt, childBug.UpdatedAt, childBug.Labels, childBug.Comments));
 }