klesh commented on code in PR #6424:
URL:
https://github.com/apache/incubator-devlake/pull/6424#discussion_r1448264503
##########
backend/plugins/gitlab/models/migrationscripts/archived/account.go:
##########
@@ -18,19 +18,22 @@ limitations under the License.
package archived
import (
+ "time"
+
"github.com/apache/incubator-devlake/core/models/migrationscripts/archived"
)
type GitlabAccount struct {
- ConnectionId uint64 `gorm:"primaryKey"`
- GitlabId int `gorm:"primaryKey"`
- Username string `gorm:"type:varchar(255)"`
- Email string `gorm:"type:varchar(255)"`
- Name string `gorm:"type:varchar(255)"`
- State string `gorm:"type:varchar(255)"`
- MembershipState string `json:"membership_state"
gorm:"type:varchar(255)"`
- AvatarUrl string `json:"avatar_url" gorm:"type:varchar(255)"`
- WebUrl string `json:"web_url" gorm:"type:varchar(255)"`
+ ConnectionId uint64 `gorm:"primaryKey"`
+ GitlabId int `gorm:"primaryKey"`
+ Username string `gorm:"type:varchar(255)"`
+ Email string `gorm:"type:varchar(255)"`
+ Name string `gorm:"type:varchar(255)"`
+ State string `gorm:"type:varchar(255)"`
+ MembershipState string `json:"membership_state"
gorm:"type:varchar(255)"`
+ AvatarUrl string `json:"avatar_url" gorm:"type:varchar(255)"`
+ WebUrl string `json:"web_url" gorm:"type:varchar(255)"`
+ CreatedUserAt *time.Time `json:"created_at"`
Review Comment:
archived model should not be modified.
##########
backend/plugins/gitlab/tasks/account_extractor.go:
##########
@@ -52,16 +56,34 @@ func ExtractAccounts(taskCtx plugin.SubTaskContext)
errors.Error {
}
results := make([]interface{}, 0)
- GitlabAccount := &models.GitlabAccount{
- ConnectionId: data.Options.ConnectionId,
- GitlabId: userRes.GitlabId,
- Username: userRes.Username,
- Name: userRes.Name,
- State: userRes.State,
- MembershipState: userRes.MembershipState,
- AvatarUrl: userRes.AvatarUrl,
- WebUrl: userRes.WebUrl,
+ var GitlabAccount *models.GitlabAccount
+ if skipCreatedUserAt {
+ GitlabAccount = &models.GitlabAccount{
+ ConnectionId:
data.Options.ConnectionId,
+ GitlabId: userRes.GitlabId,
+ Username: userRes.Username,
+ Name: userRes.Name,
+ State: userRes.State,
+ MembershipState:
userRes.MembershipState,
+ AvatarUrl: userRes.AvatarUrl,
+ WebUrl: userRes.WebUrl,
+ Email: userRes.Email,
+ }
+ } else {
+ GitlabAccount = &models.GitlabAccount{
+ ConnectionId:
data.Options.ConnectionId,
+ GitlabId: userRes.GitlabId,
+ Username: userRes.Username,
+ Name: userRes.Name,
+ State: userRes.State,
+ MembershipState:
userRes.MembershipState,
+ AvatarUrl: userRes.AvatarUrl,
+ WebUrl: userRes.WebUrl,
+ Email: userRes.Email,
+ CreatedUserAt: userRes.CreatedUserAt,
Review Comment:
The `userRes.CreatedUserAt` would be `nil` for Gitlab Cloud anyway, isn't it?
We don't need to handle them differently if so.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]