user.go 767 B

123456789101112131415161718192021222324252627282930313233
  1. package models
  2. import "time"
  3. type User struct {
  4. ID string `json:"id"`
  5. Email string `json:"email"`
  6. PasswordHash string `json:"-"`
  7. Role string `json:"role"`
  8. Status string `json:"status"`
  9. Name *string `json:"name"`
  10. AvatarURL *string `json:"avatar_url"`
  11. Phone *string `json:"phone"`
  12. Bio *string `json:"bio"`
  13. Country *string `json:"country"`
  14. CreatedAt time.Time `json:"created_at"`
  15. UpdatedAt time.Time `json:"updated_at"`
  16. DeletedAt *time.Time `json:"-"`
  17. }
  18. type UserFilter struct {
  19. Role string
  20. Status string
  21. Limit_ int
  22. Cursor string
  23. }
  24. func (f UserFilter) Limit() int {
  25. if f.Limit_ <= 0 || f.Limit_ > 100 {
  26. return 20
  27. }
  28. return f.Limit_
  29. }