@talkpilot/core-db 1.1.3 → 1.1.5

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.
Files changed (329) hide show
  1. package/dist/connection.d.ts +1 -1
  2. package/dist/connection.d.ts.map +1 -1
  3. package/dist/connection.js +21 -24
  4. package/dist/connection.js.map +1 -1
  5. package/dist/index.d.ts +9 -9
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/municipal/cities/cities.getters.d.ts +2 -2
  9. package/dist/municipal/cities/cities.getters.d.ts.map +1 -1
  10. package/dist/municipal/cities/cities.getters.js +8 -4
  11. package/dist/municipal/cities/cities.getters.js.map +1 -1
  12. package/dist/municipal/cities/cities.types.d.ts +1 -1
  13. package/dist/municipal/cities/index.d.ts +2 -2
  14. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts +3 -3
  15. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts.map +1 -1
  16. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js +30 -22
  17. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js.map +1 -1
  18. package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts +4 -4
  19. package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts.map +1 -1
  20. package/dist/municipal/departmentsSubjects/index.d.ts +2 -2
  21. package/dist/municipal/index.d.ts +8 -8
  22. package/dist/municipal/index.d.ts.map +1 -1
  23. package/dist/municipal/index.js +1 -1
  24. package/dist/municipal/mongodb-client.d.ts +1 -1
  25. package/dist/municipal/mongodb-client.d.ts.map +1 -1
  26. package/dist/municipal/mongodb-client.js +13 -25
  27. package/dist/municipal/mongodb-client.js.map +1 -1
  28. package/dist/municipal/streets/index.d.ts +2 -2
  29. package/dist/municipal/streets/streets.getters.d.ts +3 -3
  30. package/dist/municipal/streets/streets.getters.d.ts.map +1 -1
  31. package/dist/municipal/streets/streets.getters.js +19 -9
  32. package/dist/municipal/streets/streets.getters.js.map +1 -1
  33. package/dist/municipal/streets/streets.types.d.ts +1 -1
  34. package/dist/municipal/systemInstructions/index.d.ts +3 -3
  35. package/dist/municipal/systemInstructions/index.d.ts.map +1 -1
  36. package/dist/municipal/systemInstructions/instructions.getters.d.ts +3 -3
  37. package/dist/municipal/systemInstructions/instructions.getters.d.ts.map +1 -1
  38. package/dist/municipal/systemInstructions/instructions.getters.js +10 -4
  39. package/dist/municipal/systemInstructions/instructions.getters.js.map +1 -1
  40. package/dist/municipal/systemInstructions/instructions.setters.d.ts +2 -2
  41. package/dist/municipal/systemInstructions/instructions.setters.d.ts.map +1 -1
  42. package/dist/municipal/systemInstructions/instructions.setters.js +13 -8
  43. package/dist/municipal/systemInstructions/instructions.setters.js.map +1 -1
  44. package/dist/municipal/systemInstructions/instructions.types.d.ts +3 -3
  45. package/dist/municipal/systemInstructions/instructions.types.d.ts.map +1 -1
  46. package/dist/municipal/systemInstructions/instructions.types.js +6 -6
  47. package/dist/municipal/tickets/index.d.ts +2 -2
  48. package/dist/municipal/tickets/tickets.getters.d.ts +3 -3
  49. package/dist/municipal/tickets/tickets.getters.d.ts.map +1 -1
  50. package/dist/municipal/tickets/tickets.getters.js +50 -29
  51. package/dist/municipal/tickets/tickets.getters.js.map +1 -1
  52. package/dist/municipal/tickets/tickets.types.d.ts +1 -1
  53. package/dist/municipal/tickets/tickets.types.d.ts.map +1 -1
  54. package/dist/municipal/utils/types.d.ts +1 -1
  55. package/dist/municipal/utils/types.d.ts.map +1 -1
  56. package/dist/talkpilot/agents/agents.getters.d.ts +1 -1
  57. package/dist/talkpilot/agents/agents.getters.js +2 -2
  58. package/dist/talkpilot/agents/agents.types.d.ts +2 -2
  59. package/dist/talkpilot/agents/index.d.ts +2 -2
  60. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts +2 -2
  61. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts.map +1 -1
  62. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js +1 -1
  63. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js.map +1 -1
  64. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.types.d.ts +2 -2
  65. package/dist/talkpilot/backgroundToolResults/index.d.ts +2 -2
  66. package/dist/talkpilot/calls/calls.getters.d.ts +3 -3
  67. package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -1
  68. package/dist/talkpilot/calls/calls.getters.js +19 -15
  69. package/dist/talkpilot/calls/calls.getters.js.map +1 -1
  70. package/dist/talkpilot/calls/calls.types.d.ts +3 -3
  71. package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
  72. package/dist/talkpilot/calls/calls.types.js +2 -2
  73. package/dist/talkpilot/calls/index.d.ts +2 -2
  74. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts +2 -2
  75. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts.map +1 -1
  76. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js +2 -2
  77. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js.map +1 -1
  78. package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.d.ts +2 -2
  79. package/dist/talkpilot/clientAudioBuffers/index.d.ts +2 -2
  80. package/dist/talkpilot/clients/clients.getters.d.ts +2 -2
  81. package/dist/talkpilot/clients/clients.getters.d.ts.map +1 -1
  82. package/dist/talkpilot/clients/clients.getters.js +5 -2
  83. package/dist/talkpilot/clients/clients.getters.js.map +1 -1
  84. package/dist/talkpilot/clients/clients.types.d.ts +1 -1
  85. package/dist/talkpilot/clients/index.d.ts +2 -2
  86. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +2 -2
  87. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
  88. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +1 -1
  89. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
  90. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +9 -2
  91. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
  92. package/dist/talkpilot/clientsConfig/index.d.ts +2 -2
  93. package/dist/talkpilot/flows/flows.getter.d.ts +2 -2
  94. package/dist/talkpilot/flows/flows.getter.d.ts.map +1 -1
  95. package/dist/talkpilot/flows/flows.getter.js +1 -1
  96. package/dist/talkpilot/flows/flows.getter.js.map +1 -1
  97. package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
  98. package/dist/talkpilot/flows/flows.schema.js +87 -79
  99. package/dist/talkpilot/flows/flows.schema.js.map +1 -1
  100. package/dist/talkpilot/flows/flows.types.d.ts +16 -16
  101. package/dist/talkpilot/flows/index.d.ts +2 -2
  102. package/dist/talkpilot/groups/groups.getters.d.ts +2 -2
  103. package/dist/talkpilot/groups/groups.getters.d.ts.map +1 -1
  104. package/dist/talkpilot/groups/groups.getters.js +2 -2
  105. package/dist/talkpilot/groups/groups.getters.js.map +1 -1
  106. package/dist/talkpilot/groups/groups.types.d.ts +1 -1
  107. package/dist/talkpilot/groups/index.d.ts +3 -3
  108. package/dist/talkpilot/groups/phone.utils.d.ts +1 -1
  109. package/dist/talkpilot/groups/phone.utils.d.ts.map +1 -1
  110. package/dist/talkpilot/groups/phone.utils.js +2 -2
  111. package/dist/talkpilot/groups/phone.utils.js.map +1 -1
  112. package/dist/talkpilot/index.d.ts +16 -16
  113. package/dist/talkpilot/index.js +1 -1
  114. package/dist/talkpilot/leads/index.d.ts +2 -2
  115. package/dist/talkpilot/leads/leads.getter.d.ts +2 -2
  116. package/dist/talkpilot/leads/leads.getter.d.ts.map +1 -1
  117. package/dist/talkpilot/leads/leads.getter.js +1 -1
  118. package/dist/talkpilot/leads/leads.getter.js.map +1 -1
  119. package/dist/talkpilot/leads/leads.schema.js +16 -16
  120. package/dist/talkpilot/leads/leads.types.d.ts +1 -1
  121. package/dist/talkpilot/mongodb-client.d.ts +1 -1
  122. package/dist/talkpilot/mongodb-client.d.ts.map +1 -1
  123. package/dist/talkpilot/mongodb-client.js +16 -29
  124. package/dist/talkpilot/mongodb-client.js.map +1 -1
  125. package/dist/talkpilot/phone_numbers/index.d.ts +2 -2
  126. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +3 -3
  127. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
  128. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +28 -13
  129. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
  130. package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +9 -9
  131. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +1 -1
  132. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts.map +1 -1
  133. package/dist/talkpilot/plans/index.d.ts +2 -2
  134. package/dist/talkpilot/plans/plans.getters.d.ts +2 -2
  135. package/dist/talkpilot/plans/plans.getters.d.ts.map +1 -1
  136. package/dist/talkpilot/plans/plans.getters.js +3 -3
  137. package/dist/talkpilot/plans/plans.getters.js.map +1 -1
  138. package/dist/talkpilot/plans/plans.types.d.ts +4 -4
  139. package/dist/talkpilot/plans/plans.types.d.ts.map +1 -1
  140. package/dist/talkpilot/plans/plans.types.js +19 -19
  141. package/dist/talkpilot/results/index.d.ts +2 -2
  142. package/dist/talkpilot/results/index.d.ts.map +1 -1
  143. package/dist/talkpilot/results/index.js.map +1 -1
  144. package/dist/talkpilot/results/results.getter.d.ts +3 -3
  145. package/dist/talkpilot/results/results.getter.d.ts.map +1 -1
  146. package/dist/talkpilot/results/results.getter.js +4 -4
  147. package/dist/talkpilot/results/results.getter.js.map +1 -1
  148. package/dist/talkpilot/results/results.schema.js +18 -18
  149. package/dist/talkpilot/results/results.types.d.ts +1 -1
  150. package/dist/talkpilot/sessions/index.d.ts +2 -2
  151. package/dist/talkpilot/sessions/sessions.getter.d.ts +3 -3
  152. package/dist/talkpilot/sessions/sessions.getter.d.ts.map +1 -1
  153. package/dist/talkpilot/sessions/sessions.getter.js +13 -10
  154. package/dist/talkpilot/sessions/sessions.getter.js.map +1 -1
  155. package/dist/talkpilot/sessions/sessions.schema.js +17 -17
  156. package/dist/talkpilot/sessions/sessions.types.d.ts +2 -2
  157. package/dist/talkpilot/subscriptions/index.d.ts +3 -3
  158. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts +2 -2
  159. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts.map +1 -1
  160. package/dist/talkpilot/subscriptions/subscriptions.getters.js +11 -11
  161. package/dist/talkpilot/subscriptions/subscriptions.getters.js.map +1 -1
  162. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts +2 -2
  163. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts.map +1 -1
  164. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.js.map +1 -1
  165. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts +2 -2
  166. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts.map +1 -1
  167. package/dist/talkpilot/subscriptions/subscriptions.types.js +7 -7
  168. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts +4 -0
  169. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts.map +1 -0
  170. package/dist/talkpilot/subscriptions/subscriptions.utils.js +20 -0
  171. package/dist/talkpilot/subscriptions/subscriptions.utils.js.map +1 -0
  172. package/dist/talkpilot/utils/query.utils.d.ts +1 -1
  173. package/dist/test-utils/db-utils.d.ts +1 -1
  174. package/dist/test-utils/db-utils.js +2 -2
  175. package/dist/test-utils/factories/index.d.ts +12 -12
  176. package/dist/test-utils/factories/municipal/cities.d.ts +2 -2
  177. package/dist/test-utils/factories/municipal/cities.d.ts.map +1 -1
  178. package/dist/test-utils/factories/municipal/cities.js +1 -1
  179. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts +2 -2
  180. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts.map +1 -1
  181. package/dist/test-utils/factories/municipal/departmentsSubjects.js +7 -1
  182. package/dist/test-utils/factories/municipal/departmentsSubjects.js.map +1 -1
  183. package/dist/test-utils/factories/municipal/streets.d.ts +2 -2
  184. package/dist/test-utils/factories/municipal/streets.d.ts.map +1 -1
  185. package/dist/test-utils/factories/municipal/streets.js +6 -1
  186. package/dist/test-utils/factories/municipal/streets.js.map +1 -1
  187. package/dist/test-utils/factories/municipal/tickets.d.ts +2 -2
  188. package/dist/test-utils/factories/municipal/tickets.d.ts.map +1 -1
  189. package/dist/test-utils/factories/municipal/tickets.js +7 -1
  190. package/dist/test-utils/factories/municipal/tickets.js.map +1 -1
  191. package/dist/test-utils/factories/talkpilot/agents.d.ts +2 -2
  192. package/dist/test-utils/factories/talkpilot/agents.d.ts.map +1 -1
  193. package/dist/test-utils/factories/talkpilot/agents.js +4 -4
  194. package/dist/test-utils/factories/talkpilot/calls.d.ts +2 -2
  195. package/dist/test-utils/factories/talkpilot/calls.d.ts.map +1 -1
  196. package/dist/test-utils/factories/talkpilot/calls.js +1 -1
  197. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts +2 -2
  198. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts.map +1 -1
  199. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js +1 -1
  200. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js.map +1 -1
  201. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts +2 -2
  202. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts.map +1 -1
  203. package/dist/test-utils/factories/talkpilot/clientsConfig.js.map +1 -1
  204. package/dist/test-utils/factories/talkpilot/flows.d.ts +3 -3
  205. package/dist/test-utils/factories/talkpilot/flows.d.ts.map +1 -1
  206. package/dist/test-utils/factories/talkpilot/flows.js.map +1 -1
  207. package/dist/test-utils/factories/talkpilot/groups.d.ts +2 -2
  208. package/dist/test-utils/factories/talkpilot/groups.d.ts.map +1 -1
  209. package/dist/test-utils/factories/talkpilot/groups.js +9 -9
  210. package/dist/test-utils/factories/talkpilot/groups.js.map +1 -1
  211. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts +3 -3
  212. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts.map +1 -1
  213. package/dist/test-utils/factories/talkpilot/phone_numbers.js.map +1 -1
  214. package/dist/test-utils/factories/talkpilot/sessions.d.ts +2 -2
  215. package/dist/test-utils/factories/talkpilot/sessions.d.ts.map +1 -1
  216. package/dist/test-utils/factories/talkpilot/sessions.js +1 -1
  217. package/dist/utils/validation.js +2 -2
  218. package/dist/utils/validation.js.map +1 -1
  219. package/package.json +3 -1
  220. package/src/__tests__/setup.ts +3 -3
  221. package/src/connection.ts +27 -25
  222. package/src/index.ts +9 -9
  223. package/src/municipal/__tests__/validation.spec.ts +35 -23
  224. package/src/municipal/cities/cities.getters.ts +16 -10
  225. package/src/municipal/cities/cities.types.ts +1 -1
  226. package/src/municipal/cities/index.ts +2 -2
  227. package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +53 -44
  228. package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +5 -5
  229. package/src/municipal/departmentsSubjects/index.ts +2 -3
  230. package/src/municipal/index.ts +10 -10
  231. package/src/municipal/mongodb-client.ts +19 -26
  232. package/src/municipal/streets/index.ts +2 -2
  233. package/src/municipal/streets/streets.getters.ts +43 -23
  234. package/src/municipal/streets/streets.types.ts +1 -1
  235. package/src/municipal/systemInstructions/__tests__/getters.spec.ts +67 -52
  236. package/src/municipal/systemInstructions/__tests__/setters.spec.ts +271 -238
  237. package/src/municipal/systemInstructions/index.ts +7 -3
  238. package/src/municipal/systemInstructions/instructions.getters.ts +30 -18
  239. package/src/municipal/systemInstructions/instructions.setters.ts +43 -19
  240. package/src/municipal/systemInstructions/instructions.types.ts +10 -10
  241. package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +12 -12
  242. package/src/municipal/tickets/index.ts +2 -2
  243. package/src/municipal/tickets/tickets.getters.ts +69 -42
  244. package/src/municipal/tickets/tickets.types.ts +2 -2
  245. package/src/municipal/utils/types.ts +8 -3
  246. package/src/talkpilot/__tests__/db.spec.ts +12 -12
  247. package/src/talkpilot/__tests__/mongodb-client.spec.ts +7 -8
  248. package/src/talkpilot/__tests__/validation.spec.ts +30 -24
  249. package/src/talkpilot/agents/__tests__/agents.getters.spec.ts +10 -10
  250. package/src/talkpilot/agents/agents.getters.ts +3 -3
  251. package/src/talkpilot/agents/agents.types.ts +2 -2
  252. package/src/talkpilot/agents/index.ts +2 -2
  253. package/src/talkpilot/backgroundToolResults/__tests__/backgroundToolResults.getters.spec.ts +42 -31
  254. package/src/talkpilot/backgroundToolResults/backgroundToolResults.getters.ts +11 -11
  255. package/src/talkpilot/backgroundToolResults/backgroundToolResults.types.ts +2 -3
  256. package/src/talkpilot/backgroundToolResults/index.ts +2 -2
  257. package/src/talkpilot/calls/__tests__/callStats.utils.spec.ts +27 -27
  258. package/src/talkpilot/calls/__tests__/calls.spec.ts +79 -39
  259. package/src/talkpilot/calls/calls.getters.ts +48 -28
  260. package/src/talkpilot/calls/calls.types.ts +16 -16
  261. package/src/talkpilot/calls/index.ts +2 -2
  262. package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +73 -39
  263. package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +18 -11
  264. package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +2 -2
  265. package/src/talkpilot/clientAudioBuffers/index.ts +2 -2
  266. package/src/talkpilot/clients/clients.getters.ts +10 -5
  267. package/src/talkpilot/clients/clients.types.ts +1 -1
  268. package/src/talkpilot/clients/index.ts +2 -2
  269. package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +21 -18
  270. package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +6 -4
  271. package/src/talkpilot/clientsConfig/clientsConfig.types.ts +17 -7
  272. package/src/talkpilot/clientsConfig/index.ts +2 -2
  273. package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +38 -34
  274. package/src/talkpilot/flows/flows.getter.ts +8 -5
  275. package/src/talkpilot/flows/flows.schema.ts +87 -79
  276. package/src/talkpilot/flows/flows.types.ts +23 -23
  277. package/src/talkpilot/flows/index.ts +2 -2
  278. package/src/talkpilot/groups/__tests__/groups.spec.ts +34 -27
  279. package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +20 -20
  280. package/src/talkpilot/groups/groups.getters.ts +8 -5
  281. package/src/talkpilot/groups/groups.types.ts +1 -1
  282. package/src/talkpilot/groups/index.ts +3 -3
  283. package/src/talkpilot/groups/phone.utils.ts +12 -6
  284. package/src/talkpilot/index.ts +17 -17
  285. package/src/talkpilot/leads/index.ts +2 -2
  286. package/src/talkpilot/leads/leads.getter.ts +5 -4
  287. package/src/talkpilot/leads/leads.schema.ts +16 -16
  288. package/src/talkpilot/leads/leads.types.ts +1 -1
  289. package/src/talkpilot/mongodb-client.ts +23 -33
  290. package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +84 -44
  291. package/src/talkpilot/phone_numbers/index.ts +2 -2
  292. package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +44 -22
  293. package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +9 -9
  294. package/src/talkpilot/phone_numbers/phone_numbers.types.ts +1 -1
  295. package/src/talkpilot/plans/__tests__/plans.spec.ts +30 -26
  296. package/src/talkpilot/plans/index.ts +2 -2
  297. package/src/talkpilot/plans/plans.getters.ts +25 -18
  298. package/src/talkpilot/plans/plans.types.ts +27 -23
  299. package/src/talkpilot/results/index.ts +5 -2
  300. package/src/talkpilot/results/results.getter.ts +9 -8
  301. package/src/talkpilot/results/results.schema.ts +18 -18
  302. package/src/talkpilot/results/results.types.ts +1 -1
  303. package/src/talkpilot/sessions/__tests__/sessions.spec.ts +65 -41
  304. package/src/talkpilot/sessions/index.ts +2 -2
  305. package/src/talkpilot/sessions/sessions.getter.ts +21 -16
  306. package/src/talkpilot/sessions/sessions.schema.ts +17 -17
  307. package/src/talkpilot/sessions/sessions.types.ts +2 -2
  308. package/src/talkpilot/subscriptions/__tests__/subscriptions.getters.utils.spec.ts +18 -15
  309. package/src/talkpilot/subscriptions/index.ts +3 -3
  310. package/src/talkpilot/subscriptions/subscriptions.getters.ts +36 -33
  311. package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +10 -3
  312. package/src/talkpilot/subscriptions/subscriptions.types.ts +9 -9
  313. package/src/talkpilot/utils/__tests__/query.utils.spec.ts +8 -8
  314. package/src/talkpilot/utils/query.utils.ts +2 -2
  315. package/src/test-utils/db-utils.ts +5 -5
  316. package/src/test-utils/factories/index.ts +12 -12
  317. package/src/test-utils/factories/municipal/cities.ts +5 -5
  318. package/src/test-utils/factories/municipal/departmentsSubjects.ts +32 -25
  319. package/src/test-utils/factories/municipal/streets.ts +10 -5
  320. package/src/test-utils/factories/municipal/tickets.ts +12 -6
  321. package/src/test-utils/factories/talkpilot/agents.ts +8 -8
  322. package/src/test-utils/factories/talkpilot/calls.ts +5 -5
  323. package/src/test-utils/factories/talkpilot/clientAudioBuffers.ts +14 -12
  324. package/src/test-utils/factories/talkpilot/clientsConfig.ts +7 -8
  325. package/src/test-utils/factories/talkpilot/flows.ts +7 -5
  326. package/src/test-utils/factories/talkpilot/groups.ts +13 -13
  327. package/src/test-utils/factories/talkpilot/phone_numbers.ts +8 -6
  328. package/src/test-utils/factories/talkpilot/sessions.ts +5 -5
  329. package/src/utils/validation.ts +4 -4
