@adaptware/eagles-db 0.5.45 → 0.5.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptware/eagles-db",
3
- "version": "0.5.45",
3
+ "version": "0.5.46",
4
4
  "description": "A Prisma client package for Treadspace database operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -7,7 +7,6 @@ enum IntegrationProvider {
7
7
  MICROSOFT
8
8
  ZOOM
9
9
  CALENDLY
10
- RAZORPAY
11
10
 
12
11
  @@schema("public")
13
12
  }
@@ -74,8 +74,6 @@ model Organisation {
74
74
  licensing_ledger_entries LicensingLedgerEntry[]
75
75
  license_package_organisations LicensePackageOrganisation[]
76
76
  ai_cost_ledger_entries AiCostLedgerEntry[]
77
- billing_transactions BillingTransaction[]
78
- payment_webhook_events PaymentWebhookEvent[]
79
77
 
80
78
  @@index([name])
81
79
  @@schema("public")
@@ -28,6 +28,8 @@ model User {
28
28
  created_by String
29
29
  updated_by String
30
30
  is_active Boolean @default(true)
31
+ /// Set when removed from team (Delete); null for active/inactive-only users.
32
+ deleted_at DateTime?
31
33
  is_self_registered Boolean @default(true)
32
34
  permission_id String? @unique
33
35
  preferences Json? @default("{}")
@@ -0,0 +1,8 @@
1
+ -- Add soft-delete timestamp for team member removal (distinct from is_active deactivate).
2
+ ALTER TABLE "public"."User"
3
+ ADD COLUMN IF NOT EXISTS "deleted_at" TIMESTAMP(3);
4
+
5
+ -- Optional: allow re-inviting the same email after soft delete (PostgreSQL partial unique index).
6
+ -- Run only if product requires re-invite while tombstone row exists.
7
+ -- DROP INDEX IF EXISTS "User_email_key";
8
+ -- CREATE UNIQUE INDEX "User_email_active_key" ON "public"."User" ("email") WHERE "deleted_at" IS NULL;
@@ -1,83 +0,0 @@
1
- // PAYMENT SERVICE boundary — portable payment microservice owns these enums/columns.
2
-
3
- enum BillingTransactionStatus {
4
- INITIATED
5
- ORDER_CREATED
6
- PAYMENT_PENDING
7
- SUCCESS
8
- FAILED
9
- CANCELLED
10
- REFUND_PENDING
11
- REFUND_FAILED
12
- REFUNDED
13
-
14
- @@schema("public")
15
- }
16
-
17
- enum BillingTransactionType {
18
- PURCHASE
19
- TOP_UP
20
- REFUND
21
-
22
- @@schema("public")
23
- }
24
-
25
- enum BillingTransactionFailureCategory {
26
- RAZORPAY_ORDER
27
- RAZORPAY_PAYMENT
28
- REFUND
29
- INTERNAL
30
-
31
- @@schema("public")
32
- }
33
-
34
- /// Payment reconciliation state when Treadspace status is FAILED but Razorpay captured payment.
35
- enum BillingPaymentMismatchStatus {
36
- DETECTED
37
- UNFULFILLED
38
-
39
- @@schema("public")
40
- }
41
-
42
- /// Financial transaction lifecycle for organisation billing purchases.
43
- model BillingTransaction {
44
- id String @id @default(uuid())
45
- organisation_id String
46
- /// Opaque plan/product identity supplied at checkout. Not a catalog FK.
47
- purchase_reference String
48
- /// Human-readable snapshot captured at checkout for invoices and receipts.
49
- purchase_display_name String?
50
- transaction_type BillingTransactionType
51
- status BillingTransactionStatus @default(INITIATED)
52
- failure_category BillingTransactionFailureCategory?
53
- /// Human-readable or provider detail (e.g. Razorpay error_description).
54
- failure_reason String?
55
- amount Int
56
- currency String @default("INR")
57
- razorpay_order_id String?
58
- razorpay_payment_id String? @unique
59
- /// Razorpay payment method at capture (card, netbanking, upi, wallet, etc.).
60
- payment_method String?
61
- razorpay_subscription_id String?
62
- razorpay_refund_id String?
63
- refund_reason String?
64
- refund_amount Int?
65
- idempotency_key String @unique
66
- invoice_number String? @unique
67
- /// Email of the org Admin who initiated checkout (bill-to).
68
- purchaser_email String?
69
- /// Set when FAILED but Razorpay order/payment is captured (reconciliation path).
70
- payment_mismatch_status BillingPaymentMismatchStatus?
71
- /// Strict same-intent SUCCESS transaction that fulfilled the purchase (UNFULFILLED only).
72
- payment_mismatch_fulfilled_by_id String?
73
- created_at DateTime @default(now())
74
- updated_at DateTime @updatedAt
75
-
76
- organisation Organisation @relation(fields: [organisation_id], references: [id])
77
-
78
- @@index([organisation_id, status])
79
- @@index([purchase_reference])
80
- @@index([razorpay_order_id])
81
- @@map("billing_transactions")
82
- @@schema("public")
83
- }
@@ -1,28 +0,0 @@
1
- enum PaymentWebhookEventStatus {
2
- RECEIVED
3
- PROCESSED
4
- FAILED
5
-
6
- @@schema("public")
7
- }
8
-
9
- /// Idempotent record of payment provider webhook deliveries.
10
- model PaymentWebhookEvent {
11
- id String @id @default(uuid())
12
- organisation_id String?
13
- provider String
14
- provider_event_id String
15
- event_type String
16
- status PaymentWebhookEventStatus @default(RECEIVED)
17
- billing_transaction_id String?
18
- error_message String?
19
- processed_at DateTime?
20
- created_at DateTime @default(now())
21
-
22
- organisation Organisation? @relation(fields: [organisation_id], references: [id])
23
-
24
- @@unique([provider, provider_event_id])
25
- @@index([status, created_at])
26
- @@map("payment_webhook_events")
27
- @@schema("public")
28
- }