fix: proper cancellation handling

This commit is contained in:
2026-01-28 21:13:15 +00:00
parent 65964d64f6
commit d4cc50f289
12 changed files with 359 additions and 20 deletions

View File

@@ -647,3 +647,9 @@ export const GetSubscriptionResponseSchema = z.object({
});
export type GetSubscriptionResponse = z.infer<typeof GetSubscriptionResponseSchema>;
export const CancelSubscriptionResponseSchema = z.object({
subscription: SubscriptionRecordSchema,
});
export type CancelSubscriptionResponse = z.infer<typeof CancelSubscriptionResponseSchema>;

View File

@@ -3,6 +3,7 @@ import { z } from "zod";
import {
ApiErrorSchema,
AuthResponseSchema,
CancelSubscriptionResponseSchema,
CreateCheckoutSessionRequestSchema,
CreateCheckoutSessionResponseSchema,
CreatePortalSessionResponseSchema,
@@ -628,6 +629,17 @@ export const apiContract = c.router({
},
headers: csrfHeaderSchema,
},
subscriptionCancel: {
method: "POST",
path: "/subscription/cancel",
body: emptyBodySchema,
responses: {
200: CancelSubscriptionResponseSchema,
404: ApiErrorSchema,
500: ApiErrorSchema,
},
headers: csrfHeaderSchema,
},
subscriptionGet: {
method: "GET",
path: "/subscription/get",

View File

@@ -1,6 +1,7 @@
export type {
ApiError,
AuthResponse,
CancelSubscriptionResponse,
CreateCheckoutSessionRequest,
CreateCheckoutSessionResponse,
CreatePortalSessionResponse,
@@ -67,6 +68,7 @@ export type {
export {
ApiErrorSchema,
AuthResponseSchema,
CancelSubscriptionResponseSchema,
CreateCheckoutSessionRequestSchema,
CreateCheckoutSessionResponseSchema,
CreatePortalSessionResponseSchema,