temp_user.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 RoleType
  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. Role RoleType
  36. Result *TempUser
  37. }
  38. type GetTempUsersForOrgQuery struct {
  39. OrgId int64
  40. Result []*TempUserDTO
  41. }
  42. type TempUserDTO struct {
  43. Id int64 `json:"id"`
  44. Name string `json:"name"`
  45. Email string `json:"email"`
  46. Role string `json:"role"`
  47. InvitedBy string `json:"invitedBy"`
  48. EmailSent bool `json:"emailSent"`
  49. EmailSentOn time.Time `json:"emailSentOn"`
  50. Created time.Time `json:"createdOn"`
  51. }