MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / Delete

Method Delete

api/pkg/handlers/discord_handler.go:126–145  ·  view source on GitHub ↗

Delete a discord integration @Summary Delete discord integration @Description Delete a discord integration for a user @Security ApiKeyAuth @Tags Webhooks @Accept json @Produce json @Param discordID path string true "ID of the discord integration" default(32343a19-

(c fiber.Ctx)

Source from the content-addressed store, hash-verified

124// @Failure 500 {object} responses.InternalServerError
125// @Router /discord-integrations/{discordID} [delete]
126func (h *DiscordHandler) Delete(c fiber.Ctx) error {
127 ctx, span, ctxLogger := h.tracer.StartFromFiberCtxWithLogger(c, h.logger)
128 defer span.End()
129
130 discordID := c.Params("discordID")
131 if errors := h.validator.ValidateUUID(discordID, "discordID"); len(errors) != 0 {
132 msg := fmt.Sprintf("validation errors [%s], while deleting discord integration with ID [%s]", spew.Sdump(errors), discordID)
133 ctxLogger.Warn(stacktrace.NewError(msg))
134 return h.responseUnprocessableEntity(c, errors, "validation errors while deleting discord integration")
135 }
136
137 err := h.service.Delete(ctx, h.userIDFomContext(c), uuid.MustParse(discordID))
138 if err != nil {
139 msg := fmt.Sprintf("cannot delete discord integration with ID [%+#v]", discordID)
140 ctxLogger.Error(stacktrace.Propagate(err, msg))
141 return h.responseInternalServerError(c)
142 }
143
144 return h.responseOK(c, "discord integration deleted successfully", nil)
145}
146
147// Update an entities.Discord
148// @Summary Update a discord integration

Callers

nothing calls this directly

Calls 9

ValidateUUIDMethod · 0.80
userIDFomContextMethod · 0.80
responseOKMethod · 0.80
WarnMethod · 0.65
DeleteMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected