Compare commits

...
Author SHA1 Message Date
phoenix 19d074d3d7 Added todo
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Successful in 6s
Go CI / Test and Lint (push) Successful in 17s
2026-05-25 22:46:00 -04:00
phoenix 209e1428d8 Syntax fix
Go CI / Test and Lint (push) Successful in 6s
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Successful in 6s
2026-05-25 22:43:20 -04:00
phoenix 97591d99b5 Updated test
Go CI / Test and Lint (push) Failing after 6s
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Failing after 6s
2026-05-25 22:42:40 -04:00
phoenix 587f9a05af -m: Test fix
Go CI / Test and Lint (push) Failing after 6s
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Failing after 6s
2026-05-25 22:41:49 -04:00
phoenix b130f6e069 Test fix
Go CI / Test and Lint (push) Failing after 6s
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Failing after 6s
2026-05-25 22:39:37 -04:00
phoenix e74dd82211 Code refactoring
Go Release / build-and-release (pull_request) Successful in 7s
Go CI / Test and Lint (pull_request) Failing after 6s
Go CI / Test and Lint (push) Failing after 17s
2026-05-25 22:36:59 -04:00
phoenix 8cfccc2722 Test fix
Go CI / Test and Lint (push) Successful in 6s
Go CI / Test and Lint (pull_request) Successful in 17s
Go Release / build-and-release (pull_request) Successful in 6s
2026-05-25 22:31:18 -04:00
phoenix 801a314421 Test fix
Go CI / Test and Lint (push) Failing after 16s
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Failing after 6s
2026-05-25 22:30:21 -04:00
2 changed files with 14 additions and 9 deletions
+10 -7
View File
@@ -1,24 +1,27 @@
package user
import (
"fmt"
)
// TODO: Replace Usr with all the fields from User, except Password and other sensitive fields
type UserProfile struct {
Usr *User `json:"user"`
}
func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) {
func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) {
if usr == nil {
return nil, false
return nil, fmt.Errorf("User is empty")
} else {
usrProfile = new(UserProfile)
if len(usr.Password) > 0 {
var newUsr User
newUsr = *usr
newUsr.Password = ""
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
return usrProfile, true
return usrProfile, nil
} else {
usrProfile.Usr = usr
return usrProfile, true
return usrProfile, nil
}
}
}
+4 -2
View File
@@ -9,8 +9,10 @@ import (
func TestInitUserProfile(t *testing.T) {
usr := User{Username: "Bob", PhoneNumber: "+12224572351", Password: "TheNight!"}
profile, done := InitUserProfile(&usr)
profile, err := InitUserProfile(&usr)
assert.Equal(t, done, true, "Error")
assert.NoError(t, err, "Error %v", err)
assert.NotEmpty(t, profile, "UserProfile is empty")
assert.Empty(t, profile.Usr.Password, "Password should be empty")
}