-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added map struct for external ids #320
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,6 +300,7 @@ func (sa *Adapter) LoginUser(clientID string, current *model.User) error { | |
primitive.E{Key: "external_id", Value: current.ExternalID}, | ||
primitive.E{Key: "net_id", Value: current.NetID}, | ||
primitive.E{Key: "date_updated", Value: now}, | ||
primitive.E{Key: "external_ids", Value: current.ExternalIDs}, | ||
}}, | ||
} | ||
_, err = sa.db.groupMemberships.UpdateManyWithContext(context, filter, update, nil) | ||
|
@@ -452,6 +453,7 @@ func (sa *Adapter) CreateGroup(clientID string, current *model.User, group *mode | |
castedMemberships = append(castedMemberships, membership) | ||
} | ||
} else if current != nil { | ||
externalIDs := map[string]string{"netID": current.NetID, "externalID": current.ExternalID} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use under scores instead of camel names. Camel names are not wrong approach. The idea is just to keep common standard within the project. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also in this way of thoughts externalID is better to be renamed to uin, uiuc_uin if we gonna support more such attributes and external ids... CC @shurwit |
||
castedMemberships = append(castedMemberships, model.GroupMembership{ | ||
ID: uuid.NewString(), | ||
GroupID: insertedID, | ||
|
@@ -464,6 +466,7 @@ func (sa *Adapter) CreateGroup(clientID string, current *model.User, group *mode | |
Status: "admin", // TODO needs more consideration (status vs flag) | ||
Admin: true, | ||
DateCreated: now, | ||
ExternalIDs: externalIDs, | ||
}) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -921,6 +921,7 @@ func (h *ApisHandler) CreatePendingMember(clientID string, current *model.User, | |
NetID: current.NetID, | ||
Email: current.Email, | ||
MemberAnswers: mAnswers, | ||
ExternalIDs: current.ExternalIDs, | ||
} | ||
|
||
if requestData.NotificationsPreferences != nil { | ||
|
@@ -1122,6 +1123,7 @@ func (h *ApisHandler) CreateMember(clientID string, current *model.User, w http. | |
return | ||
} | ||
|
||
externalIDs := map[string]string{"netID": current.NetID, "externalID": current.ExternalID} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above/below |
||
member := model.GroupMembership{ | ||
GroupID: groupID, | ||
UserID: requestData.UserID, | ||
|
@@ -1132,6 +1134,7 @@ func (h *ApisHandler) CreateMember(clientID string, current *model.User, w http. | |
PhotoURL: requestData.PhotoURL, | ||
Status: requestData.Status, | ||
DateAttended: requestData.DateAttended, | ||
ExternalIDs: externalIDs, | ||
} | ||
|
||
err = h.app.Services.CreateMembership(clientID, current, group, &member) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we gonna support a map wih key value pairs for all external ids, then I would highly appriaciate to take out the legacy field and make a migration.