user_group_member.go 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package models
  2. import (
  3. "errors"
  4. "time"
  5. )
  6. // Typed errors
  7. var (
  8. ErrUserGroupMemberAlreadyAdded = errors.New("User is already added to this user group")
  9. )
  10. // UserGroupMember model
  11. type UserGroupMember struct {
  12. Id int64
  13. OrgId int64
  14. UserGroupId int64
  15. UserId int64
  16. Created time.Time
  17. Updated time.Time
  18. }
  19. // ---------------------
  20. // COMMANDS
  21. type AddUserGroupMemberCommand struct {
  22. UserId int64 `json:"userId" binding:"Required"`
  23. OrgId int64 `json:"-"`
  24. UserGroupId int64 `json:"-"`
  25. }
  26. type RemoveUserGroupMemberCommand struct {
  27. UserId int64
  28. UserGroupId int64
  29. }
  30. // ----------------------
  31. // QUERIES
  32. type GetUserGroupMembersQuery struct {
  33. UserGroupId int64
  34. Result []*UserGroupMemberDTO
  35. }
  36. // ----------------------
  37. // Projections and DTOs
  38. type UserGroupMemberDTO struct {
  39. OrgId int64 `json:"orgId"`
  40. UserGroupId int64 `json:"userGroupId"`
  41. UserId int64 `json:"userId"`
  42. Email string `json:"email"`
  43. Login string `json:"login"`
  44. }