Skip to content
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

Fix #219 Fix user object to ensure backward compatibility #220

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions src/user/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ import (

// Org Organization snippet stored as part of user
type Org struct {
OrgID primitive.ObjectID `bson:"orgid,omitempty"`
Name string
Location string
Type string
TypeID primitive.ObjectID
EulaAccepted bool
}
type OrgV2 struct {
OrgID primitive.ObjectID `bson:"orgid,omitempty" json:"id"`
Name string `json:"name"`
Location string `json:"location"`
Type string `json:"type"`
TypeID primitive.ObjectID `bson:"typeid,omitempty" json:"typeId"`
EulaAccepted bool `json:"lastVisit"`
EulaAccepted bool `json:"eulaAccepted"`
}

// ClientInfo The client device details.
Expand All @@ -41,25 +49,29 @@ type ClientInfo struct {

// Role Role assignment to user
type Role struct {
RoleID int
OrgID string
}
type RoleV2 struct {
RoleID int `json:"roleId"`
OrgID string `json:"orgId"`
}

// User data type
type User struct {
ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`
Name string `json:"name"`
IamID string `json:"iamId"`
Email string `json:"email"`
Phone string `json:"phone"`
ImageID string `json:"imageId"`
ImageURL string `json:"imageUrl"`
LastVisit string `json:"lastVisit"` //TODO Replace with ISODate()
Client ClientInfo `json:"client"`
Orgs []Org `json:"orgs"`
APIKey string `json:"apiKey"`
Roles []Role `json:"roles"`
IncompleteProfile bool `json:"incompleteProfile"`
ID primitive.ObjectID `bson:"_id,omitempty"`
Name string
IamID string
Email string
Phone string
ImageID string
ImageURL string
LastVisit string //TODO Replace with ISODate()
Client ClientInfo
Orgs []Org
APIKey string
Roles []Role
IncompleteProfile bool
}

type UserV2 struct {
Expand All @@ -74,9 +86,9 @@ type UserV2 struct {
ImageID string `json:"imageId"`
ImageURL string `json:"imageUrl"`
LastVisit string `json:"lastVisit"` //TODO Replace with ISODate()
Orgs []Org `json:"orgs"`
Orgs []OrgV2 `json:"orgs"`
APIKey string `json:"apiKey"`
Roles []Role `json:"roles"`
Roles []RoleV2 `json:"roles"`
IncompleteProfile bool `json:"incompleteProfile"`
}

Expand Down