cancelSubscription cancels the subscription for the authenticated entities.User @Summary Cancel the user's subscription @Description Cancel the subscription of the authenticated user. @Security ApiKeyAuth @Tags Users @Produce json @Success 200 {object} responses.NoContent
(c fiber.Ctx)
| 223 | // @Failure 500 {object} responses.InternalServerError |
| 224 | // @Router /users/subscription [delete] |
| 225 | func (h *UserHandler) cancelSubscription(c fiber.Ctx) error { |
| 226 | ctx, span := h.tracer.StartFromFiberCtx(c) |
| 227 | defer span.End() |
| 228 | |
| 229 | ctxLogger := h.tracer.CtxLogger(h.logger, span) |
| 230 | authUser := h.userFromContext(c) |
| 231 | |
| 232 | err := h.service.InitiateSubscriptionCancel(ctx, authUser.ID) |
| 233 | if err != nil { |
| 234 | msg := fmt.Sprintf("cannot get user with ID [%s]", authUser.ID) |
| 235 | ctxLogger.Error(stacktrace.Propagate(err, msg)) |
| 236 | return h.responseInternalServerError(c) |
| 237 | } |
| 238 | |
| 239 | return h.responseNoContent(c, "Subscription cancelled successfully") |
| 240 | } |
| 241 | |
| 242 | // DeleteAPIKey rotates the API Key for a user |
| 243 | // @Summary Rotate the user's API Key |
nothing calls this directly
no test coverage detected