@@ -1,10 +1,11 @@
1
- import { getDb, DepartmentSubject, CityName } from '../index';
2
- import { Collection, Filter } from 'mongodb';
3
- import { VectorSearchResult } from './departmentsSubjects.types';
1
+ import { CityName, DepartmentSubject, getDb } from "../index";
2
+ import { Collection, Filter } from "mongodb";
3
+ import { VectorSearchResult } from "./departmentsSubjects.types";
4
4
 
5
- export const getDepartmentsSubjectsCollection = (): Collection<DepartmentSubject> => {
6
- return getDb().collection<DepartmentSubject>('departmentsSubjects');
7
- };
5
+ export const getDepartmentsSubjectsCollection =
6
+ (): Collection<DepartmentSubject> => {
7
+ return getDb().collection<DepartmentSubject>("departmentsSubjects");
8
+ };
8
9
 
9
10
  /**
10
11
  * Get all departments subjects for a given city.
@@ -16,7 +17,7 @@ export const getDepartmentsSubjectsCollection = (): Collection<DepartmentSubject
16
17
  */
17
18
  export const getAllDepartmentsSubjectsByCity = async (
18
19
  cityName: CityName,
19
- withEmbeddings: boolean = false
20
+ withEmbeddings: boolean = false,
20
21
  ): Promise<DepartmentSubject[]> => {
21
22
  const collection = getDepartmentsSubjectsCollection();
22
23
  const query = collection.find({ cityName });
@@ -42,17 +43,17 @@ export const vectorSearchDepartmentsSubjects = async (
42
43
  queryVector: number[],
43
44
  cityName: CityName,
44
45
  limit: number = 5,
45
- numCandidates: number = 800
46
+ numCandidates: number = 800,
46
47
  ): Promise<VectorSearchResult[]> => {
47
48
  const collection = getDepartmentsSubjectsCollection();
48
- const indexName = 'subjectTreesIndex';
49
+ const indexName = "subjectTreesIndex";
49
50
 
50
- const results = await collection
51
+ return await collection
51
52
  .aggregate<VectorSearchResult>([
52
53
  {
53
54
  $vectorSearch: {
54
55
  index: indexName,
55
- path: 'embedding',
56
+ path: "embedding",
56
57
  queryVector,
57
58
  numCandidates,
58
59
  limit,
@@ -63,23 +64,21 @@ export const vectorSearchDepartmentsSubjects = async (
63
64
  $project: {
64
65
  _id: 0,
65
66
  subjectName: 1,
66
- subject_id: { $toInt: '$subject_id' }, // Convert string to number
67
+ subject_id: { $toInt: "$subject_id" }, // Convert string to number
67
68
  sub_subject_name: 1,
68
69
  sub_subject_id: 1,
69
70
  descriptions: 1,
70
71
  guidelines: 1,
71
- score: { $meta: 'vectorSearchScore' },
72
+ score: { $meta: "vectorSearchScore" },
72
73
  },
73
74
  },
74
75
  ])
75
76
  .toArray();
76
-
77
- return results;
78
77
  };
79
78
 
80
79
  export const addDepartmentSubjectInstruction = async (
81
80
  filter: Filter<DepartmentSubject>,
82
- instructionText: string
81
+ instructionText: string,
83
82
  ): Promise<DepartmentSubject | null> => {
84
83
  const newInstruction = {
85
84
  id: Date.now(),
@@ -92,7 +91,7 @@ export const addDepartmentSubjectInstruction = async (
92
91
  $push: { instructions: newInstruction },
93
92
  $set: { updatedAt: new Date() },
94
93
  },
95
- { returnDocument: 'after' }
94
+ { returnDocument: "after" },
96
95
  );
97
96
 
98
97
  return result || null;
@@ -101,12 +100,17 @@ export const addDepartmentSubjectInstruction = async (
101
100
  export const updateDepartmentSubjectInstruction = async (
102
101
  filter: Filter<DepartmentSubject>,
103
102
  instructionId: number,
104
- newInstructionText: string
103
+ newInstructionText: string,
105
104
  ): Promise<DepartmentSubject | null> => {
106
105
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
107
- { ...filter, 'instructions.id': instructionId },
108
- { $set: { 'instructions.$.instruction': newInstructionText, updatedAt: new Date() } },
109
- { returnDocument: 'after' }
106
+ { ...filter, "instructions.id": instructionId },
107
+ {
108
+ $set: {
109
+ "instructions.$.instruction": newInstructionText,
110
+ updatedAt: new Date(),
111
+ },
112
+ },
113
+ { returnDocument: "after" },
110
114
  );
111
115
 
112
116
  return result || null;
@@ -114,7 +118,7 @@ export const updateDepartmentSubjectInstruction = async (
114
118
 
115
119
  export const removeDepartmentSubjectInstruction = async (
116
120
  filter: Filter<DepartmentSubject>,
117
- instructionId: number
121
+ instructionId: number,
118
122
  ): Promise<DepartmentSubject | null> => {
119
123
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
120
124
  filter,
@@ -122,7 +126,7 @@ export const removeDepartmentSubjectInstruction = async (
122
126
  $pull: { instructions: { id: instructionId } },
123
127
  $set: { updatedAt: new Date() },
124
128
  },
125
- { returnDocument: 'after' }
129
+ { returnDocument: "after" },
126
130
  );
127
131
 
128
132
  return result || null;
@@ -131,18 +135,22 @@ export const removeDepartmentSubjectInstruction = async (
131
135
  export const addDepartmentSubjectCommunication = async (
132
136
  filter: Filter<DepartmentSubject>,
133
137
  communication: {
134
- type: 'free_text_sms' | 'upload_url_sms';
138
+ type: "free_text_sms" | "upload_url_sms";
135
139
  message_text?: string;
136
140
  template_id?: string;
137
141
  to?: string;
138
- }
142
+ },
139
143
  ): Promise<DepartmentSubject | null> => {
140
144
  const newCommunication = {
141
145
  id: Date.now(),
142
146
  type: communication.type,
143
- ...(communication.message_text !== undefined && { message_text: communication.message_text }),
147
+ ...(communication.message_text !== undefined && {
148
+ message_text: communication.message_text,
149
+ }),
144
150
  is_deleted: false,
145
- ...(communication.template_id !== undefined && { template_id: communication.template_id }),
151
+ ...(communication.template_id !== undefined && {
152
+ template_id: communication.template_id,
153
+ }),
146
154
  ...(communication.to !== undefined && { to: communication.to }),
147
155
  };
148
156
 
@@ -152,7 +160,7 @@ export const addDepartmentSubjectCommunication = async (
152
160
  $push: { communications: newCommunication },
153
161
  $set: { updatedAt: new Date() },
154
162
  },
155
- { returnDocument: 'after' }
163
+ { returnDocument: "after" },
156
164
  );
157
165
 
158
166
  return result || null;
@@ -162,27 +170,28 @@ export const updateDepartmentSubjectCommunication = async (
162
170
  filter: Filter<DepartmentSubject>,
163
171
  communicationId: number,
164
172
  updates: {
165
- type?: 'free_text_sms' | 'upload_url_sms';
173
+ type?: "free_text_sms" | "upload_url_sms";
166
174
  message_text?: string | null;
167
175
  template_id?: string | null;
168
176
  to?: string | null;
169
177
  is_deleted?: boolean | null;
170
- }
178
+ },
171
179
  ): Promise<DepartmentSubject | null> => {
172
180
  const setFields: Record<string, unknown> = { updatedAt: new Date() };
173
- if (updates.type !== undefined) setFields['communications.$.type'] = updates.type;
181
+ if (updates.type !== undefined)
182
+ setFields["communications.$.type"] = updates.type;
174
183
  if (updates.message_text !== undefined)
175
- setFields['communications.$.message_text'] = updates.message_text;
184
+ setFields["communications.$.message_text"] = updates.message_text;
176
185
  if (updates.template_id !== undefined)
177
- setFields['communications.$.template_id'] = updates.template_id;
178
- if (updates.to !== undefined) setFields['communications.$.to'] = updates.to;
186
+ setFields["communications.$.template_id"] = updates.template_id;
187
+ if (updates.to !== undefined) setFields["communications.$.to"] = updates.to;
179
188
  if (updates.is_deleted !== undefined)
180
- setFields['communications.$.is_deleted'] = updates.is_deleted;
189
+ setFields["communications.$.is_deleted"] = updates.is_deleted;
181
190
 
182
191
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
183
- { ...filter, 'communications.id': communicationId },
192
+ { ...filter, "communications.id": communicationId },
184
193
  { $set: setFields },
185
- { returnDocument: 'after' }
194
+ { returnDocument: "after" },
186
195
  );
187
196
 
188
197
  return result || null;
@@ -190,7 +199,7 @@ export const updateDepartmentSubjectCommunication = async (
190
199
 
191
200
  export const removeDepartmentSubjectCommunication = async (
192
201
  filter: Filter<DepartmentSubject>,
193
- communicationId: number
202
+ communicationId: number,
194
203
  ): Promise<DepartmentSubject | null> => {
195
204
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
196
205
  filter,
@@ -198,7 +207,7 @@ export const removeDepartmentSubjectCommunication = async (
198
207
  $pull: { communications: { id: communicationId } },
199
208
  $set: { updatedAt: new Date() },
200
209
  },
201
- { returnDocument: 'after' }
210
+ { returnDocument: "after" },
202
211
  );
203
212
 
204
213
  return result || null;
@@ -214,7 +223,7 @@ export const removeDepartmentSubjectCommunication = async (
214
223
  export const getDepartmentSubjectBySubjectIds = async (
215
224
  subjectId: string,
216
225
  subSubjectId: string,
217
- cityName: CityName
226
+ cityName: CityName,
218
227
  ): Promise<DepartmentSubject | null> => {
219
228
  const collection = getDepartmentsSubjectsCollection();
220
229
 
@@ -240,13 +249,13 @@ export const getDepartmentSubjectBySubjectIds = async (
240
249
  */
241
250
  export const updateDepartmentSubjectGuidelines = async (
242
251
  filter: Filter<DepartmentSubject>,
243
- guidelines: string
252
+ guidelines: string,
244
253
  ): Promise<DepartmentSubject | null> => {
245
254
  // $set will create the field if it doesn't exist
246
255
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
247
256
  filter,
248
257
  { $set: { guidelines, updatedAt: new Date() } },
249
- { returnDocument: 'after' }
258
+ { returnDocument: "after" },
250
259
  );
251
260
  return result || null;
252
261
  };
@@ -257,13 +266,13 @@ export const updateDepartmentSubjectGuidelines = async (
257
266
  * @returns Updated DepartmentSubject document or null if not found
258
267
  */
259
268
  export const deleteDepartmentSubjectGuidelines = async (
260
- filter: Filter<DepartmentSubject>
269
+ filter: Filter<DepartmentSubject>,
261
270
  ): Promise<DepartmentSubject | null> => {
262
271
  // $set clears the field by setting it to null (keeps the field in the document)
263
272
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
264
273
  filter,
265
274
  { $set: { guidelines: null, updatedAt: new Date() } },
266
- { returnDocument: 'after' }
275
+ { returnDocument: "after" },
267
276
  );
268
277
  return result || null;
269
278
  };
@@ -1,7 +1,7 @@
1
- import {ObjectId, WithId} from 'mongodb';
2
- import {Request} from 'express';
3
- import {ClientConfigDoc, Products} from '../../talkpilot/clientsConfig/clientsConfig.types';
4
- import {CityName} from "../utils/types";
1
+ import { ObjectId, WithId } from "mongodb";
2
+ import { Request } from "express";
3
+ import { ClientConfigDoc, Products } from "../../talkpilot";
4
+ import { CityName } from "../utils/types";
5
5
 
6
6
  export type DepartmentSubject = {
7
7
  _id: ObjectId;
@@ -57,7 +57,7 @@ export type VectorSearchResult = {
57
57
  score?: number;
58
58
  };
59
59
 
60
- export type CommunicationType = 'free_text_sms' | 'upload_url_sms';
60
+ export type CommunicationType = "free_text_sms" | "upload_url_sms";
61
61
 
62
62
  /**
63
63
  * Extended Express Request type with client configuration
@@ -1,4 +1,4 @@
1
- export * from './departmentsSubjects.getters';
1
+ export * from "./departmentsSubjects.getters";
2
2
  export type {
3
3
  DepartmentSubject,
4
4
  DepartmentSubjectDoc,
@@ -6,5 +6,4 @@ export type {
6
6
  RequestWithClientConfig,
7
7
  Communication,
8
8
  Instruction,
9
- } from './departmentsSubjects.types';
10
-
9
+ } from "./departmentsSubjects.types";
@@ -1,13 +1,13 @@
1
- import { Db, ObjectId as MongoObjectId } from 'mongodb';
1
+ import { Db, ObjectId as MongoObjectId } from "mongodb";
2
2
 
3
- export * from './cities';
4
- export * from './streets';
5
- export * from './departmentsSubjects';
6
- export * from './tickets';
7
- export * from './systemInstructions';
8
- export * from './utils/types';
9
- export {CityName} from "./utils/types";
10
- export { municipalDataMongodbClient } from './mongodb-client';
3
+ export * from "./cities";
4
+ export * from "./streets";
5
+ export * from "./departmentsSubjects";
6
+ export * from "./tickets";
7
+ export * from "./systemInstructions";
8
+ export * from "./utils/types";
9
+ export { CityName } from "./utils/types";
10
+ export { municipalDataMongodbClient } from "./mongodb-client";
11
11
 
12
12
  let db: Db;
13
13
  export const setDb = (d: Db) => {
@@ -15,7 +15,7 @@ export const setDb = (d: Db) => {
15
15
  };
16
16
 
17
17
  export const getDb = (): Db => {
18
- if (!db) throw new Error('Municipal Data DB not initialised');
18
+ if (!db) throw new Error("Municipal Data DB not initialised");
19
19
  return db;
20
20
  };
21
21
  export const ObjectId = MongoObjectId;
@@ -1,11 +1,11 @@
1
- import { MongoClient, Db } from 'mongodb';
2
- import { setDb } from './index';
3
- import { validateConfig, validateMongoUri } from '../utils/validation';
1
+ import { MongoClient, Db } from "mongodb";
2
+ import { setDb } from "./index";
3
+ import { validateConfig, validateMongoUri } from "../utils/validation";
4
4
 
5
5
  class MunicipalDataMongoDBClient {
6
6
  private client: MongoClient | null = null;
7
7
  private db: Db | null = null;
8
- private readonly defaultDbName = 'municipal-data';
8
+ private readonly defaultDbName = "municipal-data";
9
9
 
10
10
  async connect(uri?: string, dbName?: string): Promise<void> {
11
11
  if (this.client) {
@@ -13,39 +13,32 @@ class MunicipalDataMongoDBClient {
13
13
  }
14
14
 
15
15
  const mongodbUri = uri || process.env.MONGO_URI || process.env.MONGODB_URI;
16
- validateConfig('MONGO_URI', mongodbUri);
16
+ validateConfig("MONGO_URI", mongodbUri);
17
17
  validateMongoUri(mongodbUri!);
18
18
 
19
- try {
20
- this.client = new MongoClient(mongodbUri!);
21
- await this.client.connect();
22
- const targetDbName = dbName || this.defaultDbName;
23
- this.db = this.client.db(targetDbName);
24
- setDb(this.db);
25
- console.info(`[core-db] Municipal MongoDB connected: ${targetDbName}`);
26
- } catch (error) {
27
- console.error('[core-db] Municipal connection failed', error as Error);
28
- throw error;
29
- }
19
+ this.client = new MongoClient(mongodbUri!);
20
+ await this.client.connect();
21
+ const targetDbName =
22
+ dbName || process.env.MUNICIPAL_DB_NAME || this.defaultDbName;
23
+ this.db = this.client.db(targetDbName);
24
+ setDb(this.db);
25
+ console.info(`[core-db] Municipal MongoDB connected: ${targetDbName}`);
30
26
  }
31
27
 
32
28
  async disconnect(): Promise<void> {
33
29
  if (this.client) {
34
- try {
35
- await this.client.close();
36
- this.client = null;
37
- this.db = null;
38
- console.info('Municipal Data MongoDB disconnected successfully');
39
- } catch (error) {
40
- console.error('Error disconnecting from Municipal Data MongoDB', error as Error);
41
- throw error;
42
- }
30
+ await this.client.close();
31
+ this.client = null;
32
+ this.db = null;
33
+ console.info("Municipal Data MongoDB disconnected successfully");
43
34
  }
44
35
  }
45
36
 
46
37
  getDb(): Db {
47
38
  if (!this.db) {
48
- throw new Error('Municipal Data database not initialized. Call connect() first.');
39
+ throw new Error(
40
+ "Municipal Data database not initialized. Call connect() first.",
41
+ );
49
42
  }
50
43
  return this.db;
51
44
  }
@@ -1,2 +1,2 @@
1
- export * from './streets.getters';
2
- export type { Street, StreetDoc, StreetHint } from './streets.types';
1
+ export * from "./streets.getters";
2
+ export type { Street, StreetDoc, StreetHint } from "./streets.types";
@@ -1,25 +1,38 @@
1
- import {CityName, getDb, ObjectId, Street} from '../index';
2
- import type { StreetHint } from './streets.types';
3
- import { Collection, Filter, ObjectId as MongoObjectId } from 'mongodb';
1
+ import { CityName, getDb, ObjectId, Street } from "../index";
2
+ import type { StreetHint } from "./streets.types";
3
+ import { Collection, Filter, ObjectId as MongoObjectId } from "mongodb";
4
4
 
5
5
  export const getStreetsCollection = (): Collection<Street> => {
6
- return getDb().collection<Street>('streets');
6
+ return getDb().collection<Street>("streets");
7
7
  };
8
8
 
9
- export const findStreets = async (filter: Filter<Street> = {}): Promise<Street[]> => {
9
+ export const findStreets = async (
10
+ filter: Filter<Street> = {},
11
+ ): Promise<Street[]> => {
10
12
  return await getStreetsCollection().find(filter).toArray();
11
13
  };
12
14
 
13
- export const getStreetById = async (streetId: string): Promise<Street | null> => {
14
- const street = await getStreetsCollection().findOne({ _id: new ObjectId(streetId) });
15
+ export const getStreetById = async (
16
+ streetId: string,
17
+ ): Promise<Street | null> => {
18
+ const street = await getStreetsCollection().findOne({
19
+ _id: new ObjectId(streetId),
20
+ });
15
21
  return street ? street : null;
16
22
  };
17
23
 
18
- export const getStreetsByCityName = async (cityName: CityName): Promise<Street[]> => {
19
- return await getStreetsCollection().find({ cityName }).sort({ name: 1 }).toArray();
24
+ export const getStreetsByCityName = async (
25
+ cityName: CityName,
26
+ ): Promise<Street[]> => {
27
+ return await getStreetsCollection()
28
+ .find({ cityName })
29
+ .sort({ name: 1 })
30
+ .toArray();
20
31
  };
21
32
 
22
- export const getStreetByStreetId = async (streetId: string): Promise<Street | null> => {
33
+ export const getStreetByStreetId = async (
34
+ streetId: string,
35
+ ): Promise<Street | null> => {
23
36
  const street = await getStreetsCollection().findOne({ id: streetId });
24
37
  return street ? street : null;
25
38
  };
@@ -27,32 +40,37 @@ export const getStreetByStreetId = async (streetId: string): Promise<Street | nu
27
40
  /** Get street by business id and city. Use this when the client's city is known so the same id in another city is not returned. */
28
41
  export const getStreetByStreetIdAndCity = async (
29
42
  streetId: string,
30
- cityName: CityName
43
+ cityName: CityName,
31
44
  ): Promise<Street | null> => {
32
- const street = await getStreetsCollection().findOne({ id: streetId, cityName });
45
+ const street = await getStreetsCollection().findOne({
46
+ id: streetId,
47
+ cityName,
48
+ });
33
49
  return street ? street : null;
34
50
  };
35
51
 
36
52
  export const createStreet = async (
37
- streetData: Omit<Street, '_id' | 'createdAt' | 'updatedAt'>
53
+ streetData: Omit<Street, "_id" | "createdAt" | "updatedAt">,
38
54
  ): Promise<MongoObjectId> => {
39
- const street: Omit<Street, '_id'> = {
55
+ const street: Omit<Street, "_id"> = {
40
56
  ...streetData,
41
57
  createdAt: new Date(),
42
58
  updatedAt: new Date(),
43
59
  };
44
- const { insertedId } = await getStreetsCollection().insertOne(street as Street);
60
+ const { insertedId } = await getStreetsCollection().insertOne(
61
+ street as Street,
62
+ );
45
63
  return insertedId;
46
64
  };
47
65
 
48
66
  export const updateStreet = async (
49
67
  streetId: string,
50
- data: Partial<Omit<Street, '_id' | 'createdAt' | 'updatedAt'>>
68
+ data: Partial<Omit<Street, "_id" | "createdAt" | "updatedAt">>,
51
69
  ): Promise<Street | null> => {
52
70
  const result = await getStreetsCollection().findOneAndUpdate(
53
71
  { _id: new ObjectId(streetId) },
54
72
  { $set: { ...data, updatedAt: new Date() } },
55
- { returnDocument: 'after' }
73
+ { returnDocument: "after" },
56
74
  );
57
75
  return result || null;
58
76
  };
@@ -63,7 +81,7 @@ export const updateStreet = async (
63
81
  */
64
82
  export const upsertStreetHintOnStreet = async (
65
83
  street: Street,
66
- hint: Partial<StreetHint> & Pick<StreetHint, 'text'>
84
+ hint: Partial<StreetHint> & Pick<StreetHint, "text">,
67
85
  ): Promise<Street | null> => {
68
86
  const text = hint.text.trim();
69
87
  if (!text) return null;
@@ -71,7 +89,7 @@ export const upsertStreetHintOnStreet = async (
71
89
  const hints = street.hints || [];
72
90
  let updatedHints: StreetHint[];
73
91
 
74
- if (hint.id != null && hint.id !== '') {
92
+ if (hint.id != null && hint.id !== "") {
75
93
  const hintIndex = hints.findIndex((h) => String(h.id) === String(hint.id));
76
94
  if (hintIndex === -1) return null;
77
95
  updatedHints = [...hints];
@@ -86,20 +104,22 @@ export const upsertStreetHintOnStreet = async (
86
104
  /** Remove a hint from a street. streetId is the street business id (e.g. "703"). Updates document updatedAt. */
87
105
  export const deleteStreetHint = async (
88
106
  streetId: string,
89
- hintId: string
107
+ hintId: string,
90
108
  ): Promise<Street | null> => {
91
109
  const result = await getStreetsCollection().findOneAndUpdate(
92
110
  { id: streetId },
93
111
  { $pull: { hints: { id: hintId } }, $set: { updatedAt: new Date() } },
94
- { returnDocument: 'after' }
112
+ { returnDocument: "after" },
95
113
  );
96
114
  if (result) {
97
- console.info('Street hint deleted', { streetId, hintId });
115
+ console.info("Street hint deleted", { streetId, hintId });
98
116
  }
99
117
  return result || null;
100
118
  };
101
119
 
102
120
  export const deleteStreet = async (streetId: string): Promise<boolean> => {
103
- const result = await getStreetsCollection().deleteOne({ _id: new ObjectId(streetId) });
121
+ const result = await getStreetsCollection().deleteOne({
122
+ _id: new ObjectId(streetId),
123
+ });
104
124
  return result.deletedCount > 0;
105
125
  };
@@ -1,4 +1,4 @@
1
- import { ObjectId, WithId } from 'mongodb';
1
+ import { ObjectId, WithId } from "mongodb";
2
2
 
3
3
  export type StreetHint = {
4
4
  id: string;