Advertisement
Guest User

Untitled

a guest
Dec 14th, 2022
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.66 KB | None | 0 0
  1. generator client {
  2. provider = "prisma-client-js"
  3. previewFeatures = ["fieldReference", "fullTextIndex"]
  4. }
  5.  
  6. datasource db {
  7. provider = "mongodb"
  8. url = env("MONGODB_URI")
  9. }
  10.  
  11. model TagSetting {
  12. id String @id @default(auto()) @map("_id") @db.ObjectId
  13. data String
  14. operator TagSettingsOperator
  15. }
  16.  
  17. enum TagSettingsOperator {
  18. StartsWith
  19. EndsWith
  20. Includes
  21. }
  22.  
  23. model Product {
  24. id String @id @default(auto()) @map("_id") @db.ObjectId
  25. productName String
  26. barcode String @unique
  27. size String
  28. productImage ProductImage
  29. collectionId String @db.ObjectId
  30. collection Collection @relation(fields: [collectionId], references: [id], onDelete: Restrict, onUpdate: Cascade)
  31. tags Tag[]
  32. createdAt DateTime? @default(now())
  33. updatedAt DateTime? @default(now()) @updatedAt
  34. slug String
  35. tagReports TagReport[]
  36. }
  37.  
  38. model Collection {
  39. id String @id @default(auto()) @map("_id") @db.ObjectId
  40. collectionName String @unique
  41. parent Collection? @relation("Categories", fields: [parentId], references: [id], onDelete: NoAction, onUpdate: NoAction)
  42. parentId String? @db.ObjectId
  43. children Collection[] @relation("Categories")
  44. products Product[]
  45. posCollection PosCollection[]
  46. sizes String[]
  47. updatedAt DateTime? @default(now()) @updatedAt
  48. tags Tag[]
  49. tagReports TagReport[]
  50. }
  51.  
  52. model Tag {
  53. id String @id @default(auto()) @map("_id") @db.ObjectId
  54. tagId String @unique
  55. status TagStatus
  56. level Int?
  57. createdAt DateTime? @default(now())
  58. updatedAt DateTime? @default(now()) @updatedAt
  59. tagReports TagReport[]
  60. pos Pos? @relation(fields: [posSerialNumber], references: [serialNumber])
  61. product Product? @relation(fields: [productId], references: [id])
  62. collection Collection? @relation(fields: [collectionId], references: [id])
  63. posCollection PosCollection? @relation(fields: [posCollectionId], references: [id])
  64. productId String? @db.ObjectId
  65. collectionId String? @db.ObjectId
  66. posSerialNumber String?
  67. posCollectionId String? @db.ObjectId
  68. slug String?
  69. }
  70.  
  71. model Pos {
  72. id String @id @default(auto()) @map("_id") @db.ObjectId
  73. posStatus PosStatus @default(CREATED)
  74. serialNumber String @unique
  75. posName String @unique
  76. address Address?
  77. contactPerson ContactPerson?
  78. posBatteryCapacity Int @default(0)
  79. lastScan DateTime @default(now()) @updatedAt
  80. comment String?
  81. updatedAt DateTime? @default(now()) @updatedAt
  82. config PosConfig?
  83. posReports PosReport[]
  84. tagReports TagReport[]
  85. posServices PosService[]
  86. tags Tag[]
  87. logs Log[]
  88. collections PosCollection[]
  89. }
  90.  
  91. model LinkPosQRCode {
  92. id String @id @default(auto()) @map("_id") @db.ObjectId
  93. serialNumber String @unique
  94. createdAt DateTime? @default(now())
  95. updatedAt DateTime? @default(now()) @updatedAt
  96. }
  97.  
  98. model PosCollection {
  99. id String @id @default(auto()) @map("_id") @db.ObjectId
  100. pos Pos @relation(fields: [posId], references: [id], onUpdate: Cascade, onDelete: Cascade)
  101. posId String @db.ObjectId
  102. collection Collection @relation(fields: [collectionId], references: [id])
  103. collectionId String @db.ObjectId
  104. posSerialNumber String
  105. size String
  106. capacity Int
  107. updatedAt DateTime? @default(now()) @updatedAt
  108. tags Tag[]
  109. tagReports TagReport[]
  110. }
  111.  
  112. model PosService {
  113. id String @id @default(auto()) @map("_id") @db.ObjectId
  114. posSerialNumber String
  115. pos Pos @relation(fields: [posSerialNumber], references: [serialNumber], onUpdate: Cascade, onDelete: Cascade)
  116. name String
  117. status PosServiceStatus
  118. comment String?
  119. updatedAt DateTime? @default(now()) @updatedAt
  120. }
  121.  
  122. model PosReport {
  123. id String @id @default(auto()) @map("_id") @db.ObjectId
  124. posSerialNumber String
  125. pos Pos @relation(fields: [posSerialNumber], references: [serialNumber])
  126. posName String?
  127. displayState Int @default(0)
  128. collectionStates Json?
  129. batteryState Int
  130. posStatus PosStatus
  131. tagReports TagReport[]
  132. updatedAt DateTime? @default(now()) @updatedAt
  133. }
  134.  
  135. model TagReport {
  136. id String @id @default(auto()) @map("_id") @db.ObjectId
  137. tagId String
  138. productId String? @db.ObjectId
  139. collectionId String? @db.ObjectId
  140. status TagStatus
  141. tag Tag @relation(fields: [tagId], references: [tagId])
  142. product Product? @relation(fields: [productId], references: [id])
  143. collection Collection? @relation(fields: [collectionId], references: [id])
  144. posReportId String? @db.ObjectId
  145. posSerialNumber String?
  146. posCollectionId String? @db.ObjectId
  147. posReport PosReport? @relation(fields: [posReportId], references: [id])
  148. pos Pos? @relation(fields: [posSerialNumber], references: [serialNumber])
  149. posCollection PosCollection? @relation(fields: [posCollectionId], references: [id])
  150. productName String?
  151. collectionName String?
  152. barcode String?
  153. falsePositive Boolean @default(false)
  154. visible Boolean @default(true)
  155. updatedAt DateTime? @default(now()) @updatedAt
  156. }
  157.  
  158. model Log {
  159. id String @id @default(auto()) @map("_id") @db.ObjectId
  160. bat String?
  161. time String?
  162. cnt String?
  163. all String?
  164. tags LogTag[]
  165. pos Pos? @relation(fields: [serialNumber], references: [serialNumber], onDelete: Cascade)
  166. serialNumber String
  167. updatedAt DateTime? @default(now()) @updatedAt
  168. rest Json?
  169. }
  170.  
  171. type LogTag {
  172. I String?
  173. S String?
  174. }
  175.  
  176. type ContactPerson {
  177. personName String
  178. email String
  179. phoneNumber String
  180. }
  181.  
  182. type PosConfig {
  183. refreshInterval Int @default(14400) //14400 - 4 hours interval in seconds
  184. }
  185.  
  186. type ProductImage {
  187. name String
  188. type String
  189. path String
  190. size Int
  191. }
  192.  
  193. type Address {
  194. formattedAddress String // Full address in one string
  195. country String
  196. city String
  197. state String
  198. county String
  199. postalCode String
  200. streetName String
  201. streetNumber String
  202. coordinates Coordinates
  203. }
  204.  
  205. type Coordinates {
  206. latitude Float
  207. longitude Float
  208. }
  209.  
  210. enum ProductSize {
  211. REGULAR
  212. MEDIUM
  213. LARGE
  214. SMALL
  215. XS
  216. ONE_SIZE
  217. BEANIE_BOOS
  218. MINI_BOOS
  219. SAB
  220. }
  221.  
  222. enum PosStatus {
  223. ONLINE
  224. CONNECTION_LOST
  225. CREATED
  226. }
  227.  
  228. enum PosServiceStatus {
  229. SALE
  230. SALE_ADD
  231. MERCHANDISE
  232. ADDED_PRODUCTS
  233. }
  234.  
  235. enum TagStatus {
  236. IN_TRANSIT
  237. ON_POS
  238. SOLD
  239. DELETED
  240. UNASSIGNED
  241. WRONG_ITEM
  242. }
  243.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement