Compare commits

..
Author SHA1 Message Date
phoenix eacf598128 Added structs for login histories
Go CI / Test and Lint (push) Successful in 12s
Go Release / build-and-release (pull_request) Successful in 6s
Go CI / Test and Lint (pull_request) Successful in 12s
2026-05-25 22:57:42 -04:00
2 changed files with 18 additions and 40 deletions
+18
View File
@@ -0,0 +1,18 @@
package user
import (
"time"
"github.com/google/uuid"
)
type UserLoginHistory struct {
Id uuid.UUID `json:"id"`
LoginTime time.Time `json:"login_time"`
UserId uuid.UUID `json:"user_id"`
}
type ServiceUserLoginHistory struct {
Id uuid.UUID `json:"id"`
LoginTime time.Time `json:"login_time"`
ServiceUserId uuid.UUID `json:"service_user_id"`
}
-40
View File
@@ -1,40 +0,0 @@
package user
import (
"testing"
"github.com/stretchr/testify/assert"
)
type UserProfile struct {
Usr *User `json:"user"`
}
func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) {
if usr == nil {
return nil, false
} else {
if len(usr.Password) > 0 {
var newUsr User
newUsr = *usr
newUsr.Password = ""
usrProfile.Usr = &newUsr
return usrProfile, true
} else {
usrProfile.Usr = usr
return usrProfile, true
}
}
}
func TestInitUserProfile(t *testing.T) {
usr := User{}
usr.Username = "Bob"
usr.PhoneNumber = "+12224572351"
usr.Password = "TheNight!"
profile, done := InitUserProfile(&usr)
assert.Equal(t, done, true, "Error")
assert.NotEmpty(t, profile, "UserProfile is empty")
}