@trycompai/db 2.0.3 → 2.1.1
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/dist/schema.prisma +191 -17
- package/package.json +1 -1
package/dist/schema.prisma
CHANGED
|
@@ -170,6 +170,7 @@ model Member {
|
|
|
170
170
|
jobTitle String?
|
|
171
171
|
isActive Boolean @default(true)
|
|
172
172
|
deactivated Boolean @default(false)
|
|
173
|
+
backgroundCheckExempt Boolean @default(false)
|
|
173
174
|
externalUserId String?
|
|
174
175
|
externalUserSource String?
|
|
175
176
|
employeeTrainingVideoCompletion EmployeeTrainingVideoCompletion[]
|
|
@@ -373,8 +374,8 @@ model BackgroundCheckRequest {
|
|
|
373
374
|
createdAt DateTime @default(now())
|
|
374
375
|
updatedAt DateTime @updatedAt
|
|
375
376
|
|
|
376
|
-
organization Organization
|
|
377
|
-
member Member
|
|
377
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
378
|
+
member Member @relation(fields: [memberId], references: [id], onDelete: Cascade)
|
|
378
379
|
webhookEvents BackgroundCheckWebhookEvent[]
|
|
379
380
|
|
|
380
381
|
@@unique([organizationId, memberId])
|
|
@@ -815,6 +816,21 @@ model EvidenceSubmission {
|
|
|
815
816
|
@@index([submittedById, status])
|
|
816
817
|
}
|
|
817
818
|
|
|
819
|
+
model EvidenceFormSetting {
|
|
820
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('efs'::text)"))
|
|
821
|
+
organizationId String
|
|
822
|
+
formType EvidenceFormType
|
|
823
|
+
isNotRelevant Boolean @default(false)
|
|
824
|
+
createdAt DateTime @default(now())
|
|
825
|
+
updatedAt DateTime @updatedAt
|
|
826
|
+
|
|
827
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
828
|
+
|
|
829
|
+
@@unique([organizationId, formType])
|
|
830
|
+
@@index([organizationId])
|
|
831
|
+
@@index([organizationId, isNotRelevant])
|
|
832
|
+
}
|
|
833
|
+
|
|
818
834
|
// ===== finding.prisma =====
|
|
819
835
|
enum FindingType {
|
|
820
836
|
soc2
|
|
@@ -1731,19 +1747,146 @@ model OrganizationChart {
|
|
|
1731
1747
|
|
|
1732
1748
|
// ===== organization-billing.prisma =====
|
|
1733
1749
|
model OrganizationBilling {
|
|
1734
|
-
id
|
|
1735
|
-
organizationId
|
|
1736
|
-
stripeCustomerId
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
createdAt
|
|
1740
|
-
updatedAt
|
|
1750
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('obil'::text)"))
|
|
1751
|
+
organizationId String @unique @map("organization_id")
|
|
1752
|
+
stripeCustomerId String @map("stripe_customer_id")
|
|
1753
|
+
stripePaymentMethodId String? @map("stripe_payment_method_id")
|
|
1754
|
+
paymentMethodUpdatedAt DateTime? @map("payment_method_updated_at")
|
|
1755
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1756
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
1741
1757
|
|
|
1742
1758
|
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1743
1759
|
|
|
1744
1760
|
@@map("organization_billing")
|
|
1745
1761
|
}
|
|
1746
1762
|
|
|
1763
|
+
model OrganizationBillingSubscription {
|
|
1764
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('obs'::text)"))
|
|
1765
|
+
organizationId String @map("organization_id")
|
|
1766
|
+
skuKey String @map("sku_key")
|
|
1767
|
+
stripeSubscriptionId String @map("stripe_subscription_id")
|
|
1768
|
+
stripeSubscriptionItemId String @map("stripe_subscription_item_id")
|
|
1769
|
+
stripePriceId String @map("stripe_price_id")
|
|
1770
|
+
stripeStatus String @map("stripe_status")
|
|
1771
|
+
currentPeriodStart DateTime? @map("current_period_start")
|
|
1772
|
+
currentPeriodEnd DateTime? @map("current_period_end")
|
|
1773
|
+
includedQuantity Int @map("included_quantity")
|
|
1774
|
+
usedQuantity Int @default(0) @map("used_quantity")
|
|
1775
|
+
cancelAtPeriodEnd Boolean @default(false) @map("cancel_at_period_end")
|
|
1776
|
+
canceledAt DateTime? @map("canceled_at")
|
|
1777
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1778
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
1779
|
+
|
|
1780
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1781
|
+
|
|
1782
|
+
@@unique([organizationId, skuKey])
|
|
1783
|
+
@@unique([stripeSubscriptionId, stripeSubscriptionItemId], map: "org_billing_subs_stripe_sub_item_key")
|
|
1784
|
+
@@index([organizationId])
|
|
1785
|
+
@@index([stripeSubscriptionId])
|
|
1786
|
+
@@index([skuKey])
|
|
1787
|
+
@@map("organization_billing_subscriptions")
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
model BillingUsageEvent {
|
|
1791
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('bue'::text)"))
|
|
1792
|
+
organizationId String @map("organization_id")
|
|
1793
|
+
skuKey String @map("sku_key")
|
|
1794
|
+
eventType String @map("event_type")
|
|
1795
|
+
quantity Int
|
|
1796
|
+
sourceResourceId String? @map("source_resource_id")
|
|
1797
|
+
idempotencyKey String @unique @map("idempotency_key")
|
|
1798
|
+
stripeEventId String? @map("stripe_event_id")
|
|
1799
|
+
stripeInvoiceId String? @map("stripe_invoice_id")
|
|
1800
|
+
stripeSubscriptionItemId String? @map("stripe_subscription_item_id")
|
|
1801
|
+
periodStart DateTime? @map("period_start")
|
|
1802
|
+
periodEnd DateTime? @map("period_end")
|
|
1803
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1804
|
+
|
|
1805
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1806
|
+
|
|
1807
|
+
@@index([organizationId, skuKey])
|
|
1808
|
+
@@index([stripeEventId])
|
|
1809
|
+
@@index([stripeInvoiceId])
|
|
1810
|
+
@@map("billing_usage_events")
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
model StripeWebhookEvent {
|
|
1814
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('swe'::text)"))
|
|
1815
|
+
stripeEventId String @unique @map("stripe_event_id")
|
|
1816
|
+
eventType String @map("event_type")
|
|
1817
|
+
payload Json
|
|
1818
|
+
status String @default("processed")
|
|
1819
|
+
error String?
|
|
1820
|
+
processedAt DateTime @default(now()) @map("processed_at")
|
|
1821
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1822
|
+
|
|
1823
|
+
@@index([eventType])
|
|
1824
|
+
@@index([status])
|
|
1825
|
+
@@map("stripe_webhook_events")
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
model BillingAuditEvent {
|
|
1829
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('bae'::text)"))
|
|
1830
|
+
organizationId String @map("organization_id")
|
|
1831
|
+
eventType String @map("event_type")
|
|
1832
|
+
skuKey String? @map("sku_key")
|
|
1833
|
+
stripeEventId String? @map("stripe_event_id")
|
|
1834
|
+
metadata Json?
|
|
1835
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1836
|
+
|
|
1837
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1838
|
+
|
|
1839
|
+
@@index([organizationId])
|
|
1840
|
+
@@index([stripeEventId])
|
|
1841
|
+
@@index([skuKey])
|
|
1842
|
+
@@map("billing_audit_events")
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
model BillingCreditBalance {
|
|
1846
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('bcb'::text)"))
|
|
1847
|
+
organizationId String @map("organization_id")
|
|
1848
|
+
productKey String @map("product_key")
|
|
1849
|
+
skuKey String? @map("sku_key")
|
|
1850
|
+
balance Int @default(0)
|
|
1851
|
+
totalGranted Int @default(0) @map("total_granted")
|
|
1852
|
+
totalConsumed Int @default(0) @map("total_consumed")
|
|
1853
|
+
totalRefunded Int @default(0) @map("total_refunded")
|
|
1854
|
+
lastSource String @default("manual") @map("last_source")
|
|
1855
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1856
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
1857
|
+
|
|
1858
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1859
|
+
events BillingCreditEvent[]
|
|
1860
|
+
|
|
1861
|
+
@@index([organizationId, productKey])
|
|
1862
|
+
@@map("billing_credit_balances")
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
model BillingCreditEvent {
|
|
1866
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('bce'::text)"))
|
|
1867
|
+
organizationId String @map("organization_id")
|
|
1868
|
+
balanceId String @map("balance_id")
|
|
1869
|
+
productKey String @map("product_key")
|
|
1870
|
+
skuKey String? @map("sku_key")
|
|
1871
|
+
eventType String @map("event_type")
|
|
1872
|
+
quantity Int
|
|
1873
|
+
source String
|
|
1874
|
+
note String?
|
|
1875
|
+
adminUserId String? @map("admin_user_id")
|
|
1876
|
+
sourceResourceId String? @map("source_resource_id")
|
|
1877
|
+
linkedEventId String? @map("linked_event_id")
|
|
1878
|
+
idempotencyKey String @unique @map("idempotency_key")
|
|
1879
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
1880
|
+
|
|
1881
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1882
|
+
balance BillingCreditBalance @relation(fields: [balanceId], references: [id], onDelete: Cascade)
|
|
1883
|
+
|
|
1884
|
+
@@index([organizationId, productKey])
|
|
1885
|
+
@@index([sourceResourceId])
|
|
1886
|
+
@@index([linkedEventId])
|
|
1887
|
+
@@map("billing_credit_events")
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1747
1890
|
// ===== organization.prisma =====
|
|
1748
1891
|
model Organization {
|
|
1749
1892
|
id String @id @default(dbgenerated("generate_prefixed_cuid('org'::text)"))
|
|
@@ -1760,6 +1903,7 @@ model Organization {
|
|
|
1760
1903
|
evidenceApprovalEnabled Boolean @default(false)
|
|
1761
1904
|
deviceAgentStepEnabled Boolean @default(true)
|
|
1762
1905
|
securityTrainingStepEnabled Boolean @default(true)
|
|
1906
|
+
backgroundCheckStepEnabled Boolean @default(true)
|
|
1763
1907
|
whistleblowerReportEnabled Boolean @default(true)
|
|
1764
1908
|
accessRequestFormEnabled Boolean @default(true)
|
|
1765
1909
|
|
|
@@ -1786,6 +1930,7 @@ model Organization {
|
|
|
1786
1930
|
comments Comment[]
|
|
1787
1931
|
attachments Attachment[]
|
|
1788
1932
|
evidenceSubmissions EvidenceSubmission[]
|
|
1933
|
+
evidenceFormSettings EvidenceFormSetting[]
|
|
1789
1934
|
trust Trust[]
|
|
1790
1935
|
context Context[]
|
|
1791
1936
|
secrets Secret[]
|
|
@@ -1810,8 +1955,13 @@ model Organization {
|
|
|
1810
1955
|
// Pentest credits — wallet of run-credits an org can spend.
|
|
1811
1956
|
// Source of credits (trial / future Stripe subscription / top-up)
|
|
1812
1957
|
// is metadata on the row; balance is unified.
|
|
1813
|
-
pentestCredits
|
|
1814
|
-
billing
|
|
1958
|
+
pentestCredits PentestCredits?
|
|
1959
|
+
billing OrganizationBilling?
|
|
1960
|
+
billingSubscriptions OrganizationBillingSubscription[]
|
|
1961
|
+
billingUsageEvents BillingUsageEvent[]
|
|
1962
|
+
billingAuditEvents BillingAuditEvent[]
|
|
1963
|
+
billingCreditBalances BillingCreditBalance[]
|
|
1964
|
+
billingCreditEvents BillingCreditEvent[]
|
|
1815
1965
|
|
|
1816
1966
|
// Browser Automation
|
|
1817
1967
|
browserbaseContext BrowserbaseContext?
|
|
@@ -1880,7 +2030,7 @@ model PentestCredits {
|
|
|
1880
2030
|
lastGrantSource String @default("trial") @map("last_grant_source")
|
|
1881
2031
|
|
|
1882
2032
|
createdAt DateTime @default(now()) @map("created_at")
|
|
1883
|
-
updatedAt DateTime @updatedAt
|
|
2033
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
1884
2034
|
|
|
1885
2035
|
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1886
2036
|
|
|
@@ -2135,6 +2285,20 @@ model Risk {
|
|
|
2135
2285
|
residualImpact Impact @default(insignificant)
|
|
2136
2286
|
treatmentStrategyDescription String?
|
|
2137
2287
|
treatmentStrategy RiskTreatmentType @default(accept)
|
|
2288
|
+
// Per-strategy text store. When the user switches strategies, the current
|
|
2289
|
+
// `treatmentStrategyDescription` is moved into this map under the OLD
|
|
2290
|
+
// strategy key, and the NEW strategy's saved value is loaded back into the
|
|
2291
|
+
// active field. Lets users keep an independent Mitigate plan + Accept
|
|
2292
|
+
// rationale + Transfer rationale on the same risk.
|
|
2293
|
+
// Shape: { mitigate?: string, accept?: string, transfer?: string, avoid?: string }
|
|
2294
|
+
strategyDescriptions Json?
|
|
2295
|
+
|
|
2296
|
+
// Active auto-link suggestion run (trigger.dev). Set when the user kicks
|
|
2297
|
+
// off an AI suggest scan; cleared when the user applies or discards. Lets
|
|
2298
|
+
// the UI resume an in-flight or completed-but-unreviewed scan after a
|
|
2299
|
+
// page reload so progress isn't lost.
|
|
2300
|
+
autoLinkRunId String?
|
|
2301
|
+
autoLinkRunStartedAt DateTime?
|
|
2138
2302
|
|
|
2139
2303
|
// Dates
|
|
2140
2304
|
createdAt DateTime @default(now())
|
|
@@ -2201,11 +2365,12 @@ model Secret {
|
|
|
2201
2365
|
|
|
2202
2366
|
// ===== security-penetration-test-run.prisma =====
|
|
2203
2367
|
model SecurityPenetrationTestRun {
|
|
2204
|
-
id
|
|
2205
|
-
organizationId
|
|
2206
|
-
providerRunId
|
|
2207
|
-
|
|
2208
|
-
|
|
2368
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('ptr'::text)"))
|
|
2369
|
+
organizationId String @map("organization_id")
|
|
2370
|
+
providerRunId String @map("provider_run_id")
|
|
2371
|
+
billingUsageSourceId String? @map("billing_usage_source_id")
|
|
2372
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
2373
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
2209
2374
|
|
|
2210
2375
|
/// Set the first time we refund this run's credit (e.g. on
|
|
2211
2376
|
/// `pentest.failed` / `pentest.cancelled` webhooks). Used to make the
|
|
@@ -3044,6 +3209,10 @@ model Vendor {
|
|
|
3044
3209
|
inherentImpact Impact @default(insignificant)
|
|
3045
3210
|
residualProbability Likelihood @default(very_unlikely)
|
|
3046
3211
|
residualImpact Impact @default(insignificant)
|
|
3212
|
+
treatmentStrategy RiskTreatmentType @default(accept)
|
|
3213
|
+
treatmentStrategyDescription String?
|
|
3214
|
+
// See `Risk.strategyDescriptions`.
|
|
3215
|
+
strategyDescriptions Json?
|
|
3047
3216
|
website String?
|
|
3048
3217
|
isSubProcessor Boolean @default(false)
|
|
3049
3218
|
|
|
@@ -3053,6 +3222,11 @@ model Vendor {
|
|
|
3053
3222
|
trustPortalOrder Int?
|
|
3054
3223
|
complianceBadges Json? // Array of { type: 'soc2' | 'iso27001' | etc, verified: boolean }
|
|
3055
3224
|
|
|
3225
|
+
// Active auto-link suggestion run (trigger.dev). Same semantics as
|
|
3226
|
+
// Risk.autoLinkRunId — lets the UI resume an in-flight scan on reload.
|
|
3227
|
+
autoLinkRunId String?
|
|
3228
|
+
autoLinkRunStartedAt DateTime?
|
|
3229
|
+
|
|
3056
3230
|
createdAt DateTime @default(now())
|
|
3057
3231
|
updatedAt DateTime @updatedAt
|
|
3058
3232
|
|