Convert the API response to our DB model instance
()
| 73 | |
| 74 | // Convert the API response to our DB model instance |
| 75 | func (gitlabApiProject GitlabApiProject) ConvertApiScope() *GitlabProject { |
| 76 | p := &GitlabProject{} |
| 77 | p.GitlabId = gitlabApiProject.GitlabId |
| 78 | p.Name = gitlabApiProject.Name |
| 79 | p.Description = gitlabApiProject.Description |
| 80 | p.DefaultBranch = gitlabApiProject.DefaultBranch |
| 81 | p.CreatorId = gitlabApiProject.CreatorId |
| 82 | p.PathWithNamespace = gitlabApiProject.PathWithNamespace |
| 83 | p.WebUrl = gitlabApiProject.WebUrl |
| 84 | p.HttpUrlToRepo = gitlabApiProject.HttpUrlToRepo |
| 85 | p.Visibility = gitlabApiProject.Visibility |
| 86 | p.OpenIssuesCount = gitlabApiProject.OpenIssuesCount |
| 87 | p.StarCount = gitlabApiProject.StarCount |
| 88 | p.Archived = gitlabApiProject.Archived |
| 89 | p.CreatedDate = gitlabApiProject.CreatedAt.ToNullableTime() |
| 90 | p.UpdatedDate = common.Iso8601TimeToTime(gitlabApiProject.LastActivityAt) |
| 91 | if gitlabApiProject.ForkedFromProject != nil { |
| 92 | p.ForkedFromProjectId = gitlabApiProject.ForkedFromProject.GitlabId |
| 93 | p.ForkedFromProjectWebUrl = gitlabApiProject.ForkedFromProject.WebUrl |
| 94 | } |
| 95 | // this might happen when GitlabConnection.SearchScopes |
| 96 | if len(p.Name) > len(p.PathWithNamespace) { |
| 97 | p.Name, p.PathWithNamespace = p.PathWithNamespace, p.Name |
| 98 | } |
| 99 | return p |
| 100 | } |
| 101 | |
| 102 | type GitlabApiProject struct { |
| 103 | GitlabId int `json:"id"` |
no test coverage detected