package user

import (
	"net/http"

	"git.noahlan.cn/noahlan/ntool-biz/zero/statusz"

	"git.noahlan.cn/n-admin/n-admin-server/api/internal/logic/user"
	"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
)

// swagger:route get /api/user user GetCurrentUser
//
// Get Current User | 获取当前登录用户信息
//
// Get Current User | 获取当前登录用户信息
//
// Responses:
//  200: UserInfo

func GetCurrentUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		const transErr = true

		l := user.NewGetCurrentUserLogic(r, r.Context(), svcCtx)
		resp, err := l.GetCurrentUser()

		statusz.ResponseHandler(r, w, transErr, resp, err)

	}
}
