MCPcopy Create free account
hub / github.com/actiontech/dtle / GetCurrentUserV2

Function GetCurrentUserV2

api/handler/v2/user.go:313–323  ·  view source on GitHub ↗

@Id GetCurrentUserV2 @Description get current user. @Tags user @Security ApiKeyAuth @Success 200 {object} models.CurrentUserResp @Router /v2/user/current_user [get]

(c echo.Context)

Source from the content-addressed store, hash-verified

311// @Success 200 {object} models.CurrentUserResp
312// @Router /v2/user/current_user [get]
313func GetCurrentUserV2(c echo.Context) error {
314 user, err := getCurrentUser(c)
315 if err != nil {
316 return c.JSON(http.StatusInternalServerError, models.BuildBaseResp(fmt.Errorf("invalid params:\n%v", err)))
317 }
318 user.Password = "*"
319 return c.JSON(http.StatusOK, &models.CurrentUserResp{
320 CurrentUser: user,
321 BaseResp: models.BuildBaseResp(nil),
322 })
323}
324
325func getCurrentUser(c echo.Context) (*common.User, error) {
326 logger := handler.NewLogger().Named("getCurrentUser")

Callers

nothing calls this directly

Calls 2

BuildBaseRespFunction · 0.92
getCurrentUserFunction · 0.85

Tested by

no test coverage detected