account.go 771 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. // Typed errors
  7. var (
  8. ErrAccountNotFound = errors.New("Account not found")
  9. )
  10. type Account struct {
  11. Id int64
  12. Name string
  13. Created time.Time
  14. Updated time.Time
  15. }
  16. // ---------------------
  17. // COMMANDS
  18. type CreateAccountCommand struct {
  19. Name string `json:"name"`
  20. Result Account `json:"-"`
  21. }
  22. type UpdateAccountCommand struct {
  23. Name string `json:"name"`
  24. AccountId int64 `json:"-"`
  25. }
  26. type GetUserAccountsQuery struct {
  27. UserId int64
  28. Result []*UserAccountDTO
  29. }
  30. type GetAccountByIdQuery struct {
  31. Id int64
  32. Result *Account
  33. }
  34. type UserAccountDTO struct {
  35. AccountId int64 `json:"accountId"`
  36. Name string `json:"email"`
  37. Role RoleType `json:"role"`
  38. IsUsing bool `json:"isUsing"`
  39. }