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.
OneAuth/api/user/role/del.go

27 lines
532 B
Go

//
// del.go
// Copyright (C) 2025 veypi <i@veypi.com>
// 2025-05-06 15:24
// Distributed under terms of the MIT license.
//
package role
import (
6 months ago
"github.com/veypi/OneAuth/cfg"
"github.com/veypi/OneAuth/models"
"github.com/vyes/vigo"
)
var _ = Router.Delete("/:id", userRoleDelete)
func userRoleDelete(x *vigo.X) (any, error) {
id := x.Params.Get("id")
if id == "" {
return nil, vigo.ErrArgInvalid.WithArgs("id")
}
data := &models.UserRole{}
err := cfg.DB().Where("id = ?", id).Delete(data).Error
return data, err
}