Closed usharerose closed 3 months ago
Hey there, @usharerose! I'm here to assist you with any bugs, questions, or contributions you have in mind. Let me know how I can help while we wait for a human maintainer.
To ensure that the GitLab plugin normalizes account-related ID values for the Convert MR Assignees
and Convert MR Reviewers
subtasks in the Domain Layer data, the code should use the didgen.NewDomainIdGenerator
function. This function generates domain-specific IDs for the merge requests, which are then used to create normalized PullRequestAssignee
and PullRequestReviewer
objects.
Here is the relevant code snippet that demonstrates this normalization process for both assignees and reviewers:
mrIdGen := didgen.NewDomainIdGenerator(&models.GitlabMergeRequest{})
converter, err := helper.NewDataConverter(helper.DataConverterArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
InputRowType: reflect.TypeOf(models.GitlabAssignee{}),
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
mrAssignee := inputRow.(*models.GitlabAssignee)
domainPrAssigne := &code.PullRequestAssignee{
PullRequestId: mrIdGen.Generate(data.Options.ConnectionId, mrAssignee.MergeRequestId),
AssigneeId: mrAssignee.AssigneeId,
Name: mrAssignee.Name,
UserName: mrAssignee.Username,
}
return []interface{}{
domainPrAssigne,
}, nil
},
})
converter, err := helper.NewDataConverter(helper.DataConverterArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
InputRowType: reflect.TypeOf(models.GitlabReviewer{}),
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
mrReviewer := inputRow.(*models.GitlabReviewer)
domainPrReviewer := &code.PullRequestReviewer{
PullRequestId: mrIdGen.Generate(data.Options.ConnectionId, mrReviewer.MergeRequestId),
ReviewerId: mrReviewer.ReviewerId,
Name: mrReviewer.Name,
UserName: mrReviewer.Username,
}
return []interface{}{
domainPrReviewer,
}, nil
},
})
In this code:
mrIdGen := didgen.NewDomainIdGenerator(&models.GitlabMergeRequest{})
creates a new domain ID generator for GitLab merge requests.mrIdGen.Generate(data.Options.ConnectionId, mrAssignee.MergeRequestId)
and mrIdGen.Generate(data.Options.ConnectionId, mrReviewer.MergeRequestId)
generate normalized domain-specific IDs for each merge request assignee and reviewer, respectively.PullRequestId
is then used to create PullRequestAssignee
and PullRequestReviewer
objects, ensuring that the ID values are normalized in the Domain Layer data [1][2].Additionally, the ConvertAccounts
function in the Convert Users
subtask demonstrates a similar normalization process for GitLab accounts, ensuring consistency across different types of data [3].
To continue talking to Dosu, mention @dosu.
Search before asking
What happened
GitLab plugin provides
Convert MR Assignees
andConvert MR Reviewers
subtasks. In Domain Layer data, account-related ID values are original one from raw data, not converting to normalized one.reviewer's implementation: link
assignee's implementation: link
What do you expect to happen
Should be normalized account ID
How to reproduce
Trigger GitLab tasks
Anything else
No response
Version
6a9c0eb4d28a80e1302ba5e1c73e8dc5cfc371bc
Are you willing to submit PR?
Code of Conduct