Compare commits

...
Author SHA1 Message Date
phoenixandphoenix f9b55b6bb7 tsk-15: Add User Id to LoginResult (#21)
Closes #15

Reviewed-on: phoenix/textsender-models#21
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-12-16 02:58:11 +00:00
phoenixandphoenix 245ff35e58 tsk-14: User improvements (#20)
Closes #14

Reviewed-on: phoenix/textsender-models#20
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-12-16 02:38:30 +00:00
3 changed files with 23 additions and 12 deletions
+9 -4
View File
@@ -11,8 +11,13 @@ type Claims struct {
jwt.RegisteredClaims jwt.RegisteredClaims
} }
type Login struct { type LoginResult struct {
AccessToken string `json:"access_token"` UserId uuid.UUID `json:"user_id"`
TokenType string `json:"token_type"` AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in"` TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
} }
// Alias for LoginResult
// Will be deprecated at some point
type Login = LoginResult
+4 -4
View File
@@ -7,8 +7,8 @@ import (
) )
type ServiceUser struct { type ServiceUser struct {
Id uuid.UUID `json:"id"` Id uuid.UUID `json:"id"`
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
Passphrase string `json:"passphrase,omitempty"` Passphrase string `json:"passphrase,omitempty"`
Created *time.Time `json:"date_created,omitempty"` Created time.Time `json:"date_created"`
} }
+10 -4
View File
@@ -1,12 +1,18 @@
package user package user
import ( import (
"time"
"github.com/google/uuid" "github.com/google/uuid"
) )
type User struct { type User struct {
Id uuid.UUID `json:"id"` Id uuid.UUID `json:"id"`
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 *string `json:"first_name,omitempty"`
Lastname *string `json:"last_name,omitempty"`
Created time.Time `json:"date_created"`
LastLogin *time.Time `json:"last_login,omitempty"`
} }