temp_user.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. // Typed errors
  7. var (
  8. ErrTempUserNotFound = errors.New("User not found")
  9. )
  10. // TempUser holds data for org invites and unconfirmed sign ups
  11. type TempUser struct {
  12. Id int64
  13. OrgId int64
  14. Version int
  15. Email string
  16. Name string
  17. Role string
  18. IsInvite bool
  19. InvitedByUserId int64
  20. EmailSent bool
  21. EmailSentOn time.Time
  22. Code string
  23. Created time.Time
  24. Updated time.Time
  25. }
  26. // ---------------------
  27. // COMMANDS
  28. type CreateTempUserCommand struct {
  29. Email string
  30. Name string
  31. OrgId int64
  32. IsInvite bool
  33. InvitedByUserId int64
  34. Code string
  35. Result *TempUser
  36. }
  37. type GetTempUsersForOrgQuery struct {
  38. OrgId int64
  39. Result []*TempUserDTO
  40. }
  41. type TempUserDTO struct {
  42. Id int64 `json:"id"`
  43. Name string `json:"name"`
  44. Email string `json:"email"`
  45. Role string `json:"role"`
  46. EmailSent bool `json:"emailSent"`
  47. EmailSentOn time.Time `json:"emailSentOn"`
  48. Created time.Time `json:"createdOn"`
  49. }