Compare commits

...
Author SHA1 Message Date
phoenix 6f90428975 Fixed issue
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Failing after 7s
Go CI / Test and Lint (push) Failing after 17s
2026-05-27 22:50:56 -04:00
phoenix c3ec0731b2 Added comments to fields
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Failing after 6s
Go CI / Test and Lint (push) Failing after 17s
2026-05-27 22:49:59 -04:00
phoenix 413d9baffd Fix
Go Release / build-and-release (pull_request) Successful in 5s
Go CI / Test and Lint (pull_request) Failing after 6s
Go CI / Test and Lint (push) Failing after 17s
2026-05-27 22:49:40 -04:00
phoenix 87a437311b Test fix 2026-05-27 22:49:30 -04:00
phoenix 2820cdfed6 Fixed error
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (push) Failing after 16s
Go CI / Test and Lint (pull_request) Failing after 6s
2026-05-27 22:47:21 -04:00
3 changed files with 5 additions and 12 deletions
+2
View File
@@ -11,7 +11,9 @@ type User struct {
PhoneNumber string `json:"phone_number"` PhoneNumber string `json:"phone_number"`
Username string `json:"username"` Username string `json:"username"`
Password string `json:"password"` Password string `json:"password"`
// Firstname is a pointer
Firstname *string `json:"first_name,omitempty"` Firstname *string `json:"first_name,omitempty"`
// Lastname is a pointer
Lastname *string `json:"last_name,omitempty"` Lastname *string `json:"last_name,omitempty"`
Created time.Time `json:"created"` Created time.Time `json:"created"`
LastLogin *time.Time `json:"last_login,omitempty"` LastLogin *time.Time `json:"last_login,omitempty"`
+2 -9
View File
@@ -14,8 +14,8 @@ type UserProfile struct {
Username string `json:"username"` Username string `json:"username"`
Firstname string `json:"firstname"` Firstname string `json:"firstname"`
Lastname string `json:"lastname"` Lastname string `json:"lastname"`
Created time `json:"created"` Created time.Time `json:"created"`
LastLogin *time `json:"last_login,omitempty"` LastLogin *time.Time `json:"last_login,omitempty"`
} }
func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) {
@@ -23,9 +23,6 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) {
return nil, fmt.Errorf("User is empty") return nil, fmt.Errorf("User is empty")
} else { } else {
usrProfile = new(UserProfile) usrProfile = new(UserProfile)
if len(usr.Password) > 0 {
// newUsr := User{Id: usr.Id, PhoneNumber: usr.PhoneNumber, Username: usr.Username, Firstname: usr.Firstname, Lastname: usr.Lastname, Created: usr.Created, LastLogin: usr.LastLogin}
// usrProfile.Usr = &newUsr
usrProfile.UserId = usr.Id usrProfile.UserId = usr.Id
usrProfile.PhoneNumber = usr.PhoneNumber usrProfile.PhoneNumber = usr.PhoneNumber
usrProfile.Username = usr.Username usrProfile.Username = usr.Username
@@ -37,9 +34,5 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) {
} }
return usrProfile, nil return usrProfile, nil
} else {
usrProfile.Usr = usr
return usrProfile, nil
}
} }
} }
-2
View File
@@ -13,6 +13,4 @@ func TestInitUserProfile(t *testing.T) {
assert.NoError(t, err, "Error %v", err) assert.NoError(t, err, "Error %v", err)
assert.NotEmpty(t, profile, "UserProfile is empty") assert.NotEmpty(t, profile, "UserProfile is empty")
assert.Empty(t, profile.Usr.Password, "Password should be empty")
} }