@adaptware/eagles-db 0.5.34 → 0.5.35

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.34",
3
+ "version": "0.5.35",
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,6 +7,7 @@ enum IntegrationProvider {
7
7
  MICROSOFT
8
8
  ZOOM
9
9
  CALENDLY
10
+ RAZORPAY
10
11
 
11
12
  @@schema("public")
12
13
  }
@@ -9,71 +9,73 @@ enum OrganisationSize {
9
9
  }
10
10
 
11
11
  model Organisation {
12
- id String @id @default(uuid())
13
- name String @unique
14
- industry String
15
- about String
16
- website String
17
- size OrganisationSize @default(ONE_TO_TEN)
18
- phone String
19
- address String
20
- company_values Json[]
21
- allowed_email_domains String[]
22
- send_email Boolean @default(true)
23
- interviewers User[]
24
- created_at DateTime @default(now())
25
- updated_at DateTime @updatedAt
26
- created_by String
27
- updated_by String
28
- is_active Boolean @default(true)
29
- alias String? @unique
30
- logo String?
31
- job_sequence Int @default(1)
32
- employee_sequence Int @default(1)
33
- applications Application[]
34
- user_roles UserRole[]
35
- job_descriptions JobDescription[]
36
- job_profiles JobProfile[]
37
- assessment_library AssessmentLibrary[]
38
- assignment_library AssignmentLibrary[]
39
- interviews Interview[]
40
- assignments Assignment[]
41
- fit_check FitCheck[] // one-to-many link
42
- resumes Resume[] // one-to-many link
43
- approvals Approval[] // one-to-many link
44
- suggestions Suggestion[]
45
- ongoing_evaluations OngoingEvaluation[] // optional one-to-many
46
- actions Action[]
47
- integration_credentials IntegrationCredential[]
48
- zoho_sync_mappings ZohoSyncMapping[]
49
- assessments Assessment[]
50
- timezone String @default("Asia/Kolkata")
12
+ id String @id @default(uuid())
13
+ name String @unique
14
+ industry String
15
+ about String
16
+ website String
17
+ size OrganisationSize @default(ONE_TO_TEN)
18
+ phone String
19
+ address String
20
+ company_values Json[]
21
+ allowed_email_domains String[]
22
+ send_email Boolean @default(true)
23
+ interviewers User[]
24
+ created_at DateTime @default(now())
25
+ updated_at DateTime @updatedAt
26
+ created_by String
27
+ updated_by String
28
+ is_active Boolean @default(true)
29
+ alias String? @unique
30
+ logo String?
31
+ job_sequence Int @default(1)
32
+ employee_sequence Int @default(1)
33
+ applications Application[]
34
+ user_roles UserRole[]
35
+ job_descriptions JobDescription[]
36
+ job_profiles JobProfile[]
37
+ assessment_library AssessmentLibrary[]
38
+ assignment_library AssignmentLibrary[]
39
+ interviews Interview[]
40
+ assignments Assignment[]
41
+ fit_check FitCheck[] // one-to-many link
42
+ resumes Resume[] // one-to-many link
43
+ approvals Approval[] // one-to-many link
44
+ suggestions Suggestion[]
45
+ ongoing_evaluations OngoingEvaluation[] // optional one-to-many
46
+ actions Action[]
47
+ integration_credentials IntegrationCredential[]
48
+ zoho_sync_mappings ZohoSyncMapping[]
49
+ assessments Assessment[]
50
+ timezone String @default("Asia/Kolkata")
51
51
  /// ISO 3166-1 alpha-2 (e.g. IN).
52
- country_code String @default("IN")
53
- organisation_configs OrganisationConfig[]
54
- activity_events ActivityEvent[]
55
- usage_ledger_entries UsageLedgerEntry[]
56
- usage_aggregates UsageAggregate[]
57
- channel_provider_configs ChannelProviderConfig[]
58
- conversations Conversation[]
59
- communication_messages CommunicationMessage[]
60
- job_application_fields JobApplicationField[]
61
- documents Document[]
62
- job_application_templates JobApplicationTemplate[]
63
- offer_letter_templates OfferLetterTemplate[]
64
- offers Offer[]
65
- sources Source[]
66
- evaluation_criteria EvaluationCriteria[]
67
- departments Department[]
68
- hiring_plans HiringPlan[]
69
- employees Employee[]
70
- competency_dictionaries CompetencyDictionary[]
71
- purchased_license_packages PurchasedLicensePackage[]
72
- purchased_hiring_units PurchasedHiringUnit[]
73
- purchased_top_ups PurchasedTopUp[]
74
- licensing_ledger_entries LicensingLedgerEntry[]
75
- license_package_organisations LicensePackageOrganisation[]
76
- ai_cost_ledger_entries AiCostLedgerEntry[]
52
+ country_code String @default("IN")
53
+ organisation_configs OrganisationConfig[]
54
+ activity_events ActivityEvent[]
55
+ usage_ledger_entries UsageLedgerEntry[]
56
+ usage_aggregates UsageAggregate[]
57
+ channel_provider_configs ChannelProviderConfig[]
58
+ conversations Conversation[]
59
+ communication_messages CommunicationMessage[]
60
+ job_application_fields JobApplicationField[]
61
+ documents Document[]
62
+ job_application_templates JobApplicationTemplate[]
63
+ offer_letter_templates OfferLetterTemplate[]
64
+ offers Offer[]
65
+ sources Source[]
66
+ evaluation_criteria EvaluationCriteria[]
67
+ departments Department[]
68
+ hiring_plans HiringPlan[]
69
+ employees Employee[]
70
+ competency_dictionaries CompetencyDictionary[]
71
+ billing_transactions BillingTransaction[]
72
+ payment_webhook_events PaymentWebhookEvent[]
73
+ purchased_license_packages PurchasedLicensePackage[]
74
+ purchased_hiring_units PurchasedHiringUnit[]
75
+ purchased_top_ups PurchasedTopUp[]
76
+ licensing_ledger_entries LicensingLedgerEntry[]
77
+ license_package_organisations LicensePackageOrganisation[]
78
+ ai_cost_ledger_entries AiCostLedgerEntry[]
77
79
 
78
80
  @@index([name])
79
81
  @@schema("public")
@@ -0,0 +1,83 @@
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
+ }
@@ -0,0 +1,28 @@
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
+ }