From dcbc2609c4e2ace387baf74b359f46ceb7719c0c Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:10:14 -0400 Subject: [PATCH 01/29] -m: Added UserProfile --- tx0/user/user_profile.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tx0/user/user_profile.go diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go new file mode 100644 index 0000000..5cd08bb --- /dev/null +++ b/tx0/user/user_profile.go @@ -0,0 +1,23 @@ +package user + + +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 { + newUsr := usr + newUsr.Password = "" + usrProfile.Usr = newUsr + + return usrProfile, true + } else { + usrProfile.Usr = newUsr + return usrProfile, true + } + } +} -- 2.47.3 From 0bf24d929ccbc5018ada1d1eb28cfb01442be2b9 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:12:07 -0400 Subject: [PATCH 02/29] Build fix --- tx0/user/user_profile.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 5cd08bb..22bc7e8 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -10,13 +10,14 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { return nil, false } else { if len(usr.Password) > 0 { - newUsr := usr + var newUsr User + newUsr := *usr newUsr.Password = "" - usrProfile.Usr = newUsr + usrProfile.Usr = &newUsr return usrProfile, true } else { - usrProfile.Usr = newUsr + usrProfile.Usr = usr return usrProfile, true } } -- 2.47.3 From b8e8621e0d1c569a8b2ffb0cb9140c4d7aae05e0 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:12:58 -0400 Subject: [PATCH 03/29] Build fix --- tx0/user/user_profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 22bc7e8..a3e59d9 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -11,7 +11,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { } else { if len(usr.Password) > 0 { var newUsr User - newUsr := *usr + newUsr = *usr newUsr.Password = "" usrProfile.Usr = &newUsr -- 2.47.3 From c2cde151893f87d1e978d5df6bd5eb188fde06a0 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:18:02 -0400 Subject: [PATCH 04/29] Added test --- tx0/user/user_profile.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index a3e59d9..02b0c98 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -1,5 +1,9 @@ package user +import ( + "testing" +) + type UserProfile struct { Usr *User `json:"user"` @@ -22,3 +26,12 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { } } } + +func TestInitUserProfile(t *testing.T) { + usr := User{} + usr.username = "Bob" + usr.Phone = "+12224572351" + usr.Password = "TheNight!" + profile, done := InitUserProfile(&usr) + t.Assert(done, true, "Error") +} -- 2.47.3 From 2b5cb3a093c11a48dbca3286ab10b1116aa0fc90 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:21:14 -0400 Subject: [PATCH 05/29] Test fixes --- tx0/user/user_profile.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 02b0c98..c071d56 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -2,6 +2,8 @@ package user import ( "testing" + + "github.com/stretchr/testify/assert" ) @@ -29,9 +31,10 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { func TestInitUserProfile(t *testing.T) { usr := User{} - usr.username = "Bob" - usr.Phone = "+12224572351" + usr.Username = "Bob" + usr.PhoneNumber = "+12224572351" usr.Password = "TheNight!" profile, done := InitUserProfile(&usr) - t.Assert(done, true, "Error") + assert.Equal(t, done, true, "Error") + assert.NotEmpty(t, profile, "UserProfile is empty") } -- 2.47.3 From 39ecf052a08e221bf0f751c1e39dee3e6970ec1d Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:22:18 -0400 Subject: [PATCH 06/29] Added assert --- go.mod | 7 +++++++ go.sum | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/go.mod b/go.mod index b3fb758..36f7a6e 100644 --- a/go.mod +++ b/go.mod @@ -5,4 +5,11 @@ go 1.26.2 require ( github.com/golang-jwt/jwt/v5 v5.3.1 github.com/google/uuid v1.6.0 + github.com/stretchr/testify v1.11.1 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index be3c485..346e255 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,14 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -- 2.47.3 From f05a513926f1b07214db02bc65763f521e1354b3 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:24:06 -0400 Subject: [PATCH 07/29] Created test file --- tx0/user/user_profile.go | 15 --------------- tx0/user/user_profile_test.go | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 tx0/user/user_profile_test.go diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index c071d56..7a7f79d 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -1,11 +1,5 @@ package user -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - type UserProfile struct { Usr *User `json:"user"` @@ -29,12 +23,3 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { } } -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") -} diff --git a/tx0/user/user_profile_test.go b/tx0/user/user_profile_test.go new file mode 100644 index 0000000..c6fbc1d --- /dev/null +++ b/tx0/user/user_profile_test.go @@ -0,0 +1,19 @@ +package user + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +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") +} -- 2.47.3 From 9565259dc1c272855cd42a0538a172c7d9c4d09b Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:26:38 -0400 Subject: [PATCH 08/29] Test fix --- tx0/user/user_profile_test.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tx0/user/user_profile_test.go b/tx0/user/user_profile_test.go index c6fbc1d..69df08e 100644 --- a/tx0/user/user_profile_test.go +++ b/tx0/user/user_profile_test.go @@ -7,10 +7,7 @@ import ( ) func TestInitUserProfile(t *testing.T) { - usr := User{} - usr.Username = "Bob" - usr.PhoneNumber = "+12224572351" - usr.Password = "TheNight!" + usr := User{Username: "Bob", PhoneNumber: "+12224572351", Password: "TheNight!"} profile, done := InitUserProfile(&usr) -- 2.47.3 From 801a314421a43cc728a04fcba77f0a90f8c3db29 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:30:21 -0400 Subject: [PATCH 09/29] Test fix --- tx0/user/user_profile.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 7a7f79d..41c5a86 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -9,6 +9,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { if usr == nil { return nil, false } else { + userProfile = new(UserProfile) if len(usr.Password) > 0 { var newUsr User newUsr = *usr -- 2.47.3 From 8cfccc2722a34db6a8c0e21b09658f66b8cebb6c Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:31:18 -0400 Subject: [PATCH 10/29] Test fix --- tx0/user/user_profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 41c5a86..684e5c7 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -9,7 +9,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { if usr == nil { return nil, false } else { - userProfile = new(UserProfile) + usrProfile = new(UserProfile) if len(usr.Password) > 0 { var newUsr User newUsr = *usr -- 2.47.3 From e74dd822115b42ba1038d4d802a415938d764b5c Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:36:59 -0400 Subject: [PATCH 11/29] Code refactoring --- tx0/user/user_profile.go | 4 +--- tx0/user/user_profile_test.go | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 684e5c7..fe9c6da 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -11,9 +11,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { } 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 diff --git a/tx0/user/user_profile_test.go b/tx0/user/user_profile_test.go index 69df08e..33ad170 100644 --- a/tx0/user/user_profile_test.go +++ b/tx0/user/user_profile_test.go @@ -13,4 +13,6 @@ func TestInitUserProfile(t *testing.T) { assert.Equal(t, done, true, "Error") assert.NotEmpty(t, profile, "UserProfile is empty") + + assert.Empty(t, profile.Usr.Password, "Password should be empty") } -- 2.47.3 From b130f6e0691ad40762f03e162370ed1a6ac35aa8 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:39:37 -0400 Subject: [PATCH 12/29] Test fix --- tx0/user/user_profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index fe9c6da..e12511d 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -11,7 +11,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, done bool) { } else { 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) + 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 -- 2.47.3 From 587f9a05afbcdec2489a768b04a6e72118128618 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:41:49 -0400 Subject: [PATCH 13/29] -m: Test fix --- tx0/user/user_profile.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index e12511d..cdb2a39 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -1,23 +1,26 @@ package user +import ( + "fmt" +) 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.Errof("User is empty") } else { 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,) + 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 } } } -- 2.47.3 From 97591d99b5cc8f8f41df4ebbd020c12d1b91e8db Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:42:40 -0400 Subject: [PATCH 14/29] Updated test --- tx0/user/user_profile_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tx0/user/user_profile_test.go b/tx0/user/user_profile_test.go index 33ad170..aa9ea8e 100644 --- a/tx0/user/user_profile_test.go +++ b/tx0/user/user_profile_test.go @@ -9,9 +9,9 @@ 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") -- 2.47.3 From 209e1428d82e15accaded0fd39962aaef728ca68 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:43:20 -0400 Subject: [PATCH 15/29] Syntax fix --- tx0/user/user_profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index cdb2a39..5df6b6a 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -10,7 +10,7 @@ type UserProfile struct { func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { if usr == nil { - return nil, fmt.Errof("User is empty") + return nil, fmt.Errorf("User is empty") } else { usrProfile = new(UserProfile) if len(usr.Password) > 0 { -- 2.47.3 From 19d074d3d77e15569ee3bce82a2bec22b3d753e2 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:46:00 -0400 Subject: [PATCH 16/29] Added todo --- tx0/user/user_profile.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 5df6b6a..8b9e06a 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -4,6 +4,7 @@ import ( "fmt" ) +// TODO: Replace Usr with all the fields from User, except Password and other sensitive fields type UserProfile struct { Usr *User `json:"user"` } -- 2.47.3 From e459183747546386b24573019fe59031533fe454 Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 25 May 2026 22:46:26 -0400 Subject: [PATCH 17/29] go fmt --- tx0/user/user_profile.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 8b9e06a..c6ebbce 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -15,7 +15,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { } else { 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,} + 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, nil @@ -25,4 +25,3 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { } } } - -- 2.47.3 From 897ac80b96d42ce27b53e1b7eef7fd32f139cc0a Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:44:12 -0400 Subject: [PATCH 18/29] Tweaked UserProfile --- tx0/user/user_profile.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index c6ebbce..46adfef 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -6,7 +6,13 @@ import ( // TODO: Replace Usr with all the fields from User, except Password and other sensitive fields type UserProfile struct { - Usr *User `json:"user"` + UserId uuid.UUID `json:"user_id"` + PhoneNumber string `json:"phone_number"` + Username string `json:"username"` + Firstname string `json:"firstname"` + Lastname string `json:"lastname"` + Created time `json:"created"` + LastLogin *time `json:"last_login,omitempty"` } func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { @@ -15,8 +21,17 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { } else { 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 + // 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.PhoneNumber = usr.PhoneNumber + usrProfile.Username = usr.Username + usrProfile.Firstname = usr.Firstname + usrProfile.Lastname = usr.Lastname + usrProfile.Created = usr.Created + if usr.LastLogin != nil { + usrProfile.LastLogin = usr.LastLogin + } return usrProfile, nil } else { -- 2.47.3 From b230b7e0d9ae27cf95aea020d9f7e1757b172e54 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:46:26 -0400 Subject: [PATCH 19/29] Added missing imports --- tx0/user/user_profile.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 46adfef..fbbb95c 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -2,6 +2,9 @@ package user import ( "fmt" + "time" + + "github.com/google/uuid" ) // TODO: Replace Usr with all the fields from User, except Password and other sensitive fields @@ -26,8 +29,8 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { usrProfile.UserId = usr.Id usrProfile.PhoneNumber = usr.PhoneNumber usrProfile.Username = usr.Username - usrProfile.Firstname = usr.Firstname - usrProfile.Lastname = usr.Lastname + usrProfile.Firstname = *usr.Firstname + usrProfile.Lastname = *usr.Lastname usrProfile.Created = usr.Created if usr.LastLogin != nil { usrProfile.LastLogin = usr.LastLogin -- 2.47.3 From 2820cdfed680f75cb457a447c6906e7d5f5ec6df Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:47:21 -0400 Subject: [PATCH 20/29] Fixed error --- tx0/user/user_profile.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index fbbb95c..01b7f84 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -14,8 +14,8 @@ type UserProfile struct { Username string `json:"username"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` - Created time `json:"created"` - LastLogin *time `json:"last_login,omitempty"` + Created time.Time `json:"created"` + LastLogin *time.Time `json:"last_login,omitempty"` } func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { -- 2.47.3 From 87a437311bcd0f52884b89db80eb0c977830c9c6 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:49:30 -0400 Subject: [PATCH 21/29] Test fix --- tx0/user/user_profile_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/tx0/user/user_profile_test.go b/tx0/user/user_profile_test.go index aa9ea8e..31e7bbd 100644 --- a/tx0/user/user_profile_test.go +++ b/tx0/user/user_profile_test.go @@ -13,6 +13,4 @@ func TestInitUserProfile(t *testing.T) { assert.NoError(t, err, "Error %v", err) assert.NotEmpty(t, profile, "UserProfile is empty") - - assert.Empty(t, profile.Usr.Password, "Password should be empty") } -- 2.47.3 From 413d9baffd6fc20b9548c56cf5e728e707e5cdfa Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:49:40 -0400 Subject: [PATCH 22/29] Fix --- tx0/user/user_profile.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 01b7f84..1b0580f 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -22,10 +22,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { if usr == nil { return nil, fmt.Errorf("User is empty") } else { - 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 = new(UserProfile) usrProfile.UserId = usr.Id usrProfile.PhoneNumber = usr.PhoneNumber usrProfile.Username = usr.Username @@ -37,9 +34,5 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { } return usrProfile, nil - } else { - usrProfile.Usr = usr - return usrProfile, nil - } } } -- 2.47.3 From c3ec0731b23429383f8f85de5e89ed03f8b6bd1e Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:49:59 -0400 Subject: [PATCH 23/29] Added comments to fields --- tx0/user/user.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tx0/user/user.go b/tx0/user/user.go index 4e967d5..0316fd0 100644 --- a/tx0/user/user.go +++ b/tx0/user/user.go @@ -11,7 +11,9 @@ type User struct { PhoneNumber string `json:"phone_number"` Username string `json:"username"` Password string `json:"password"` + // Firstname is a pointer Firstname *string `json:"first_name,omitempty"` + // Lastname is a pointer Lastname *string `json:"last_name,omitempty"` Created time.Time `json:"created"` LastLogin *time.Time `json:"last_login,omitempty"` -- 2.47.3 From 6f90428975a3a15124cfd69a73c2912a321346dd Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:50:56 -0400 Subject: [PATCH 24/29] Fixed issue --- tx0/user/user_profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 1b0580f..fec5ab3 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -22,7 +22,7 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { if usr == nil { return nil, fmt.Errorf("User is empty") } else { - // usrProfile = new(UserProfile) + usrProfile = new(UserProfile) usrProfile.UserId = usr.Id usrProfile.PhoneNumber = usr.PhoneNumber usrProfile.Username = usr.Username -- 2.47.3 From 894e1387deb3b011b398ef46c7e03fd081962b35 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:53:20 -0400 Subject: [PATCH 25/29] Fix --- tx0/user/user_profile.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index fec5ab3..8585f51 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -26,8 +26,12 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { usrProfile.UserId = usr.Id usrProfile.PhoneNumber = usr.PhoneNumber usrProfile.Username = usr.Username - usrProfile.Firstname = *usr.Firstname - usrProfile.Lastname = *usr.Lastname + if usr.Firstname != nil { + usrProfile.Firstname = *usr.Firstname + } + if usr.Lastname != nil { + usrProfile.Lastname = *usr.Lastname + } usrProfile.Created = usr.Created if usr.LastLogin != nil { usrProfile.LastLogin = usr.LastLogin -- 2.47.3 From 8544a69eb11523d2f5f89dc8b984cce6a067aa7c Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:55:31 -0400 Subject: [PATCH 26/29] Changing type of fields --- tx0/user/user_profile.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 8585f51..8244bfa 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -7,13 +7,13 @@ import ( "github.com/google/uuid" ) -// TODO: Replace Usr with all the fields from User, except Password and other sensitive fields + type UserProfile struct { UserId uuid.UUID `json:"user_id"` PhoneNumber string `json:"phone_number"` Username string `json:"username"` - Firstname string `json:"firstname"` - Lastname string `json:"lastname"` + Firstname *string `json:"firstname,omitempty"` + Lastname *string `json:"lastname,omitempty"` Created time.Time `json:"created"` LastLogin *time.Time `json:"last_login,omitempty"` } -- 2.47.3 From 446583d705c975fd693f4622b12bea7d968615c7 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:56:03 -0400 Subject: [PATCH 27/29] Whoops --- tx0/user/user_profile.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index 8244bfa..e401bcb 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -27,10 +27,10 @@ func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { usrProfile.PhoneNumber = usr.PhoneNumber usrProfile.Username = usr.Username if usr.Firstname != nil { - usrProfile.Firstname = *usr.Firstname + usrProfile.Firstname = usr.Firstname } if usr.Lastname != nil { - usrProfile.Lastname = *usr.Lastname + usrProfile.Lastname = usr.Lastname } usrProfile.Created = usr.Created if usr.LastLogin != nil { -- 2.47.3 From dc2eeb3bf8335096d45b2e25f07296dbcc2ccd84 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:56:52 -0400 Subject: [PATCH 28/29] go fmt --- tx0/user/user.go | 16 +++++++------- tx0/user/user_profile.go | 45 ++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/tx0/user/user.go b/tx0/user/user.go index 0316fd0..3bbf161 100644 --- a/tx0/user/user.go +++ b/tx0/user/user.go @@ -7,14 +7,14 @@ import ( ) type User struct { - Id uuid.UUID `json:"id"` - PhoneNumber string `json:"phone_number"` - Username string `json:"username"` - Password string `json:"password"` + Id uuid.UUID `json:"id"` + PhoneNumber string `json:"phone_number"` + Username string `json:"username"` + 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"` - Created time.Time `json:"created"` - LastLogin *time.Time `json:"last_login,omitempty"` + Lastname *string `json:"last_name,omitempty"` + Created time.Time `json:"created"` + LastLogin *time.Time `json:"last_login,omitempty"` } diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go index e401bcb..37b7f4a 100644 --- a/tx0/user/user_profile.go +++ b/tx0/user/user_profile.go @@ -7,36 +7,35 @@ import ( "github.com/google/uuid" ) - type UserProfile struct { - UserId uuid.UUID `json:"user_id"` - PhoneNumber string `json:"phone_number"` - Username string `json:"username"` - Firstname *string `json:"firstname,omitempty"` - Lastname *string `json:"lastname,omitempty"` - Created time.Time `json:"created"` - LastLogin *time.Time `json:"last_login,omitempty"` + UserId uuid.UUID `json:"user_id"` + PhoneNumber string `json:"phone_number"` + Username string `json:"username"` + Firstname *string `json:"firstname,omitempty"` + Lastname *string `json:"lastname,omitempty"` + Created time.Time `json:"created"` + LastLogin *time.Time `json:"last_login,omitempty"` } func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { if usr == nil { return nil, fmt.Errorf("User is empty") } else { - usrProfile = new(UserProfile) - usrProfile.UserId = usr.Id - usrProfile.PhoneNumber = usr.PhoneNumber - usrProfile.Username = usr.Username - if usr.Firstname != nil { - usrProfile.Firstname = usr.Firstname - } - if usr.Lastname != nil { - usrProfile.Lastname = usr.Lastname - } - usrProfile.Created = usr.Created - if usr.LastLogin != nil { - usrProfile.LastLogin = usr.LastLogin - } + usrProfile = new(UserProfile) + usrProfile.UserId = usr.Id + usrProfile.PhoneNumber = usr.PhoneNumber + usrProfile.Username = usr.Username + if usr.Firstname != nil { + usrProfile.Firstname = usr.Firstname + } + if usr.Lastname != nil { + usrProfile.Lastname = usr.Lastname + } + usrProfile.Created = usr.Created + if usr.LastLogin != nil { + usrProfile.LastLogin = usr.LastLogin + } - return usrProfile, nil + return usrProfile, nil } } -- 2.47.3 From ec95780487a80934fba8caff6230fbb103a9bddd Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 May 2026 22:57:50 -0400 Subject: [PATCH 29/29] bump: textsender-models --- .gitea/workflows/tag_release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/tag_release.yaml b/.gitea/workflows/tag_release.yaml index 3b0f140..4bd12f1 100644 --- a/.gitea/workflows/tag_release.yaml +++ b/.gitea/workflows/tag_release.yaml @@ -25,7 +25,7 @@ jobs: run: | echo "Creating version" - VERSION="0.2.2" + VERSION="0.2.3" PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10) BRANCH_REF="${{ gitea.ref }}" BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3) -- 2.47.3