admin_role.go 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. package request
  2. import (
  3. pb "sghgogs.com/sghblog/authorization-service/proto"
  4. "time"
  5. )
  6. type AdminRole struct {
  7. ID int64 `gorm:"primary_key;not_null;auto_increment;" json:"id"`
  8. Name string `json:"name"`
  9. Description string `json:"description"`
  10. Users []AdminUser `gorm:"many2many:admin_user_role;" json:"users"`
  11. Permissions []AdminPermission `gorm:"many2many:admin_role_permission;" json:"permissions"`
  12. CreatedBy string `json:"created_by"`
  13. OperatorID int64 `json:"operator_id"`
  14. CreatedAt time.Time `json:"created_at"`
  15. UpdatedAt *time.Time `json:"updated_at"`
  16. Status pb.StatusEnum `json:"status"` // 可以是 "enabled", "disabled", "deleted" 等
  17. IsReserved bool `json:"is_reserved"`
  18. }
  19. // func (u *AdminUser) BeforeUpdate(tx *gorm.DB) (err error) {
  20. // fmt.Print("BeforeCreate......")
  21. // return
  22. // }
  23. //
  24. // // AfterUpdate 在同一个事务中更新数据
  25. // func (u *AdminUser) AfterUpdate(tx *gorm.DB) (err error) {
  26. // fmt.Print("AfterUpdate......")
  27. // return
  28. // }