mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
385 B
Go
20 lines
385 B
Go
|
1 week ago
|
package role
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/veypi/vbase/cfg"
|
||
|
|
"github.com/veypi/vbase/models"
|
||
|
|
"github.com/veypi/vigo"
|
||
|
|
)
|
||
|
|
|
||
|
|
type GetReq struct {
|
||
|
|
ID string `src:"path@id" desc:"Role ID"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func get(x *vigo.X, req *GetReq) (*models.Role, error) {
|
||
|
|
var role models.Role
|
||
|
|
if err := cfg.DB().First(&role, "id = ?", req.ID).Error; err != nil {
|
||
|
|
return nil, vigo.ErrNotFound
|
||
|
|
}
|
||
|
|
return &role, nil
|
||
|
|
}
|