tenancy-schema.ts 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710
  1. // Generated from prisma/schema by scripts/generate-tenancy-schema.ts. Do not edit.
  2. import type { SchemaGraph } from './schema-graph'
  3. /**
  4. * Which models carry an organisation, which columns are foreign keys and how
  5. * a child model reaches its workshop. What the restore's tenancy guard reads.
  6. */
  7. export const TENANCY_SCHEMA: SchemaGraph = {
  8. AiGeneratedMessage: {
  9. organizationId: false,
  10. foreignKeys: {
  11. vehicleId: {
  12. target: 'Vehicle',
  13. required: true,
  14. relation: 'vehicle',
  15. },
  16. },
  17. ownerPaths: [['vehicle']],
  18. },
  19. AiChat: {
  20. organizationId: true,
  21. foreignKeys: {
  22. vehicleId: {
  23. target: 'Vehicle',
  24. required: false,
  25. relation: 'vehicle',
  26. },
  27. customerId: {
  28. target: 'Customer',
  29. required: false,
  30. relation: 'customer',
  31. },
  32. },
  33. ownerPaths: [],
  34. },
  35. AiChatMessage: {
  36. organizationId: false,
  37. foreignKeys: {
  38. chatId: {
  39. target: 'AiChat',
  40. required: true,
  41. relation: 'chat',
  42. },
  43. },
  44. ownerPaths: [['chat']],
  45. },
  46. Appointment: {
  47. organizationId: true,
  48. foreignKeys: {
  49. organizationId: {
  50. target: 'Organization',
  51. required: true,
  52. relation: 'organization',
  53. },
  54. customerId: {
  55. target: 'Customer',
  56. required: false,
  57. relation: 'customer',
  58. },
  59. vehicleId: {
  60. target: 'Vehicle',
  61. required: false,
  62. relation: 'vehicle',
  63. },
  64. createdById: {
  65. target: 'User',
  66. required: false,
  67. relation: 'createdBy',
  68. },
  69. },
  70. ownerPaths: [],
  71. },
  72. AppointmentNotification: {
  73. organizationId: true,
  74. foreignKeys: {
  75. organizationId: {
  76. target: 'Organization',
  77. required: true,
  78. relation: 'organization',
  79. },
  80. userId: {
  81. target: 'User',
  82. required: false,
  83. relation: 'user',
  84. },
  85. appointmentId: {
  86. target: 'Appointment',
  87. required: false,
  88. relation: 'appointment',
  89. },
  90. serviceRecordId: {
  91. target: 'ServiceRecord',
  92. required: false,
  93. relation: 'serviceRecord',
  94. },
  95. },
  96. ownerPaths: [],
  97. },
  98. AuditLog: {
  99. organizationId: true,
  100. foreignKeys: {
  101. userId: {
  102. target: 'User',
  103. required: false,
  104. relation: 'user',
  105. },
  106. organizationId: {
  107. target: 'Organization',
  108. required: false,
  109. relation: 'organization',
  110. },
  111. },
  112. ownerPaths: [],
  113. },
  114. User: {
  115. organizationId: false,
  116. foreignKeys: {},
  117. ownerPaths: [],
  118. },
  119. Session: {
  120. organizationId: true,
  121. foreignKeys: {
  122. userId: {
  123. target: 'User',
  124. required: true,
  125. relation: 'user',
  126. },
  127. organizationId: {
  128. target: 'Organization',
  129. required: false,
  130. relation: 'organization',
  131. },
  132. },
  133. ownerPaths: [],
  134. },
  135. Account: {
  136. organizationId: false,
  137. foreignKeys: {
  138. userId: {
  139. target: 'User',
  140. required: true,
  141. relation: 'user',
  142. },
  143. },
  144. ownerPaths: [],
  145. },
  146. Verification: {
  147. organizationId: false,
  148. foreignKeys: {},
  149. ownerPaths: [],
  150. },
  151. TwoFactor: {
  152. organizationId: false,
  153. foreignKeys: {
  154. userId: {
  155. target: 'User',
  156. required: true,
  157. relation: 'user',
  158. },
  159. },
  160. ownerPaths: [],
  161. },
  162. Passkey: {
  163. organizationId: false,
  164. foreignKeys: {
  165. userId: {
  166. target: 'User',
  167. required: true,
  168. relation: 'user',
  169. },
  170. },
  171. ownerPaths: [],
  172. },
  173. UserDevice: {
  174. organizationId: false,
  175. foreignKeys: {
  176. userId: {
  177. target: 'User',
  178. required: true,
  179. relation: 'user',
  180. },
  181. },
  182. ownerPaths: [],
  183. },
  184. SubscriptionPlan: {
  185. organizationId: false,
  186. foreignKeys: {},
  187. ownerPaths: [],
  188. },
  189. Subscription: {
  190. organizationId: true,
  191. foreignKeys: {
  192. organizationId: {
  193. target: 'Organization',
  194. required: true,
  195. relation: 'organization',
  196. },
  197. planId: {
  198. target: 'SubscriptionPlan',
  199. required: true,
  200. relation: 'plan',
  201. },
  202. },
  203. ownerPaths: [],
  204. },
  205. WorkshopClosure: {
  206. organizationId: true,
  207. foreignKeys: {
  208. organizationId: {
  209. target: 'Organization',
  210. required: true,
  211. relation: 'organization',
  212. },
  213. },
  214. ownerPaths: [],
  215. },
  216. TechnicianAbsence: {
  217. organizationId: true,
  218. foreignKeys: {
  219. technicianId: {
  220. target: 'Technician',
  221. required: true,
  222. relation: 'technician',
  223. },
  224. organizationId: {
  225. target: 'Organization',
  226. required: true,
  227. relation: 'organization',
  228. },
  229. },
  230. ownerPaths: [],
  231. },
  232. ConditionMark: {
  233. organizationId: true,
  234. foreignKeys: {
  235. organizationId: {
  236. target: 'Organization',
  237. required: true,
  238. relation: 'organization',
  239. },
  240. vehicleId: {
  241. target: 'Vehicle',
  242. required: true,
  243. relation: 'vehicle',
  244. },
  245. inspectionId: {
  246. target: 'Inspection',
  247. required: false,
  248. relation: 'inspection',
  249. },
  250. inspectionItemId: {
  251. target: 'InspectionItem',
  252. required: false,
  253. relation: 'inspectionItem',
  254. },
  255. serviceRecordId: {
  256. target: 'ServiceRecord',
  257. required: false,
  258. relation: 'serviceRecord',
  259. },
  260. recordedById: {
  261. target: 'User',
  262. required: false,
  263. relation: 'recordedBy',
  264. },
  265. resolvedById: {
  266. target: 'User',
  267. required: false,
  268. relation: 'resolvedBy',
  269. },
  270. },
  271. ownerPaths: [],
  272. },
  273. ConditionMarkType: {
  274. organizationId: true,
  275. foreignKeys: {
  276. organizationId: {
  277. target: 'Organization',
  278. required: true,
  279. relation: 'organization',
  280. },
  281. },
  282. ownerPaths: [],
  283. },
  284. CustomFieldDefinition: {
  285. organizationId: true,
  286. foreignKeys: {
  287. userId: {
  288. target: 'User',
  289. required: true,
  290. relation: 'user',
  291. },
  292. organizationId: {
  293. target: 'Organization',
  294. required: false,
  295. relation: 'organization',
  296. },
  297. },
  298. ownerPaths: [],
  299. },
  300. CustomFieldValue: {
  301. organizationId: false,
  302. foreignKeys: {
  303. fieldId: {
  304. target: 'CustomFieldDefinition',
  305. required: true,
  306. relation: 'field',
  307. },
  308. },
  309. ownerPaths: [['field']],
  310. },
  311. Customer: {
  312. organizationId: true,
  313. foreignKeys: {
  314. userId: {
  315. target: 'User',
  316. required: true,
  317. relation: 'user',
  318. },
  319. organizationId: {
  320. target: 'Organization',
  321. required: false,
  322. relation: 'organization',
  323. },
  324. invoiceDesignId: {
  325. target: 'DocumentDesign',
  326. required: false,
  327. relation: 'invoiceDesign',
  328. },
  329. importBatchId: {
  330. target: 'ImportBatch',
  331. required: false,
  332. relation: 'importBatch',
  333. },
  334. },
  335. ownerPaths: [],
  336. },
  337. CustomerSession: {
  338. organizationId: true,
  339. foreignKeys: {
  340. customerId: {
  341. target: 'Customer',
  342. required: true,
  343. relation: 'customer',
  344. },
  345. },
  346. ownerPaths: [],
  347. },
  348. CustomerMagicLink: {
  349. organizationId: true,
  350. foreignKeys: {},
  351. ownerPaths: [],
  352. },
  353. CustomerSmsCode: {
  354. organizationId: true,
  355. foreignKeys: {},
  356. ownerPaths: [],
  357. },
  358. ServiceRequest: {
  359. organizationId: true,
  360. foreignKeys: {
  361. customerId: {
  362. target: 'Customer',
  363. required: true,
  364. relation: 'customer',
  365. },
  366. vehicleId: {
  367. target: 'Vehicle',
  368. required: true,
  369. relation: 'vehicle',
  370. },
  371. },
  372. ownerPaths: [],
  373. },
  374. DocumentDesign: {
  375. organizationId: true,
  376. foreignKeys: {
  377. organizationId: {
  378. target: 'Organization',
  379. required: true,
  380. relation: 'organization',
  381. },
  382. },
  383. ownerPaths: [],
  384. },
  385. DocumentDesignSnapshot: {
  386. organizationId: true,
  387. foreignKeys: {
  388. organizationId: {
  389. target: 'Organization',
  390. required: true,
  391. relation: 'organization',
  392. },
  393. },
  394. ownerPaths: [],
  395. },
  396. DocumentAssetSnapshot: {
  397. organizationId: true,
  398. foreignKeys: {
  399. organizationId: {
  400. target: 'Organization',
  401. required: true,
  402. relation: 'organization',
  403. },
  404. },
  405. ownerPaths: [],
  406. },
  407. EmailTemplate: {
  408. organizationId: true,
  409. foreignKeys: {
  410. organizationId: {
  411. target: 'Organization',
  412. required: true,
  413. relation: 'organization',
  414. },
  415. },
  416. ownerPaths: [],
  417. },
  418. ImportBatch: {
  419. organizationId: true,
  420. foreignKeys: {
  421. organizationId: {
  422. target: 'Organization',
  423. required: true,
  424. relation: 'organization',
  425. },
  426. userId: {
  427. target: 'User',
  428. required: true,
  429. relation: 'user',
  430. },
  431. },
  432. ownerPaths: [],
  433. },
  434. InspectionTemplate: {
  435. organizationId: true,
  436. foreignKeys: {
  437. organizationId: {
  438. target: 'Organization',
  439. required: true,
  440. relation: 'organization',
  441. },
  442. },
  443. ownerPaths: [],
  444. },
  445. InspectionTemplateSection: {
  446. organizationId: false,
  447. foreignKeys: {
  448. templateId: {
  449. target: 'InspectionTemplate',
  450. required: true,
  451. relation: 'template',
  452. },
  453. },
  454. ownerPaths: [['template']],
  455. },
  456. InspectionTemplateItem: {
  457. organizationId: false,
  458. foreignKeys: {
  459. sectionId: {
  460. target: 'InspectionTemplateSection',
  461. required: true,
  462. relation: 'section',
  463. },
  464. },
  465. ownerPaths: [['section', 'template']],
  466. },
  467. Inspection: {
  468. organizationId: true,
  469. foreignKeys: {
  470. vehicleId: {
  471. target: 'Vehicle',
  472. required: true,
  473. relation: 'vehicle',
  474. },
  475. templateId: {
  476. target: 'InspectionTemplate',
  477. required: true,
  478. relation: 'template',
  479. },
  480. technicianId: {
  481. target: 'Technician',
  482. required: false,
  483. relation: 'technician',
  484. },
  485. workBayId: {
  486. target: 'WorkBay',
  487. required: false,
  488. relation: 'workBay',
  489. },
  490. designSnapshotId: {
  491. target: 'DocumentDesignSnapshot',
  492. required: false,
  493. relation: 'designSnapshot',
  494. },
  495. signatureSnapshotId: {
  496. target: 'DocumentAssetSnapshot',
  497. required: false,
  498. relation: 'signatureSnapshot',
  499. },
  500. importBatchId: {
  501. target: 'ImportBatch',
  502. required: false,
  503. relation: 'importBatch',
  504. },
  505. },
  506. ownerPaths: [],
  507. },
  508. InspectionAttachment: {
  509. organizationId: false,
  510. foreignKeys: {
  511. inspectionId: {
  512. target: 'Inspection',
  513. required: true,
  514. relation: 'inspection',
  515. },
  516. },
  517. ownerPaths: [['inspection']],
  518. },
  519. InspectionItem: {
  520. organizationId: false,
  521. foreignKeys: {
  522. inspectionId: {
  523. target: 'Inspection',
  524. required: true,
  525. relation: 'inspection',
  526. },
  527. },
  528. ownerPaths: [['inspection']],
  529. },
  530. InspectionQuoteRequest: {
  531. organizationId: true,
  532. foreignKeys: {
  533. inspectionId: {
  534. target: 'Inspection',
  535. required: true,
  536. relation: 'inspection',
  537. },
  538. },
  539. ownerPaths: [],
  540. },
  541. IntegrationConnection: {
  542. organizationId: true,
  543. foreignKeys: {
  544. organizationId: {
  545. target: 'Organization',
  546. required: true,
  547. relation: 'organization',
  548. },
  549. },
  550. ownerPaths: [],
  551. },
  552. IntegrationLink: {
  553. organizationId: false,
  554. foreignKeys: {
  555. connectionId: {
  556. target: 'IntegrationConnection',
  557. required: true,
  558. relation: 'connection',
  559. },
  560. },
  561. ownerPaths: [['connection']],
  562. },
  563. IntegrationJob: {
  564. organizationId: true,
  565. foreignKeys: {
  566. connectionId: {
  567. target: 'IntegrationConnection',
  568. required: true,
  569. relation: 'connection',
  570. },
  571. },
  572. ownerPaths: [],
  573. },
  574. IntegrationLog: {
  575. organizationId: false,
  576. foreignKeys: {
  577. connectionId: {
  578. target: 'IntegrationConnection',
  579. required: true,
  580. relation: 'connection',
  581. },
  582. },
  583. ownerPaths: [['connection']],
  584. },
  585. ExternalCalendarEvent: {
  586. organizationId: true,
  587. foreignKeys: {
  588. connectionId: {
  589. target: 'IntegrationConnection',
  590. required: true,
  591. relation: 'connection',
  592. },
  593. organizationId: {
  594. target: 'Organization',
  595. required: true,
  596. relation: 'organization',
  597. },
  598. },
  599. ownerPaths: [],
  600. },
  601. VehicleSafetyReport: {
  602. organizationId: false,
  603. foreignKeys: {},
  604. ownerPaths: [],
  605. },
  606. RepairDataCache: {
  607. organizationId: false,
  608. foreignKeys: {
  609. connectionId: {
  610. target: 'IntegrationConnection',
  611. required: false,
  612. relation: 'connection',
  613. },
  614. },
  615. ownerPaths: [['connection']],
  616. },
  617. BackupRun: {
  618. organizationId: true,
  619. foreignKeys: {
  620. organizationId: {
  621. target: 'Organization',
  622. required: true,
  623. relation: 'organization',
  624. },
  625. connectionId: {
  626. target: 'IntegrationConnection',
  627. required: false,
  628. relation: 'connection',
  629. },
  630. },
  631. ownerPaths: [],
  632. },
  633. PlatformBackup: {
  634. organizationId: true,
  635. foreignKeys: {
  636. organizationId: {
  637. target: 'Organization',
  638. required: true,
  639. relation: 'organization',
  640. },
  641. },
  642. ownerPaths: [],
  643. },
  644. LaborPreset: {
  645. organizationId: true,
  646. foreignKeys: {
  647. organizationId: {
  648. target: 'Organization',
  649. required: true,
  650. relation: 'organization',
  651. },
  652. },
  653. ownerPaths: [],
  654. },
  655. LaborPresetItem: {
  656. organizationId: false,
  657. foreignKeys: {
  658. presetId: {
  659. target: 'LaborPreset',
  660. required: true,
  661. relation: 'preset',
  662. },
  663. },
  664. ownerPaths: [['preset']],
  665. },
  666. LaborPresetPart: {
  667. organizationId: false,
  668. foreignKeys: {
  669. presetId: {
  670. target: 'LaborPreset',
  671. required: true,
  672. relation: 'preset',
  673. },
  674. },
  675. ownerPaths: [['preset']],
  676. },
  677. InventoryPart: {
  678. organizationId: true,
  679. foreignKeys: {
  680. userId: {
  681. target: 'User',
  682. required: true,
  683. relation: 'user',
  684. },
  685. organizationId: {
  686. target: 'Organization',
  687. required: false,
  688. relation: 'organization',
  689. },
  690. },
  691. ownerPaths: [],
  692. },
  693. StockMovement: {
  694. organizationId: true,
  695. foreignKeys: {
  696. inventoryPartId: {
  697. target: 'InventoryPart',
  698. required: true,
  699. relation: 'inventoryPart',
  700. },
  701. serviceRecordId: {
  702. target: 'ServiceRecord',
  703. required: false,
  704. relation: 'serviceRecord',
  705. },
  706. userId: {
  707. target: 'User',
  708. required: false,
  709. relation: 'user',
  710. },
  711. organizationId: {
  712. target: 'Organization',
  713. required: true,
  714. relation: 'organization',
  715. },
  716. },
  717. ownerPaths: [],
  718. },
  719. StoredImage: {
  720. organizationId: false,
  721. foreignKeys: {
  722. inventoryPartId: {
  723. target: 'InventoryPart',
  724. required: false,
  725. relation: 'inventoryPart',
  726. },
  727. tireMeasurementId: {
  728. target: 'TireMeasurement',
  729. required: false,
  730. relation: 'tireMeasurement',
  731. },
  732. },
  733. ownerPaths: [
  734. ['inventoryPart'],
  735. ['tireMeasurement', 'tireSet'],
  736. ['tireMeasurement', 'movement'],
  737. ],
  738. },
  739. Notification: {
  740. organizationId: true,
  741. foreignKeys: {},
  742. ownerPaths: [],
  743. },
  744. SmsMessage: {
  745. organizationId: true,
  746. foreignKeys: {
  747. organizationId: {
  748. target: 'Organization',
  749. required: true,
  750. relation: 'organization',
  751. },
  752. customerId: {
  753. target: 'Customer',
  754. required: false,
  755. relation: 'customer',
  756. },
  757. },
  758. ownerPaths: [],
  759. },
  760. TelegramMessage: {
  761. organizationId: true,
  762. foreignKeys: {
  763. organizationId: {
  764. target: 'Organization',
  765. required: true,
  766. relation: 'organization',
  767. },
  768. customerId: {
  769. target: 'Customer',
  770. required: false,
  771. relation: 'customer',
  772. },
  773. },
  774. ownerPaths: [],
  775. },
  776. WhatsappMessage: {
  777. organizationId: true,
  778. foreignKeys: {
  779. organizationId: {
  780. target: 'Organization',
  781. required: true,
  782. relation: 'organization',
  783. },
  784. customerId: {
  785. target: 'Customer',
  786. required: false,
  787. relation: 'customer',
  788. },
  789. },
  790. ownerPaths: [],
  791. },
  792. ScheduledMessage: {
  793. organizationId: true,
  794. foreignKeys: {
  795. organizationId: {
  796. target: 'Organization',
  797. required: true,
  798. relation: 'organization',
  799. },
  800. customerId: {
  801. target: 'Customer',
  802. required: false,
  803. relation: 'customer',
  804. },
  805. vehicleId: {
  806. target: 'Vehicle',
  807. required: false,
  808. relation: 'vehicle',
  809. },
  810. },
  811. ownerPaths: [],
  812. },
  813. EmailMessage: {
  814. organizationId: true,
  815. foreignKeys: {
  816. organizationId: {
  817. target: 'Organization',
  818. required: true,
  819. relation: 'organization',
  820. },
  821. customerId: {
  822. target: 'Customer',
  823. required: false,
  824. relation: 'customer',
  825. },
  826. },
  827. ownerPaths: [],
  828. },
  829. EmailAttachment: {
  830. organizationId: false,
  831. foreignKeys: {
  832. messageId: {
  833. target: 'EmailMessage',
  834. required: true,
  835. relation: 'message',
  836. },
  837. },
  838. ownerPaths: [['message']],
  839. },
  840. AppSetting: {
  841. organizationId: true,
  842. foreignKeys: {
  843. userId: {
  844. target: 'User',
  845. required: true,
  846. relation: 'user',
  847. },
  848. organizationId: {
  849. target: 'Organization',
  850. required: false,
  851. relation: 'organization',
  852. },
  853. },
  854. ownerPaths: [],
  855. },
  856. DashboardWidget: {
  857. organizationId: true,
  858. foreignKeys: {
  859. userId: {
  860. target: 'User',
  861. required: true,
  862. relation: 'user',
  863. },
  864. },
  865. ownerPaths: [],
  866. },
  867. Organization: {
  868. organizationId: false,
  869. foreignKeys: {},
  870. ownerPaths: [],
  871. },
  872. OrganizationMember: {
  873. organizationId: true,
  874. foreignKeys: {
  875. userId: {
  876. target: 'User',
  877. required: true,
  878. relation: 'user',
  879. },
  880. organizationId: {
  881. target: 'Organization',
  882. required: true,
  883. relation: 'organization',
  884. },
  885. roleId: {
  886. target: 'Role',
  887. required: false,
  888. relation: 'customRole',
  889. },
  890. },
  891. ownerPaths: [],
  892. },
  893. MemberSignature: {
  894. organizationId: false,
  895. foreignKeys: {
  896. memberId: {
  897. target: 'OrganizationMember',
  898. required: true,
  899. relation: 'member',
  900. },
  901. },
  902. ownerPaths: [['member']],
  903. },
  904. Role: {
  905. organizationId: true,
  906. foreignKeys: {
  907. organizationId: {
  908. target: 'Organization',
  909. required: true,
  910. relation: 'organization',
  911. },
  912. },
  913. ownerPaths: [],
  914. },
  915. Permission: {
  916. organizationId: false,
  917. foreignKeys: {
  918. roleId: {
  919. target: 'Role',
  920. required: true,
  921. relation: 'role',
  922. },
  923. },
  924. ownerPaths: [['role']],
  925. },
  926. SystemSetting: {
  927. organizationId: false,
  928. foreignKeys: {},
  929. ownerPaths: [],
  930. },
  931. TeamInvitation: {
  932. organizationId: true,
  933. foreignKeys: {
  934. organizationId: {
  935. target: 'Organization',
  936. required: true,
  937. relation: 'organization',
  938. },
  939. roleId: {
  940. target: 'Role',
  941. required: false,
  942. relation: 'customRole',
  943. },
  944. },
  945. ownerPaths: [],
  946. },
  947. PlatformMailUsage: {
  948. organizationId: true,
  949. foreignKeys: {},
  950. ownerPaths: [],
  951. },
  952. PlatformSmsUsage: {
  953. organizationId: true,
  954. foreignKeys: {},
  955. ownerPaths: [],
  956. },
  957. Quote: {
  958. organizationId: true,
  959. foreignKeys: {
  960. userId: {
  961. target: 'User',
  962. required: true,
  963. relation: 'user',
  964. },
  965. organizationId: {
  966. target: 'Organization',
  967. required: false,
  968. relation: 'organization',
  969. },
  970. customerId: {
  971. target: 'Customer',
  972. required: false,
  973. relation: 'customer',
  974. },
  975. tireSetId: {
  976. target: 'TireSet',
  977. required: false,
  978. relation: 'tireSet',
  979. },
  980. vehicleId: {
  981. target: 'Vehicle',
  982. required: false,
  983. relation: 'vehicle',
  984. },
  985. inspectionId: {
  986. target: 'Inspection',
  987. required: false,
  988. relation: 'inspection',
  989. },
  990. },
  991. ownerPaths: [],
  992. },
  993. QuoteAttachment: {
  994. organizationId: false,
  995. foreignKeys: {
  996. quoteId: {
  997. target: 'Quote',
  998. required: true,
  999. relation: 'quote',
  1000. },
  1001. },
  1002. ownerPaths: [['quote']],
  1003. },
  1004. QuotePart: {
  1005. organizationId: false,
  1006. foreignKeys: {
  1007. quoteId: {
  1008. target: 'Quote',
  1009. required: true,
  1010. relation: 'quote',
  1011. },
  1012. },
  1013. ownerPaths: [['quote']],
  1014. },
  1015. QuoteLabor: {
  1016. organizationId: false,
  1017. foreignKeys: {
  1018. quoteId: {
  1019. target: 'Quote',
  1020. required: true,
  1021. relation: 'quote',
  1022. },
  1023. },
  1024. ownerPaths: [['quote']],
  1025. },
  1026. StatusReport: {
  1027. organizationId: true,
  1028. foreignKeys: {
  1029. serviceRecordId: {
  1030. target: 'ServiceRecord',
  1031. required: false,
  1032. relation: 'serviceRecord',
  1033. },
  1034. inspectionId: {
  1035. target: 'Inspection',
  1036. required: false,
  1037. relation: 'inspection',
  1038. },
  1039. organizationId: {
  1040. target: 'Organization',
  1041. required: true,
  1042. relation: 'organization',
  1043. },
  1044. technicianId: {
  1045. target: 'Technician',
  1046. required: false,
  1047. relation: 'technician',
  1048. },
  1049. },
  1050. ownerPaths: [],
  1051. },
  1052. ReportSchedule: {
  1053. organizationId: true,
  1054. foreignKeys: {
  1055. organizationId: {
  1056. target: 'Organization',
  1057. required: true,
  1058. relation: 'organization',
  1059. },
  1060. },
  1061. ownerPaths: [],
  1062. },
  1063. ServiceRecord: {
  1064. organizationId: true,
  1065. foreignKeys: {
  1066. createdById: {
  1067. target: 'User',
  1068. required: false,
  1069. relation: 'createdBy',
  1070. },
  1071. designId: {
  1072. target: 'DocumentDesign',
  1073. required: false,
  1074. relation: 'design',
  1075. },
  1076. issuedDesignSnapshotId: {
  1077. target: 'DocumentDesignSnapshot',
  1078. required: false,
  1079. relation: 'issuedDesignSnapshot',
  1080. },
  1081. issuedLogoSnapshotId: {
  1082. target: 'DocumentAssetSnapshot',
  1083. required: false,
  1084. relation: 'issuedLogoSnapshot',
  1085. },
  1086. issuedSignatureSnapshotId: {
  1087. target: 'DocumentAssetSnapshot',
  1088. required: false,
  1089. relation: 'issuedSignatureSnapshot',
  1090. },
  1091. tireSetId: {
  1092. target: 'TireSet',
  1093. required: false,
  1094. relation: 'tireSet',
  1095. },
  1096. customStatusId: {
  1097. target: 'WorkOrderStatus',
  1098. required: false,
  1099. relation: 'customStatus',
  1100. },
  1101. vehicleId: {
  1102. target: 'Vehicle',
  1103. required: false,
  1104. relation: 'vehicle',
  1105. },
  1106. customerId: {
  1107. target: 'Customer',
  1108. required: false,
  1109. relation: 'customer',
  1110. },
  1111. inspectionId: {
  1112. target: 'Inspection',
  1113. required: false,
  1114. relation: 'inspection',
  1115. },
  1116. organizationId: {
  1117. target: 'Organization',
  1118. required: false,
  1119. relation: 'organization',
  1120. },
  1121. technicianId: {
  1122. target: 'Technician',
  1123. required: false,
  1124. relation: 'technician',
  1125. },
  1126. workBayId: {
  1127. target: 'WorkBay',
  1128. required: false,
  1129. relation: 'workBay',
  1130. },
  1131. importBatchId: {
  1132. target: 'ImportBatch',
  1133. required: false,
  1134. relation: 'importBatch',
  1135. },
  1136. },
  1137. ownerPaths: [],
  1138. },
  1139. ServiceConcern: {
  1140. organizationId: false,
  1141. foreignKeys: {
  1142. confirmedById: {
  1143. target: 'User',
  1144. required: false,
  1145. relation: 'confirmedBy',
  1146. },
  1147. serviceRecordId: {
  1148. target: 'ServiceRecord',
  1149. required: true,
  1150. relation: 'serviceRecord',
  1151. },
  1152. },
  1153. ownerPaths: [['serviceRecord']],
  1154. },
  1155. Payment: {
  1156. organizationId: false,
  1157. foreignKeys: {
  1158. serviceRecordId: {
  1159. target: 'ServiceRecord',
  1160. required: true,
  1161. relation: 'serviceRecord',
  1162. },
  1163. },
  1164. ownerPaths: [['serviceRecord']],
  1165. },
  1166. ServiceAttachment: {
  1167. organizationId: false,
  1168. foreignKeys: {
  1169. serviceRecordId: {
  1170. target: 'ServiceRecord',
  1171. required: true,
  1172. relation: 'serviceRecord',
  1173. },
  1174. concernId: {
  1175. target: 'ServiceConcern',
  1176. required: false,
  1177. relation: 'concern',
  1178. },
  1179. },
  1180. ownerPaths: [['serviceRecord'], ['concern', 'serviceRecord']],
  1181. },
  1182. ServicePart: {
  1183. organizationId: false,
  1184. foreignKeys: {
  1185. serviceRecordId: {
  1186. target: 'ServiceRecord',
  1187. required: true,
  1188. relation: 'serviceRecord',
  1189. },
  1190. },
  1191. ownerPaths: [['serviceRecord']],
  1192. },
  1193. ServiceLabor: {
  1194. organizationId: false,
  1195. foreignKeys: {
  1196. serviceRecordId: {
  1197. target: 'ServiceRecord',
  1198. required: true,
  1199. relation: 'serviceRecord',
  1200. },
  1201. },
  1202. ownerPaths: [['serviceRecord']],
  1203. },
  1204. RecurringInvoice: {
  1205. organizationId: false,
  1206. foreignKeys: {
  1207. vehicleId: {
  1208. target: 'Vehicle',
  1209. required: true,
  1210. relation: 'vehicle',
  1211. },
  1212. },
  1213. ownerPaths: [['vehicle']],
  1214. },
  1215. RecurringPart: {
  1216. organizationId: false,
  1217. foreignKeys: {
  1218. recurringInvoiceId: {
  1219. target: 'RecurringInvoice',
  1220. required: true,
  1221. relation: 'recurringInvoice',
  1222. },
  1223. },
  1224. ownerPaths: [['recurringInvoice', 'vehicle']],
  1225. },
  1226. RecurringLabor: {
  1227. organizationId: false,
  1228. foreignKeys: {
  1229. recurringInvoiceId: {
  1230. target: 'RecurringInvoice',
  1231. required: true,
  1232. relation: 'recurringInvoice',
  1233. },
  1234. },
  1235. ownerPaths: [['recurringInvoice', 'vehicle']],
  1236. },
  1237. WorkOrderStatus: {
  1238. organizationId: true,
  1239. foreignKeys: {
  1240. organizationId: {
  1241. target: 'Organization',
  1242. required: true,
  1243. relation: 'organization',
  1244. },
  1245. },
  1246. ownerPaths: [],
  1247. },
  1248. Technician: {
  1249. organizationId: true,
  1250. foreignKeys: {
  1251. userId: {
  1252. target: 'User',
  1253. required: false,
  1254. relation: 'user',
  1255. },
  1256. organizationId: {
  1257. target: 'Organization',
  1258. required: true,
  1259. relation: 'organization',
  1260. },
  1261. },
  1262. ownerPaths: [],
  1263. },
  1264. TimeEntry: {
  1265. organizationId: true,
  1266. foreignKeys: {
  1267. technicianId: {
  1268. target: 'Technician',
  1269. required: true,
  1270. relation: 'technician',
  1271. },
  1272. serviceRecordId: {
  1273. target: 'ServiceRecord',
  1274. required: true,
  1275. relation: 'serviceRecord',
  1276. },
  1277. organizationId: {
  1278. target: 'Organization',
  1279. required: true,
  1280. relation: 'organization',
  1281. },
  1282. },
  1283. ownerPaths: [],
  1284. },
  1285. ServiceRecordHelper: {
  1286. organizationId: true,
  1287. foreignKeys: {
  1288. serviceRecordId: {
  1289. target: 'ServiceRecord',
  1290. required: true,
  1291. relation: 'serviceRecord',
  1292. },
  1293. technicianId: {
  1294. target: 'Technician',
  1295. required: true,
  1296. relation: 'technician',
  1297. },
  1298. organizationId: {
  1299. target: 'Organization',
  1300. required: true,
  1301. relation: 'organization',
  1302. },
  1303. },
  1304. ownerPaths: [],
  1305. },
  1306. TechnicianLoginCode: {
  1307. organizationId: true,
  1308. foreignKeys: {
  1309. technicianId: {
  1310. target: 'Technician',
  1311. required: true,
  1312. relation: 'technician',
  1313. },
  1314. organizationId: {
  1315. target: 'Organization',
  1316. required: true,
  1317. relation: 'organization',
  1318. },
  1319. },
  1320. ownerPaths: [],
  1321. },
  1322. TechnicianSetupCode: {
  1323. organizationId: true,
  1324. foreignKeys: {
  1325. userId: {
  1326. target: 'User',
  1327. required: true,
  1328. relation: 'user',
  1329. },
  1330. organizationId: {
  1331. target: 'Organization',
  1332. required: true,
  1333. relation: 'organization',
  1334. },
  1335. },
  1336. ownerPaths: [],
  1337. },
  1338. PushDevice: {
  1339. organizationId: true,
  1340. foreignKeys: {
  1341. userId: {
  1342. target: 'User',
  1343. required: true,
  1344. relation: 'user',
  1345. },
  1346. organizationId: {
  1347. target: 'Organization',
  1348. required: true,
  1349. relation: 'organization',
  1350. },
  1351. },
  1352. ownerPaths: [],
  1353. },
  1354. WorkBay: {
  1355. organizationId: true,
  1356. foreignKeys: {
  1357. organizationId: {
  1358. target: 'Organization',
  1359. required: true,
  1360. relation: 'organization',
  1361. },
  1362. },
  1363. ownerPaths: [],
  1364. },
  1365. TireWarehouse: {
  1366. organizationId: true,
  1367. foreignKeys: {
  1368. organizationId: {
  1369. target: 'Organization',
  1370. required: true,
  1371. relation: 'organization',
  1372. },
  1373. userId: {
  1374. target: 'User',
  1375. required: true,
  1376. relation: 'user',
  1377. },
  1378. },
  1379. ownerPaths: [],
  1380. },
  1381. TireLocation: {
  1382. organizationId: true,
  1383. foreignKeys: {
  1384. warehouseId: {
  1385. target: 'TireWarehouse',
  1386. required: true,
  1387. relation: 'warehouse',
  1388. },
  1389. organizationId: {
  1390. target: 'Organization',
  1391. required: true,
  1392. relation: 'organization',
  1393. },
  1394. },
  1395. ownerPaths: [],
  1396. },
  1397. TireSet: {
  1398. organizationId: true,
  1399. foreignKeys: {
  1400. locationId: {
  1401. target: 'TireLocation',
  1402. required: false,
  1403. relation: 'location',
  1404. },
  1405. vehicleId: {
  1406. target: 'Vehicle',
  1407. required: false,
  1408. relation: 'vehicle',
  1409. },
  1410. customerId: {
  1411. target: 'Customer',
  1412. required: false,
  1413. relation: 'customer',
  1414. },
  1415. organizationId: {
  1416. target: 'Organization',
  1417. required: true,
  1418. relation: 'organization',
  1419. },
  1420. userId: {
  1421. target: 'User',
  1422. required: true,
  1423. relation: 'user',
  1424. },
  1425. },
  1426. ownerPaths: [],
  1427. },
  1428. TireSetAttachment: {
  1429. organizationId: true,
  1430. foreignKeys: {
  1431. tireSetId: {
  1432. target: 'TireSet',
  1433. required: true,
  1434. relation: 'tireSet',
  1435. },
  1436. organizationId: {
  1437. target: 'Organization',
  1438. required: true,
  1439. relation: 'organization',
  1440. },
  1441. uploadedById: {
  1442. target: 'User',
  1443. required: false,
  1444. relation: 'uploadedBy',
  1445. },
  1446. },
  1447. ownerPaths: [],
  1448. },
  1449. TireMeasurement: {
  1450. organizationId: false,
  1451. foreignKeys: {
  1452. tireSetId: {
  1453. target: 'TireSet',
  1454. required: true,
  1455. relation: 'tireSet',
  1456. },
  1457. movementId: {
  1458. target: 'TireMovement',
  1459. required: false,
  1460. relation: 'movement',
  1461. },
  1462. measuredById: {
  1463. target: 'User',
  1464. required: false,
  1465. relation: 'measuredBy',
  1466. },
  1467. },
  1468. ownerPaths: [['tireSet'], ['movement']],
  1469. },
  1470. TireMovement: {
  1471. organizationId: true,
  1472. foreignKeys: {
  1473. fromLocationId: {
  1474. target: 'TireLocation',
  1475. required: false,
  1476. relation: 'fromLocation',
  1477. },
  1478. toLocationId: {
  1479. target: 'TireLocation',
  1480. required: false,
  1481. relation: 'toLocation',
  1482. },
  1483. tireSetId: {
  1484. target: 'TireSet',
  1485. required: true,
  1486. relation: 'tireSet',
  1487. },
  1488. organizationId: {
  1489. target: 'Organization',
  1490. required: true,
  1491. relation: 'organization',
  1492. },
  1493. performedById: {
  1494. target: 'User',
  1495. required: false,
  1496. relation: 'performedBy',
  1497. },
  1498. },
  1499. ownerPaths: [],
  1500. },
  1501. TireTreatment: {
  1502. organizationId: true,
  1503. foreignKeys: {
  1504. tireSetId: {
  1505. target: 'TireSet',
  1506. required: true,
  1507. relation: 'tireSet',
  1508. },
  1509. completedById: {
  1510. target: 'User',
  1511. required: false,
  1512. relation: 'completedBy',
  1513. },
  1514. organizationId: {
  1515. target: 'Organization',
  1516. required: true,
  1517. relation: 'organization',
  1518. },
  1519. },
  1520. ownerPaths: [],
  1521. },
  1522. Vehicle: {
  1523. organizationId: true,
  1524. foreignKeys: {
  1525. userId: {
  1526. target: 'User',
  1527. required: true,
  1528. relation: 'user',
  1529. },
  1530. organizationId: {
  1531. target: 'Organization',
  1532. required: false,
  1533. relation: 'organization',
  1534. },
  1535. customerId: {
  1536. target: 'Customer',
  1537. required: false,
  1538. relation: 'customer',
  1539. },
  1540. importBatchId: {
  1541. target: 'ImportBatch',
  1542. required: false,
  1543. relation: 'importBatch',
  1544. },
  1545. },
  1546. ownerPaths: [],
  1547. },
  1548. Note: {
  1549. organizationId: false,
  1550. foreignKeys: {
  1551. vehicleId: {
  1552. target: 'Vehicle',
  1553. required: true,
  1554. relation: 'vehicle',
  1555. },
  1556. },
  1557. ownerPaths: [['vehicle']],
  1558. },
  1559. FuelLog: {
  1560. organizationId: false,
  1561. foreignKeys: {
  1562. vehicleId: {
  1563. target: 'Vehicle',
  1564. required: true,
  1565. relation: 'vehicle',
  1566. },
  1567. },
  1568. ownerPaths: [['vehicle']],
  1569. },
  1570. Reminder: {
  1571. organizationId: true,
  1572. foreignKeys: {
  1573. vehicleId: {
  1574. target: 'Vehicle',
  1575. required: false,
  1576. relation: 'vehicle',
  1577. },
  1578. customerId: {
  1579. target: 'Customer',
  1580. required: false,
  1581. relation: 'customer',
  1582. },
  1583. organizationId: {
  1584. target: 'Organization',
  1585. required: false,
  1586. relation: 'organization',
  1587. },
  1588. },
  1589. ownerPaths: [],
  1590. },
  1591. VehicleFinding: {
  1592. organizationId: false,
  1593. foreignKeys: {
  1594. vehicleId: {
  1595. target: 'Vehicle',
  1596. required: true,
  1597. relation: 'vehicle',
  1598. },
  1599. serviceRecordId: {
  1600. target: 'ServiceRecord',
  1601. required: false,
  1602. relation: 'serviceRecord',
  1603. },
  1604. resolvedServiceRecordId: {
  1605. target: 'ServiceRecord',
  1606. required: false,
  1607. relation: 'resolvedServiceRecord',
  1608. },
  1609. concernId: {
  1610. target: 'ServiceConcern',
  1611. required: false,
  1612. relation: 'concern',
  1613. },
  1614. sourceAttachmentId: {
  1615. target: 'ServiceAttachment',
  1616. required: false,
  1617. relation: 'sourceAttachment',
  1618. },
  1619. },
  1620. ownerPaths: [
  1621. ['vehicle'],
  1622. ['serviceRecord'],
  1623. ['resolvedServiceRecord'],
  1624. ['concern', 'serviceRecord'],
  1625. ['sourceAttachment', 'serviceRecord'],
  1626. ['sourceAttachment', 'concern', 'serviceRecord'],
  1627. ],
  1628. },
  1629. VehicleInspectionStatus: {
  1630. organizationId: true,
  1631. foreignKeys: {
  1632. vehicleId: {
  1633. target: 'Vehicle',
  1634. required: true,
  1635. relation: 'vehicle',
  1636. },
  1637. organizationId: {
  1638. target: 'Organization',
  1639. required: true,
  1640. relation: 'organization',
  1641. },
  1642. },
  1643. ownerPaths: [],
  1644. },
  1645. InspectionReminderCampaign: {
  1646. organizationId: true,
  1647. foreignKeys: {
  1648. organizationId: {
  1649. target: 'Organization',
  1650. required: true,
  1651. relation: 'organization',
  1652. },
  1653. },
  1654. ownerPaths: [],
  1655. },
  1656. InspectionReminderSend: {
  1657. organizationId: true,
  1658. foreignKeys: {
  1659. campaignId: {
  1660. target: 'InspectionReminderCampaign',
  1661. required: true,
  1662. relation: 'campaign',
  1663. },
  1664. organizationId: {
  1665. target: 'Organization',
  1666. required: true,
  1667. relation: 'organization',
  1668. },
  1669. vehicleId: {
  1670. target: 'Vehicle',
  1671. required: true,
  1672. relation: 'vehicle',
  1673. },
  1674. customerId: {
  1675. target: 'Customer',
  1676. required: true,
  1677. relation: 'customer',
  1678. },
  1679. scheduledMessageId: {
  1680. target: 'ScheduledMessage',
  1681. required: false,
  1682. relation: 'scheduledMessage',
  1683. },
  1684. },
  1685. ownerPaths: [],
  1686. },
  1687. Webhook: {
  1688. organizationId: true,
  1689. foreignKeys: {
  1690. organizationId: {
  1691. target: 'Organization',
  1692. required: true,
  1693. relation: 'organization',
  1694. },
  1695. },
  1696. ownerPaths: [],
  1697. },
  1698. WebhookDelivery: {
  1699. organizationId: false,
  1700. foreignKeys: {
  1701. webhookId: {
  1702. target: 'Webhook',
  1703. required: true,
  1704. relation: 'webhook',
  1705. },
  1706. },
  1707. ownerPaths: [['webhook']],
  1708. },
  1709. }