MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / Index

Method Index

user/handler/organization.go:114–125  ·  view source on GitHub ↗

GetOrganizations godoc @Security ApiKey @Summary Get organizations @Description get organizations @Tags Organization @Accept json @Produce json @Success 200 {object} types.Response{data=[]types.Organization} "OK" @Failure 500 {object} types.APIInternalServe

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

112// @Failure 500 {object} types.APIInternalServerError "Internal server error"
113// @Router /organizations [get]
114func (h *OrganizationHandler) Index(ctx *gin.Context) {
115 username := httpbase.GetCurrentUser(ctx)
116 orgs, err := h.c.Index(ctx, username)
117 if err != nil {
118 slog.Error("Failed to get organizations", slog.Any("error", err))
119 httpbase.ServerError(ctx, err)
120 return
121 }
122
123 slog.Info("Get organizations succeed")
124 httpbase.OK(ctx, orgs)
125}
126
127// DeleteOrganization godoc
128// @Security ApiKey

Callers

nothing calls this directly

Calls 4

GetCurrentUserFunction · 0.92
ServerErrorFunction · 0.92
OKFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected