diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-25 10:10:28 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-25 10:10:28 -0600 |
| commit | 00b0381dfccab2ddff7de04933fdb11b32695faf (patch) | |
| tree | db1e1f0048ba9cccdb415a714cb1344e8f47951f /pkg/domain/user.go | |
| parent | 051e2435b255e0995e97d927b73f643149d9b2f3 (diff) | |
refactor: move id and entity to domain package
Diffstat (limited to 'pkg/domain/user.go')
| -rw-r--r-- | pkg/domain/user.go | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/pkg/domain/user.go b/pkg/domain/user.go index 4053e8f..5a0420b 100644 --- a/pkg/domain/user.go +++ b/pkg/domain/user.go @@ -1,22 +1,34 @@ package domain type User struct { - ID string `json:"id" jsonapi:"primary,users"` + ID ID `json:"id" jsonapi:"primary,users"` + Username string `json:"username" jsonapi:"attr,username"` + Email string `json:"email" jsonapi:"attr,email"` + ProfileURL string `json:"profile" jsonapi:"attr,profile"` + Picture string `json:"picture" jsonapi:"attr,picture"` } func NewUser() *User { return &User{} } -func (s *User) GetID() string { - return s.ID +func (u *User) GetID() ID { + return u.ID } -func (s *User) SetID(id string) error { - s.ID = id +func (u *User) SetID(id ID) error { + u.ID = id return nil } -func (s *User) Validate() error { +func (u *User) Validate() error { return nil } + +func (self *User) Sparkle(recipient *User, reason string) *Sparkle { + return &Sparkle{ + Recipient: recipient, + Author: self, + Reason: reason, + } +} |
