wireguard-dashboard/route/user.go

29 lines
1.2 KiB
Go
Raw Permalink Normal View History

2024-03-06 17:13:29 +08:00
package route
import (
"github.com/gin-gonic/gin"
"wireguard-dashboard/http/api"
2024-03-07 11:03:46 +08:00
"wireguard-dashboard/middleware"
2024-03-06 17:13:29 +08:00
)
2024-03-13 17:05:02 +08:00
func UserApi(r *gin.RouterGroup) {
2024-03-07 11:03:46 +08:00
// 登陆相关API
2024-06-03 17:09:45 +08:00
login := r.Group("/login", middleware.SystemLogRequest())
2024-03-07 11:03:46 +08:00
{
login.POST("", api.UserApi().Login)
}
// 用户登陆后相关的API
2024-06-03 17:09:45 +08:00
userApi := r.Group("user", middleware.Authorization(), middleware.SystemLogRequest())
2024-03-06 17:13:29 +08:00
{
userApi.DELETE("logout", api.UserApi().Logout) // 用户退出登陆
userApi.GET("", api.UserApi().GetUser) // 获取登陆用户信息
userApi.POST("save", middleware.Permission(), api.UserApi().Save) // 新增/编辑用户信息
userApi.POST("change-password", api.UserApi().ChangePassword) // 更改密码
userApi.GET("list", middleware.Permission(), api.UserApi().List) // 用户列表
userApi.PUT("change-status", middleware.Permission(), api.UserApi().ChangeUserState) // 变更状态
2024-05-17 17:30:26 +08:00
userApi.DELETE("delete/:id", middleware.Permission(), api.UserApi().DeleteUser) // 删除用户
userApi.POST("change-avatar", api.UserApi().ChangeAvatar) // 更换头像
2024-03-06 17:13:29 +08:00
}
}