feat(saas): update schema for db-per-tenant and per-component FIEL encryption
- Rename Tenant.schemaName to databaseName across all services - Add Subscription and Payment models to Prisma schema - Update FielCredential to per-component IV/tag encryption columns - Switch FIEL encryption key from JWT_SECRET to FIEL_ENCRYPTION_KEY - Add Subscription and Payment shared types - Update JWTPayload to use databaseName Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,7 @@ export interface JWTPayload {
|
||||
email: string;
|
||||
role: Role;
|
||||
tenantId: string;
|
||||
schemaName: string;
|
||||
databaseName: string;
|
||||
iat?: number;
|
||||
exp?: number;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export interface Tenant {
|
||||
nombre: string;
|
||||
rfc: string;
|
||||
plan: Plan;
|
||||
schemaName: string;
|
||||
databaseName: string;
|
||||
cfdiLimit: number;
|
||||
usersLimit: number;
|
||||
active: boolean;
|
||||
@@ -20,3 +20,29 @@ export interface TenantUsage {
|
||||
usersLimit: number;
|
||||
plan: Plan;
|
||||
}
|
||||
|
||||
export interface Subscription {
|
||||
id: string;
|
||||
tenantId: string;
|
||||
plan: Plan;
|
||||
mpPreapprovalId?: string;
|
||||
status: 'pending' | 'authorized' | 'paused' | 'cancelled';
|
||||
amount: number;
|
||||
frequency: 'monthly' | 'yearly';
|
||||
currentPeriodStart?: string;
|
||||
currentPeriodEnd?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface Payment {
|
||||
id: string;
|
||||
tenantId: string;
|
||||
subscriptionId?: string;
|
||||
mpPaymentId?: string;
|
||||
amount: number;
|
||||
status: 'approved' | 'pending' | 'rejected' | 'refunded';
|
||||
paymentMethod?: string;
|
||||
paidAt?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user