//
// Copyright (C) 2024 veypi <i@veypi.com>
// 2025-03-04 16:08:06
// Distributed under terms of the MIT license.
//

package user

import (
	"github.com/veypi/vbase/auth"
	"github.com/veypi/vigo"
)

var Router = vigo.NewRouter()

func init() {
	Router.Get("/", "用户列表", auth.VBaseAuth.Perm("user:read"), list)
	Router.Post("/", "创建用户", auth.VBaseAuth.Perm("user:admin"), create)
	Router.Get("/{user_id}", "获取用户详情", auth.VBaseAuth.PermWithOwner("user:read", "user_id"), get)
	Router.Patch("/{user_id}", "更新用户", auth.VBaseAuth.PermWithOwner("user:update", "user_id"), patch)
	Router.Delete("/{user_id}", "删除用户", auth.VBaseAuth.Perm("user:admin"), del)
	Router.Patch("/{user_id}/status", "更新用户状态", auth.VBaseAuth.Perm("user:admin"), updateStatus)
}
