auth.prisma 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. model User {
  2. id String @id @default(cuid())
  3. name String
  4. email String @unique
  5. emailVerified Boolean @default(false)
  6. /// The mobile a technician signs in with, and the number a workshop holds
  7. /// for whoever this is.
  8. ///
  9. /// Deliberately not unique. When a desk creates an account for a mechanic
  10. /// standing at the counter, a second workshop may create another for the
  11. /// same human, and neither should be able to block the other. Every lookup
  12. /// reaches it through a technician row and so is already scoped to one
  13. /// workshop; the number alone is never the question being asked.
  14. phone String?
  15. image String?
  16. isSuperAdmin Boolean @default(false)
  17. createdAt DateTime @default(now())
  18. updatedAt DateTime @updatedAt
  19. twoFactorEnabled Boolean @default(false)
  20. termsAcceptedAt DateTime?
  21. lastLogin DateTime?
  22. lastSeen DateTime?
  23. /// App version this user last saw/dismissed the update banner for.
  24. /// Null = never seeded (seeded silently on first load, no banner).
  25. lastSeenVersion String?
  26. /// Per-user dashboard grid layout (card positions/sizes/hidden set).
  27. /// Null = default layout. Shape validated in dashboardLayoutActions.
  28. dashboardLayout Json?
  29. sessions Session[]
  30. accounts Account[]
  31. pushDevices PushDevice[]
  32. appSetupCodes TechnicianSetupCode[]
  33. vehicles Vehicle[]
  34. customers Customer[]
  35. settings AppSetting[]
  36. inventoryParts InventoryPart[]
  37. quotes Quote[]
  38. customFieldDefinitions CustomFieldDefinition[]
  39. twoFactor TwoFactor?
  40. passkeys Passkey[]
  41. organizationMembers OrganizationMember[]
  42. dashboardWidgets DashboardWidget[]
  43. auditLogs AuditLog[]
  44. technicians Technician[]
  45. stockMovements StockMovement[]
  46. tireWarehouses TireWarehouse[]
  47. tireSets TireSet[]
  48. tireSetAttachments TireSetAttachment[]
  49. tireMeasurements TireMeasurement[]
  50. tireMovements TireMovement[]
  51. tireTreatments TireTreatment[]
  52. importBatches ImportBatch[]
  53. @@map("users")
  54. }
  55. model Session {
  56. id String @id @default(cuid())
  57. expiresAt DateTime
  58. token String @unique
  59. createdAt DateTime @default(now())
  60. updatedAt DateTime @updatedAt
  61. ipAddress String?
  62. userAgent String?
  63. userId String
  64. user User @relation(fields: [userId], references: [id], onDelete: Cascade)
  65. @@index([userId])
  66. @@map("sessions")
  67. }
  68. model Account {
  69. id String @id @default(cuid())
  70. accountId String
  71. providerId String
  72. userId String
  73. user User @relation(fields: [userId], references: [id], onDelete: Cascade)
  74. accessToken String?
  75. refreshToken String?
  76. idToken String?
  77. accessTokenExpiresAt DateTime?
  78. refreshTokenExpiresAt DateTime?
  79. scope String?
  80. password String?
  81. createdAt DateTime @default(now())
  82. updatedAt DateTime @updatedAt
  83. @@index([userId])
  84. @@map("accounts")
  85. }
  86. model Verification {
  87. id String @id @default(cuid())
  88. identifier String @unique
  89. value String
  90. expiresAt DateTime
  91. createdAt DateTime? @default(now())
  92. updatedAt DateTime? @updatedAt
  93. @@map("verifications")
  94. }
  95. model TwoFactor {
  96. id String @id @default(cuid())
  97. secret String
  98. backupCodes String
  99. userId String @unique
  100. user User @relation(fields: [userId], references: [id], onDelete: Cascade)
  101. @@map("two_factor")
  102. }
  103. model Passkey {
  104. id String @id @default(cuid())
  105. name String?
  106. publicKey String
  107. userId String
  108. user User @relation(fields: [userId], references: [id], onDelete: Cascade)
  109. credentialID String @unique
  110. counter Int
  111. deviceType String
  112. backedUp Boolean
  113. transports String?
  114. aaguid String?
  115. createdAt DateTime @default(now())
  116. @@index([userId])
  117. @@map("passkeys")
  118. }