refactor: Clean up subscription admin override and Stripe integration (#205) #218
@@ -19,7 +19,7 @@ export type DonationStatus = 'pending' | 'succeeded' | 'failed' | 'canceled';
|
||||
export interface Subscription {
|
||||
id: string;
|
||||
userId: string;
|
||||
stripeCustomerId: string;
|
||||
stripeCustomerId: string | null;
|
||||
stripeSubscriptionId?: string;
|
||||
tier: SubscriptionTier;
|
||||
billingCycle?: BillingCycle;
|
||||
@@ -74,7 +74,7 @@ export interface CreateSubscriptionRequest {
|
||||
export interface SubscriptionResponse {
|
||||
id: string;
|
||||
userId: string;
|
||||
stripeCustomerId: string;
|
||||
stripeCustomerId: string | null;
|
||||
stripeSubscriptionId?: string;
|
||||
tier: SubscriptionTier;
|
||||
billingCycle?: BillingCycle;
|
||||
@@ -118,7 +118,7 @@ export interface CreateTierVehicleSelectionRequest {
|
||||
|
||||
// Service layer types
|
||||
export interface UpdateSubscriptionData {
|
||||
stripeCustomerId?: string;
|
||||
stripeCustomerId?: string | null;
|
||||
stripeSubscriptionId?: string;
|
||||
tier?: SubscriptionTier;
|
||||
billingCycle?: BillingCycle;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
-- Migration: Make stripe_customer_id NULLABLE
|
||||
-- Removes the NOT NULL constraint that forced admin_override_ placeholder values.
|
||||
-- Admin-set subscriptions (no Stripe billing) use NULL instead of sentinel strings.
|
||||
-- PostgreSQL UNIQUE constraint allows multiple NULLs (SQL standard).
|
||||
|
||||
-- Drop NOT NULL constraint on stripe_customer_id
|
||||
ALTER TABLE subscriptions ALTER COLUMN stripe_customer_id DROP NOT NULL;
|
||||
|
||||
-- Clean up existing admin_override_ placeholder values to NULL
|
||||
UPDATE subscriptions SET stripe_customer_id = NULL
|
||||
WHERE stripe_customer_id LIKE 'admin_override_%';
|
||||
@@ -5,7 +5,7 @@ export type SubscriptionStatus = 'active' | 'past_due' | 'canceled' | 'unpaid';
|
||||
export interface Subscription {
|
||||
id: string;
|
||||
userId: string;
|
||||
stripeCustomerId: string;
|
||||
stripeCustomerId: string | null;
|
||||
stripeSubscriptionId?: string;
|
||||
tier: SubscriptionTier;
|
||||
billingCycle?: BillingCycle;
|
||||
|
||||
Reference in New Issue
Block a user