47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
/**
|
|
* Subscription Repository Port
|
|
*
|
|
* Interface for subscription persistence operations.
|
|
*/
|
|
|
|
import { Subscription } from '../../entities/subscription.entity';
|
|
|
|
export const SUBSCRIPTION_REPOSITORY = 'SUBSCRIPTION_REPOSITORY';
|
|
|
|
export interface SubscriptionRepository {
|
|
/**
|
|
* Save a subscription (create or update)
|
|
*/
|
|
save(subscription: Subscription): Promise<Subscription>;
|
|
|
|
/**
|
|
* Find a subscription by its ID
|
|
*/
|
|
findById(id: string): Promise<Subscription | null>;
|
|
|
|
/**
|
|
* Find a subscription by organization ID
|
|
*/
|
|
findByOrganizationId(organizationId: string): Promise<Subscription | null>;
|
|
|
|
/**
|
|
* Find a subscription by Stripe subscription ID
|
|
*/
|
|
findByStripeSubscriptionId(stripeSubscriptionId: string): Promise<Subscription | null>;
|
|
|
|
/**
|
|
* Find a subscription by Stripe customer ID
|
|
*/
|
|
findByStripeCustomerId(stripeCustomerId: string): Promise<Subscription | null>;
|
|
|
|
/**
|
|
* Find all subscriptions
|
|
*/
|
|
findAll(): Promise<Subscription[]>;
|
|
|
|
/**
|
|
* Delete a subscription
|
|
*/
|
|
delete(id: string): Promise<void>;
|
|
}
|