org.go 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. // Typed errors
  7. var (
  8. ErrOrgNotFound = errors.New("Organization not found")
  9. )
  10. type Org struct {
  11. Id int64
  12. Version int
  13. Name string
  14. Created time.Time
  15. Updated time.Time
  16. }
  17. // ---------------------
  18. // COMMANDS
  19. type CreateOrgCommand struct {
  20. Name string `json:"name" binding:"Required"`
  21. // initial admin user for account
  22. UserId int64 `json:"-"`
  23. Result Org `json:"-"`
  24. }
  25. type DeleteOrgCommand struct {
  26. Id int64
  27. }
  28. type UpdateOrgCommand struct {
  29. Name string `json:"name" binding:"Required"`
  30. OrgId int64 `json:"-"`
  31. }
  32. type GetOrgByIdQuery struct {
  33. Id int64
  34. Result *Org
  35. }
  36. type GetOrgByNameQuery struct {
  37. Name string
  38. Result *Org
  39. }
  40. type GetOrgListQuery struct {
  41. Result []*Org
  42. }
  43. type OrgDTO struct {
  44. Id int64 `json:"id"`
  45. Name string `json:"name"`
  46. }
  47. type UserOrgDTO struct {
  48. OrgId int64 `json:"orgId"`
  49. Name string `json:"name"`
  50. Role RoleType `json:"role"`
  51. IsUsing bool `json:"isUsing"`
  52. }