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

Method Delete

user/handler/organization.go:140–158  ·  view source on GitHub ↗

DeleteOrganization godoc @Security ApiKey @Summary Delete organization @Description delete organization @Tags Organization @Accept json @Produce json @Param namespace path string true "namespace" @Param current_user query string false "the op user" @Param

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

138// @Failure 500 {object} types.APIInternalServerError "Internal server error"
139// @Router /organization/{namespace} [delete]
140func (h *OrganizationHandler) Delete(ctx *gin.Context) {
141 var req types.DeleteOrgReq
142 currentUser := httpbase.GetCurrentUser(ctx)
143 if currentUser == "" {
144 httpbase.UnauthorizedError(ctx, errors.New("user not found, please login first"))
145 return
146 }
147 req.CurrentUser = currentUser
148 req.Name = ctx.Param("namespace")
149 err := h.c.Delete(ctx, &req)
150 if err != nil {
151 slog.Error("Failed to delete organizations", slog.Any("error", err))
152 httpbase.ServerError(ctx, err)
153 return
154 }
155
156 slog.Info("Delete organizations succeed", slog.String("org_name", req.Name))
157 httpbase.OK(ctx, nil)
158}
159
160// UpdateOrganization godoc
161// @Security ApiKey

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected