Skip to content
This repository was archived by the owner on May 24, 2024. It is now read-only.

Commit 8b8da57

Browse files
Merge pull request #9 from LF-Engineering/unicron-update-to-new-schema
Update to new schema
2 parents b0d298b + 857fcdf commit 8b8da57

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

cmd/git/git.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,11 +1093,16 @@ func (j *DSGit) GetModelData(ctx *shared.Ctx, docs []interface{}) []insights.Com
10931093
commit.ParentSHAs, _ = doc["parents"].([]string)
10941094
commit.AuthoredTimestamp, _ = doc["author_date"].(time.Time)
10951095
authoredDt, _ := doc["utc_author"].(time.Time)
1096-
id, err := repository.GenerateRepositoryID(commit.Source, commit.RepositoryURL, "")
1096+
repoID, err := repository.GenerateRepositoryID(commit.Source, commit.RepositoryURL, "")
10971097
if err != nil {
10981098
shared.Printf("GenerateRepositoryID %+v", err)
10991099
}
1100-
commit.RepositoryID = id
1100+
commit.RepositoryID = repoID
1101+
commitID, err := insights.GenerateCommitID(repoID, commit.SHA)
1102+
if err != nil {
1103+
shared.Printf("GenerateCommitID %+v", err)
1104+
}
1105+
commit.ID = commitID
11011106
commit.RepositoryURL, _ = doc["origin"].(string)
11021107
commit.CommittedTimestamp, _ = doc["commit_date"].(time.Time)
11031108
createdOn := authoredDt
@@ -1110,15 +1115,20 @@ func (j *DSGit) GetModelData(ctx *shared.Ctx, docs []interface{}) []insights.Com
11101115
commitRole := insights.Contributor{}
11111116
ident := identsAry[i]
11121117
identType := identTypesAry[i]
1113-
commitRole.Role = identType
1118+
commitRole.Role = insights.Role(identType)
11141119
commitRole.Weight = 1.0
11151120
name := ident[0]
11161121
username := ""
11171122
email := ident[2]
11181123
name, username = shared.PostprocessNameUsername(name, username, email)
1124+
userID, err := user.GenerateIdentity(&commit.Source, &email, &name, &username)
1125+
if err != nil {
1126+
shared.Printf("GenerateIdentity %+v", err)
1127+
}
11191128
commitRole.Identity = user.UserIdentityObjectBase{
1129+
ID: userID,
11201130
Email: email,
1121-
FirstName: name,
1131+
Name: name,
11221132
IsVerified: false,
11231133
Username: username,
11241134
Source: commit.Source,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.15
44

55
require (
66
github.com/LF-Engineering/insights-datasource-shared v1.1.2
7-
github.com/LF-Engineering/lfx-event-schema v0.0.0-20220104115800-c9beab510219
7+
github.com/LF-Engineering/lfx-event-schema v0.1.0
88
github.com/aws/aws-lambda-go v1.27.1
99
github.com/aws/aws-sdk-go v1.42.25
1010
github.com/json-iterator/go v1.1.11

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ github.com/LF-Engineering/insights-datasource-shared v1.1.2 h1:Qshsnv+czWrOa05Bk
33
github.com/LF-Engineering/insights-datasource-shared v1.1.2/go.mod h1:UnhIW7bkbrVFuons0pWx6BiyHhoQGEsM9W4LuGV2Lf0=
44
github.com/LF-Engineering/lfx-event-schema v0.0.0-20220104115800-c9beab510219 h1:g6F91PfwEYTISAqOASH0Qor+sb4I+TuHQ/sl7JyBPyM=
55
github.com/LF-Engineering/lfx-event-schema v0.0.0-20220104115800-c9beab510219/go.mod h1:GvEBmXvYGafFRIpZ6I0G5Ss4jsmkBNptLJIasLClXu8=
6+
github.com/LF-Engineering/lfx-event-schema v0.1.0 h1:xPAuzukY3ibV5syzINlxTqKaZ+xi8+aC1Erm1kTDpig=
7+
github.com/LF-Engineering/lfx-event-schema v0.1.0/go.mod h1:GvEBmXvYGafFRIpZ6I0G5Ss4jsmkBNptLJIasLClXu8=
68
github.com/alecthomas/jsonschema v0.0.0-20210920000243-787cd8204a0d/go.mod h1:/n6+1/DWPltRLWL/VKyUxg6tzsl5kHUCcraimt4vr60=
79
github.com/aws/aws-lambda-go v1.27.1 h1:MAH6hbrsktcSr/gGQKLvHeJPeoOoaspJqh+O4g05bpA=
810
github.com/aws/aws-lambda-go v1.27.1/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU=

0 commit comments

Comments
 (0)