@stamhoofd/models 2.39.0 → 2.40.0

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 (352) hide show
  1. package/dist/src/factories/AddressFactory.d.ts +3 -4
  2. package/dist/src/factories/AddressFactory.d.ts.map +1 -1
  3. package/dist/src/factories/AddressFactory.js +13 -13
  4. package/dist/src/factories/EmergencyContactFactory.d.ts +3 -4
  5. package/dist/src/factories/EmergencyContactFactory.d.ts.map +1 -1
  6. package/dist/src/factories/EmergencyContactFactory.js +27 -27
  7. package/dist/src/factories/EmergencyContactFactory.js.map +1 -1
  8. package/dist/src/factories/GroupFactory.d.ts +4 -4
  9. package/dist/src/factories/GroupFactory.d.ts.map +1 -1
  10. package/dist/src/factories/GroupFactory.js +8 -8
  11. package/dist/src/factories/GroupFactory.js.map +1 -1
  12. package/dist/src/factories/MemberFactory.d.ts +4 -4
  13. package/dist/src/factories/MemberFactory.d.ts.map +1 -1
  14. package/dist/src/factories/MemberFactory.js +17 -17
  15. package/dist/src/factories/MemberFactory.js.map +1 -1
  16. package/dist/src/factories/OrganizationFactory.d.ts +4 -4
  17. package/dist/src/factories/OrganizationFactory.js +8 -8
  18. package/dist/src/factories/OrganizationFactory.js.map +1 -1
  19. package/dist/src/factories/ParentFactory.d.ts +1 -1
  20. package/dist/src/factories/ParentFactory.js +19 -19
  21. package/dist/src/factories/ParentFactory.js.map +1 -1
  22. package/dist/src/factories/RecordFactory.d.ts +2 -3
  23. package/dist/src/factories/RecordFactory.d.ts.map +1 -1
  24. package/dist/src/factories/RecordFactory.js +1 -1
  25. package/dist/src/factories/RecordFactory.js.map +1 -1
  26. package/dist/src/factories/RegisterCodeFactory.d.ts +2 -2
  27. package/dist/src/factories/RegisterCodeFactory.d.ts.map +1 -1
  28. package/dist/src/factories/RegisterCodeFactory.js +2 -2
  29. package/dist/src/factories/RegistrationFactory.d.ts +3 -3
  30. package/dist/src/factories/RegistrationFactory.d.ts.map +1 -1
  31. package/dist/src/factories/RegistrationFactory.js.map +1 -1
  32. package/dist/src/factories/RegistrationPeriodFactory.d.ts +2 -2
  33. package/dist/src/factories/RegistrationPeriodFactory.js.map +1 -1
  34. package/dist/src/factories/UserFactory.d.ts +3 -3
  35. package/dist/src/factories/UserFactory.d.ts.map +1 -1
  36. package/dist/src/factories/UserFactory.js +3 -3
  37. package/dist/src/factories/UserFactory.js.map +1 -1
  38. package/dist/src/factories/WebshopFactory.d.ts +4 -4
  39. package/dist/src/factories/WebshopFactory.d.ts.map +1 -1
  40. package/dist/src/factories/WebshopFactory.js +1 -1
  41. package/dist/src/factories/WebshopFactory.js.map +1 -1
  42. package/dist/src/helpers/DNSValidator.d.ts +1 -1
  43. package/dist/src/helpers/DNSValidator.d.ts.map +1 -1
  44. package/dist/src/helpers/DNSValidator.js +33 -33
  45. package/dist/src/helpers/DNSValidator.js.map +1 -1
  46. package/dist/src/helpers/EmailBuilder.d.ts +10 -10
  47. package/dist/src/helpers/EmailBuilder.d.ts.map +1 -1
  48. package/dist/src/helpers/EmailBuilder.js +34 -34
  49. package/dist/src/helpers/EmailBuilder.js.map +1 -1
  50. package/dist/src/helpers/GroupBuilder.d.ts.map +1 -1
  51. package/dist/src/helpers/GroupBuilder.js +57 -57
  52. package/dist/src/helpers/GroupBuilder.js.map +1 -1
  53. package/dist/src/helpers/Handlebars.d.ts.map +1 -1
  54. package/dist/src/helpers/Handlebars.js +29 -29
  55. package/dist/src/helpers/Handlebars.js.map +1 -1
  56. package/dist/src/helpers/MemberMerger.d.ts +1 -1
  57. package/dist/src/helpers/MemberMerger.d.ts.map +1 -1
  58. package/dist/src/helpers/MemberMerger.js +33 -33
  59. package/dist/src/helpers/MemberMerger.js.map +1 -1
  60. package/dist/src/helpers/MemberMerger.test.js +194 -194
  61. package/dist/src/helpers/MemberMerger.test.js.map +1 -1
  62. package/dist/src/helpers/RateLimiter.d.ts.map +1 -1
  63. package/dist/src/helpers/RateLimiter.js +2 -2
  64. package/dist/src/helpers/RateLimiter.js.map +1 -1
  65. package/dist/src/helpers/SetupStepsUpdater.d.ts +22 -0
  66. package/dist/src/helpers/SetupStepsUpdater.d.ts.map +1 -0
  67. package/dist/src/helpers/SetupStepsUpdater.js +255 -0
  68. package/dist/src/helpers/SetupStepsUpdater.js.map +1 -0
  69. package/dist/src/helpers/WebshopCounter.d.ts +1 -1
  70. package/dist/src/helpers/WebshopCounter.d.ts.map +1 -1
  71. package/dist/src/helpers/WebshopCounter.js +1 -1
  72. package/dist/src/helpers/WebshopCounter.js.map +1 -1
  73. package/dist/src/helpers/WebshopCounter.test.js +6 -6
  74. package/dist/src/helpers/WebshopCounter.test.js.map +1 -1
  75. package/dist/src/index.d.ts +20 -19
  76. package/dist/src/index.d.ts.map +1 -1
  77. package/dist/src/index.js +1 -0
  78. package/dist/src/index.js.map +1 -1
  79. package/dist/src/migrations/1605262045-import-postcodes.js +12 -12
  80. package/dist/src/migrations/1605262046-import-postcodes-nl.js +10 -10
  81. package/dist/src/models/BalanceItem.d.ts.map +1 -1
  82. package/dist/src/models/BalanceItem.js +37 -37
  83. package/dist/src/models/BalanceItem.js.map +1 -1
  84. package/dist/src/models/BalanceItemPayment.d.ts.map +1 -1
  85. package/dist/src/models/BalanceItemPayment.js +13 -13
  86. package/dist/src/models/BalanceItemPayment.js.map +1 -1
  87. package/dist/src/models/BuckarooPayment.d.ts +1 -1
  88. package/dist/src/models/BuckarooPayment.d.ts.map +1 -1
  89. package/dist/src/models/BuckarooPayment.js +5 -5
  90. package/dist/src/models/BuckarooPayment.js.map +1 -1
  91. package/dist/src/models/CachedOutstandingBalance.d.ts.map +1 -1
  92. package/dist/src/models/CachedOutstandingBalance.js +37 -37
  93. package/dist/src/models/CachedOutstandingBalance.js.map +1 -1
  94. package/dist/src/models/Document.d.ts +4 -4
  95. package/dist/src/models/Document.d.ts.map +1 -1
  96. package/dist/src/models/Document.js +27 -27
  97. package/dist/src/models/Document.js.map +1 -1
  98. package/dist/src/models/DocumentTemplate.d.ts +4 -4
  99. package/dist/src/models/DocumentTemplate.d.ts.map +1 -1
  100. package/dist/src/models/DocumentTemplate.js +72 -72
  101. package/dist/src/models/DocumentTemplate.js.map +1 -1
  102. package/dist/src/models/Email.d.ts.map +1 -1
  103. package/dist/src/models/Email.js +63 -64
  104. package/dist/src/models/Email.js.map +1 -1
  105. package/dist/src/models/EmailRecipient.d.ts.map +1 -1
  106. package/dist/src/models/EmailRecipient.js +20 -20
  107. package/dist/src/models/EmailRecipient.js.map +1 -1
  108. package/dist/src/models/EmailTemplate.d.ts +3 -3
  109. package/dist/src/models/EmailTemplate.d.ts.map +1 -1
  110. package/dist/src/models/EmailTemplate.js +16 -16
  111. package/dist/src/models/EmailTemplate.js.map +1 -1
  112. package/dist/src/models/EmailVerificationCode.d.ts +2 -2
  113. package/dist/src/models/EmailVerificationCode.d.ts.map +1 -1
  114. package/dist/src/models/EmailVerificationCode.js +57 -55
  115. package/dist/src/models/EmailVerificationCode.js.map +1 -1
  116. package/dist/src/models/Event.d.ts +2 -2
  117. package/dist/src/models/Event.d.ts.map +1 -1
  118. package/dist/src/models/Event.js +15 -15
  119. package/dist/src/models/Event.js.map +1 -1
  120. package/dist/src/models/Group.d.ts +3 -1
  121. package/dist/src/models/Group.d.ts.map +1 -1
  122. package/dist/src/models/Group.js +46 -35
  123. package/dist/src/models/Group.js.map +1 -1
  124. package/dist/src/models/Image.d.ts +1 -1
  125. package/dist/src/models/Image.d.ts.map +1 -1
  126. package/dist/src/models/Image.js +26 -26
  127. package/dist/src/models/Image.js.map +1 -1
  128. package/dist/src/models/Member.d.ts +8 -8
  129. package/dist/src/models/Member.d.ts.map +1 -1
  130. package/dist/src/models/Member.js +60 -60
  131. package/dist/src/models/Member.js.map +1 -1
  132. package/dist/src/models/MemberPlatformMembership.d.ts +3 -3
  133. package/dist/src/models/MemberPlatformMembership.d.ts.map +1 -1
  134. package/dist/src/models/MemberPlatformMembership.js +26 -26
  135. package/dist/src/models/MemberPlatformMembership.js.map +1 -1
  136. package/dist/src/models/MemberResponsibilityRecord.d.ts.map +1 -1
  137. package/dist/src/models/MemberResponsibilityRecord.js +13 -13
  138. package/dist/src/models/MemberResponsibilityRecord.js.map +1 -1
  139. package/dist/src/models/MergedMember.d.ts +3 -3
  140. package/dist/src/models/MergedMember.d.ts.map +1 -1
  141. package/dist/src/models/MergedMember.js +19 -19
  142. package/dist/src/models/MergedMember.js.map +1 -1
  143. package/dist/src/models/MolliePayment.d.ts +1 -1
  144. package/dist/src/models/MolliePayment.d.ts.map +1 -1
  145. package/dist/src/models/MolliePayment.js +5 -5
  146. package/dist/src/models/MolliePayment.js.map +1 -1
  147. package/dist/src/models/MollieToken.d.ts.map +1 -1
  148. package/dist/src/models/MollieToken.js +60 -60
  149. package/dist/src/models/MollieToken.js.map +1 -1
  150. package/dist/src/models/OneTimeToken.d.ts +2 -2
  151. package/dist/src/models/OneTimeToken.d.ts.map +1 -1
  152. package/dist/src/models/OneTimeToken.js +13 -13
  153. package/dist/src/models/OneTimeToken.js.map +1 -1
  154. package/dist/src/models/Order.d.ts +1 -1
  155. package/dist/src/models/Order.d.ts.map +1 -1
  156. package/dist/src/models/Order.js +70 -70
  157. package/dist/src/models/Order.js.map +1 -1
  158. package/dist/src/models/Organization.d.ts +5 -5
  159. package/dist/src/models/Organization.d.ts.map +1 -1
  160. package/dist/src/models/Organization.js +127 -127
  161. package/dist/src/models/Organization.js.map +1 -1
  162. package/dist/src/models/OrganizationRegistrationPeriod.d.ts.map +1 -1
  163. package/dist/src/models/OrganizationRegistrationPeriod.js +15 -15
  164. package/dist/src/models/OrganizationRegistrationPeriod.js.map +1 -1
  165. package/dist/src/models/PasswordToken.d.ts +3 -3
  166. package/dist/src/models/PasswordToken.d.ts.map +1 -1
  167. package/dist/src/models/PasswordToken.js +17 -17
  168. package/dist/src/models/PasswordToken.js.map +1 -1
  169. package/dist/src/models/PayconiqPayment.d.ts +1 -1
  170. package/dist/src/models/PayconiqPayment.d.ts.map +1 -1
  171. package/dist/src/models/PayconiqPayment.js +49 -49
  172. package/dist/src/models/PayconiqPayment.js.map +1 -1
  173. package/dist/src/models/Payment.d.ts +3 -3
  174. package/dist/src/models/Payment.d.ts.map +1 -1
  175. package/dist/src/models/Payment.js +36 -36
  176. package/dist/src/models/Payment.js.map +1 -1
  177. package/dist/src/models/Platform.d.ts +2 -2
  178. package/dist/src/models/Platform.d.ts.map +1 -1
  179. package/dist/src/models/Platform.js +8 -8
  180. package/dist/src/models/Platform.js.map +1 -1
  181. package/dist/src/models/RegisterCode.d.ts +1 -1
  182. package/dist/src/models/RegisterCode.d.ts.map +1 -1
  183. package/dist/src/models/RegisterCode.js +11 -11
  184. package/dist/src/models/RegisterCode.js.map +1 -1
  185. package/dist/src/models/Registration.d.ts +1 -1
  186. package/dist/src/models/Registration.d.ts.map +1 -1
  187. package/dist/src/models/Registration.js +88 -88
  188. package/dist/src/models/Registration.js.map +1 -1
  189. package/dist/src/models/RegistrationPeriod.d.ts.map +1 -1
  190. package/dist/src/models/RegistrationPeriod.js +12 -12
  191. package/dist/src/models/RegistrationPeriod.js.map +1 -1
  192. package/dist/src/models/STCredit.d.ts +1 -1
  193. package/dist/src/models/STCredit.d.ts.map +1 -1
  194. package/dist/src/models/STCredit.js +12 -12
  195. package/dist/src/models/STCredit.js.map +1 -1
  196. package/dist/src/models/STInvoice.d.ts +1 -1
  197. package/dist/src/models/STInvoice.d.ts.map +1 -1
  198. package/dist/src/models/STInvoice.js +16 -16
  199. package/dist/src/models/STInvoice.js.map +1 -1
  200. package/dist/src/models/STPackage.d.ts +1 -1
  201. package/dist/src/models/STPackage.d.ts.map +1 -1
  202. package/dist/src/models/STPackage.js +39 -39
  203. package/dist/src/models/STPackage.js.map +1 -1
  204. package/dist/src/models/STPendingInvoice.d.ts +1 -1
  205. package/dist/src/models/STPendingInvoice.d.ts.map +1 -1
  206. package/dist/src/models/STPendingInvoice.js +11 -11
  207. package/dist/src/models/STPendingInvoice.js.map +1 -1
  208. package/dist/src/models/StripeAccount.d.ts.map +1 -1
  209. package/dist/src/models/StripeAccount.js +13 -13
  210. package/dist/src/models/StripeAccount.js.map +1 -1
  211. package/dist/src/models/StripeCheckoutSession.d.ts +1 -1
  212. package/dist/src/models/StripeCheckoutSession.d.ts.map +1 -1
  213. package/dist/src/models/StripeCheckoutSession.js +7 -7
  214. package/dist/src/models/StripeCheckoutSession.js.map +1 -1
  215. package/dist/src/models/StripePaymentIntent.d.ts +1 -1
  216. package/dist/src/models/StripePaymentIntent.d.ts.map +1 -1
  217. package/dist/src/models/StripePaymentIntent.js +7 -7
  218. package/dist/src/models/StripePaymentIntent.js.map +1 -1
  219. package/dist/src/models/Ticket.d.ts +2 -2
  220. package/dist/src/models/Ticket.d.ts.map +1 -1
  221. package/dist/src/models/Ticket.js +23 -23
  222. package/dist/src/models/Ticket.js.map +1 -1
  223. package/dist/src/models/Token.d.ts +3 -3
  224. package/dist/src/models/Token.d.ts.map +1 -1
  225. package/dist/src/models/Token.js +27 -27
  226. package/dist/src/models/Token.js.map +1 -1
  227. package/dist/src/models/Token.test.js +11 -11
  228. package/dist/src/models/UsedRegisterCode.d.ts +1 -1
  229. package/dist/src/models/UsedRegisterCode.d.ts.map +1 -1
  230. package/dist/src/models/UsedRegisterCode.js +10 -10
  231. package/dist/src/models/UsedRegisterCode.js.map +1 -1
  232. package/dist/src/models/User.d.ts +4 -4
  233. package/dist/src/models/User.d.ts.map +1 -1
  234. package/dist/src/models/User.js +53 -51
  235. package/dist/src/models/User.js.map +1 -1
  236. package/dist/src/models/UserPermissions.d.ts +3 -3
  237. package/dist/src/models/UserPermissions.d.ts.map +1 -1
  238. package/dist/src/models/UserPermissions.js +12 -12
  239. package/dist/src/models/UserPermissions.js.map +1 -1
  240. package/dist/src/models/Webshop.d.ts +1 -1
  241. package/dist/src/models/Webshop.d.ts.map +1 -1
  242. package/dist/src/models/Webshop.js +23 -23
  243. package/dist/src/models/Webshop.js.map +1 -1
  244. package/dist/src/models/WebshopDiscountCode.d.ts +1 -1
  245. package/dist/src/models/WebshopDiscountCode.d.ts.map +1 -1
  246. package/dist/src/models/WebshopDiscountCode.js +16 -16
  247. package/dist/src/models/WebshopDiscountCode.js.map +1 -1
  248. package/dist/src/models/addresses/City.d.ts.map +1 -1
  249. package/dist/src/models/addresses/City.js +9 -9
  250. package/dist/src/models/addresses/City.js.map +1 -1
  251. package/dist/src/models/addresses/PostalCode.d.ts.map +1 -1
  252. package/dist/src/models/addresses/PostalCode.js +11 -11
  253. package/dist/src/models/addresses/PostalCode.js.map +1 -1
  254. package/dist/src/models/addresses/PostalCode.test.js +22 -22
  255. package/dist/src/models/addresses/PostalCode.test.js.map +1 -1
  256. package/dist/src/models/addresses/Province.d.ts.map +1 -1
  257. package/dist/src/models/addresses/Province.js +5 -5
  258. package/dist/src/models/addresses/Province.js.map +1 -1
  259. package/dist/src/models/addresses/Street.d.ts.map +1 -1
  260. package/dist/src/models/addresses/Street.js +6 -6
  261. package/dist/src/models/addresses/Street.js.map +1 -1
  262. package/dist/src/models/index.d.ts +46 -46
  263. package/dist/src/models/index.d.ts.map +1 -1
  264. package/dist/src/models/index.js +0 -1
  265. package/dist/src/models/index.js.map +1 -1
  266. package/dist/src/structures/OrganizationServerMetaData.d.ts.map +1 -1
  267. package/dist/src/structures/OrganizationServerMetaData.js +4 -4
  268. package/dist/src/structures/OrganizationServerMetaData.js.map +1 -1
  269. package/dist/tests/jest.global.setup.d.ts.map +1 -1
  270. package/dist/tests/jest.global.setup.js +15 -13
  271. package/dist/tests/jest.global.setup.js.map +1 -1
  272. package/dist/tests/jest.setup.js +3 -1
  273. package/dist/tests/jest.setup.js.map +1 -1
  274. package/dist/tsconfig.tsbuildinfo +1 -0
  275. package/package.json +3 -3
  276. package/src/factories/AddressFactory.ts +17 -17
  277. package/src/factories/EmergencyContactFactory.ts +30 -31
  278. package/src/factories/GroupFactory.ts +30 -30
  279. package/src/factories/MemberFactory.ts +41 -38
  280. package/src/factories/OrganizationFactory.ts +15 -15
  281. package/src/factories/ParentFactory.ts +24 -24
  282. package/src/factories/RecordFactory.ts +5 -4
  283. package/src/factories/RegisterCodeFactory.ts +7 -7
  284. package/src/factories/RegistrationFactory.ts +16 -16
  285. package/src/factories/RegistrationPeriodFactory.ts +5 -5
  286. package/src/factories/UserFactory.ts +20 -19
  287. package/src/factories/WebshopFactory.ts +14 -14
  288. package/src/helpers/DNSValidator.ts +89 -84
  289. package/src/helpers/EmailBuilder.ts +141 -135
  290. package/src/helpers/GroupBuilder.ts +181 -181
  291. package/src/helpers/Handlebars.ts +57 -54
  292. package/src/helpers/MemberMerger.test.ts +702 -702
  293. package/src/helpers/MemberMerger.ts +83 -77
  294. package/src/helpers/RateLimiter.ts +25 -27
  295. package/src/helpers/SetupStepsUpdater.ts +402 -0
  296. package/src/helpers/WebshopCounter.test.ts +12 -12
  297. package/src/helpers/WebshopCounter.ts +20 -19
  298. package/src/index.ts +20 -19
  299. package/src/migrations/1605262045-import-postcodes.ts +59 -63
  300. package/src/migrations/1605262046-import-postcodes-nl.ts +41 -43
  301. package/src/models/BalanceItem.ts +173 -172
  302. package/src/models/BalanceItemPayment.ts +32 -33
  303. package/src/models/BuckarooPayment.ts +7 -7
  304. package/src/models/CachedOutstandingBalance.ts +98 -99
  305. package/src/models/Document.ts +90 -87
  306. package/src/models/DocumentTemplate.ts +207 -198
  307. package/src/models/Email.ts +198 -200
  308. package/src/models/EmailRecipient.ts +38 -39
  309. package/src/models/EmailTemplate.ts +36 -37
  310. package/src/models/EmailVerificationCode.ts +146 -142
  311. package/src/models/Event.ts +53 -53
  312. package/src/models/Group.ts +136 -123
  313. package/src/models/Image.ts +48 -48
  314. package/src/models/Member.ts +277 -275
  315. package/src/models/MemberPlatformMembership.ts +71 -71
  316. package/src/models/MemberResponsibilityRecord.ts +32 -32
  317. package/src/models/MergedMember.ts +77 -77
  318. package/src/models/MolliePayment.ts +7 -7
  319. package/src/models/MollieToken.ts +131 -126
  320. package/src/models/OneTimeToken.ts +40 -39
  321. package/src/models/Order.ts +379 -372
  322. package/src/models/Organization.ts +332 -325
  323. package/src/models/OrganizationRegistrationPeriod.ts +50 -50
  324. package/src/models/PasswordToken.ts +42 -42
  325. package/src/models/PayconiqPayment.ts +80 -76
  326. package/src/models/Payment.ts +86 -86
  327. package/src/models/Platform.ts +21 -22
  328. package/src/models/RegisterCode.ts +26 -26
  329. package/src/models/Registration.ts +167 -168
  330. package/src/models/RegistrationPeriod.ts +29 -29
  331. package/src/models/STCredit.ts +24 -25
  332. package/src/models/STInvoice.ts +34 -34
  333. package/src/models/STPackage.ts +143 -136
  334. package/src/models/STPendingInvoice.ts +26 -26
  335. package/src/models/StripeAccount.ts +27 -27
  336. package/src/models/StripeCheckoutSession.ts +10 -10
  337. package/src/models/StripePaymentIntent.ts +10 -10
  338. package/src/models/Ticket.ts +51 -52
  339. package/src/models/Token.test.ts +13 -13
  340. package/src/models/Token.ts +64 -63
  341. package/src/models/UsedRegisterCode.ts +20 -21
  342. package/src/models/User.ts +148 -144
  343. package/src/models/UserPermissions.ts +25 -28
  344. package/src/models/Webshop.ts +53 -53
  345. package/src/models/WebshopDiscountCode.ts +33 -33
  346. package/src/models/addresses/City.ts +12 -12
  347. package/src/models/addresses/PostalCode.test.ts +68 -69
  348. package/src/models/addresses/PostalCode.ts +57 -57
  349. package/src/models/addresses/Province.ts +8 -8
  350. package/src/models/addresses/Street.ts +10 -12
  351. package/src/models/index.ts +54 -55
  352. package/src/structures/OrganizationServerMetaData.ts +36 -36
@@ -1,108 +1,108 @@
1
- import { column,Database,ManyToOneRelation,Model } from '@simonbackx/simple-database';
1
+ import { column, Database, ManyToOneRelation, Model } from '@simonbackx/simple-database';
2
2
  import { SimpleError } from '@simonbackx/simple-errors';
3
3
  import { Country } from '@stamhoofd/structures';
4
4
  import { Formatter, StringCompare } from '@stamhoofd/utility';
5
- import { v4 as uuidv4 } from "uuid";
5
+ import { v4 as uuidv4 } from 'uuid';
6
6
 
7
7
  import { City } from './City';
8
8
 
9
9
  export class PostalCode extends Model {
10
- static table = "postal_codes"
10
+ static table = 'postal_codes';
11
11
 
12
12
  @column({
13
- primary: true, type: "string", beforeSave(value) {
13
+ primary: true, type: 'string', beforeSave(value) {
14
14
  return value ?? uuidv4();
15
- }
15
+ },
16
16
  })
17
17
  id!: string;
18
18
 
19
- @column({ type: "string" })
19
+ @column({ type: 'string' })
20
20
  postalCode: string;
21
21
 
22
- @column({ type: "string", foreignKey: PostalCode.city })
22
+ @column({ type: 'string', foreignKey: PostalCode.city })
23
23
  cityId: string;
24
24
 
25
- @column({ type: "string" })
25
+ @column({ type: 'string' })
26
26
  country: Country;
27
27
 
28
- static city = new ManyToOneRelation(City, "city")
28
+ static city = new ManyToOneRelation(City, 'city');
29
29
 
30
30
  /**
31
31
  * Search for a given city via it's postal code and country, collecting information about the city (id), parentCity (id) and province (id)
32
32
  */
33
33
  static async getCity(postalCode: string, cityName: string, country: Country): Promise<City | null> {
34
34
  let query = `SELECT ${City.getDefaultSelect()}from \`${PostalCode.table}\`\n`;
35
- query += `JOIN \`${City.table}\` ON \`${PostalCode.table}\`.\`${PostalCode.city.foreignKey}\` = \`${City.table}\`.\`${City.primary.name}\`\n`
35
+ query += `JOIN \`${City.table}\` ON \`${PostalCode.table}\`.\`${PostalCode.city.foreignKey}\` = \`${City.table}\`.\`${City.primary.name}\`\n`;
36
36
 
37
37
  // We do an extra join because we also need to get the other registrations of each member (only one regitration has to match the query)
38
- query += `where \`${PostalCode.table}\`.\`postalCode\` = ? AND \`${PostalCode.table}\`.\`country\` = ?`
38
+ query += `where \`${PostalCode.table}\`.\`postalCode\` = ? AND \`${PostalCode.table}\`.\`country\` = ?`;
39
39
 
40
- const [results] = await Database.select(query, [postalCode, country])
40
+ const [results] = await Database.select(query, [postalCode, country]);
41
41
 
42
- const cities = City.fromRows(results, City.table)
42
+ const cities = City.fromRows(results, City.table);
43
43
 
44
44
  if (cities.length == 1) {
45
- return cities[0]
45
+ return cities[0];
46
46
  }
47
47
 
48
48
  // Search by city name (first exact match, then allow errors)
49
- let bestScore = 0
50
- let bestCity: City | null = null
49
+ let bestScore = 0;
50
+ let bestCity: City | null = null;
51
51
 
52
52
  for (const city of cities) {
53
- const typo = StringCompare.typoCount(cityName, city.name)
53
+ const typo = StringCompare.typoCount(cityName, city.name);
54
54
  if (typo == 0) {
55
- return city
55
+ return city;
56
56
  }
57
57
 
58
58
  if (bestCity === null || typo < bestScore) {
59
- bestCity = city
60
- bestScore = typo
59
+ bestCity = city;
60
+ bestScore = typo;
61
61
  }
62
62
  }
63
63
 
64
64
  if (bestCity && (bestScore < 3 || StringCompare.contains(cityName, bestCity.name) || StringCompare.contains(bestCity.name, cityName))) {
65
- return bestCity
65
+ return bestCity;
66
66
  }
67
67
 
68
- bestScore = 0
69
- bestCity = null
68
+ bestScore = 0;
69
+ bestCity = null;
70
70
 
71
71
  for (const city of cities) {
72
- const match = StringCompare.matchCount(cityName, city.name)
72
+ const match = StringCompare.matchCount(cityName, city.name);
73
73
 
74
74
  if (bestCity === null || match > bestScore) {
75
- bestCity = city
76
- bestScore = match
75
+ bestCity = city;
76
+ bestScore = match;
77
77
  }
78
78
  }
79
79
 
80
- if (bestCity && (bestScore > cityName.length/2 || StringCompare.contains(cityName, bestCity.name))) {
81
- return bestCity
80
+ if (bestCity && (bestScore > cityName.length / 2 || StringCompare.contains(cityName, bestCity.name))) {
81
+ return bestCity;
82
82
  }
83
83
 
84
84
  if (cities.length >= 1 && cities[0].parentCityId !== null && cities.every(c => c.parentCityId === cities[0].parentCityId)) {
85
85
  // Might have put a postal code of the parent city
86
- const parent = await City.getByID(cities[0].parentCityId)
86
+ const parent = await City.getByID(cities[0].parentCityId);
87
87
  if (parent) {
88
- const typo = StringCompare.typoCount(cityName, parent.name)
88
+ const typo = StringCompare.typoCount(cityName, parent.name);
89
89
  if (typo < 4 || StringCompare.contains(cityName, parent.name)) {
90
90
  if (cities.length > 1) {
91
91
  throw new SimpleError({
92
- code: "invalid_field",
93
- message: "Invalid city. Suggestions: " + Formatter.joinLast(cities.map(c => c.name), ", ", " of ") + "?",
94
- human: "Welke gemeente bedoel je precies? " + Formatter.joinLast(cities.map(c => c.name), ", ", " of ") + "?",
95
- field: "city"
96
- })
92
+ code: 'invalid_field',
93
+ message: 'Invalid city. Suggestions: ' + Formatter.joinLast(cities.map(c => c.name), ', ', ' of ') + '?',
94
+ human: 'Welke gemeente bedoel je precies? ' + Formatter.joinLast(cities.map(c => c.name), ', ', ' of ') + '?',
95
+ field: 'city',
96
+ });
97
97
  }
98
- return cities[0] // do not return parent here, because the postal code has priority
98
+ return cities[0]; // do not return parent here, because the postal code has priority
99
99
  }
100
100
  }
101
101
  }
102
102
 
103
103
  // Search parent in belgium only
104
104
  if (country == Country.Belgium) {
105
- return this.getCityByParent(postalCode, cityName, country)
105
+ return this.getCityByParent(postalCode, cityName, country);
106
106
  }
107
107
 
108
108
  return null;
@@ -113,52 +113,52 @@ export class PostalCode extends Model {
113
113
  */
114
114
  static async getCityByParent(postalCode: string, cityName: string, country: Country): Promise<City | null> {
115
115
  let query = `SELECT ${City.getDefaultSelect()}from \`${PostalCode.table}\`\n`;
116
- query += `JOIN \`${City.table}\` as parent ON \`${PostalCode.table}\`.\`${PostalCode.city.foreignKey}\` = \`parent\`.\`${City.primary.name}\`\n`
117
- query += `JOIN \`${City.table}\` ON \`parent\`.\`${City.primary.name}\` = \`${City.table}\`.\`${City.parentCity.foreignKey}\`\n`
116
+ query += `JOIN \`${City.table}\` as parent ON \`${PostalCode.table}\`.\`${PostalCode.city.foreignKey}\` = \`parent\`.\`${City.primary.name}\`\n`;
117
+ query += `JOIN \`${City.table}\` ON \`parent\`.\`${City.primary.name}\` = \`${City.table}\`.\`${City.parentCity.foreignKey}\`\n`;
118
118
 
119
119
  // We do an extra join because we also need to get the other registrations of each member (only one regitration has to match the query)
120
- query += `where \`${PostalCode.table}\`.\`postalCode\` = ? AND \`${PostalCode.table}\`.\`country\` = ?`
120
+ query += `where \`${PostalCode.table}\`.\`postalCode\` = ? AND \`${PostalCode.table}\`.\`country\` = ?`;
121
121
 
122
- const [results] = await Database.select(query, [postalCode, country])
122
+ const [results] = await Database.select(query, [postalCode, country]);
123
123
 
124
- const cities = City.fromRows(results, City.table)
124
+ const cities = City.fromRows(results, City.table);
125
125
 
126
126
  // Search by city name (first exact match, then allow errors)
127
- let bestScore = 0
128
- let bestCity: City | null = null
127
+ let bestScore = 0;
128
+ let bestCity: City | null = null;
129
129
 
130
130
  for (const city of cities) {
131
- const typo = StringCompare.typoCount(cityName, city.name)
131
+ const typo = StringCompare.typoCount(cityName, city.name);
132
132
  if (typo == 0) {
133
- return city
133
+ return city;
134
134
  }
135
135
 
136
136
  if (bestCity === null || typo < bestScore) {
137
- bestCity = city
138
- bestScore = typo
137
+ bestCity = city;
138
+ bestScore = typo;
139
139
  }
140
140
  }
141
141
 
142
142
  if (bestCity && (bestScore < 3 || StringCompare.contains(cityName, bestCity.name) || StringCompare.contains(bestCity.name, cityName))) {
143
- return bestCity
143
+ return bestCity;
144
144
  }
145
145
 
146
- bestScore = 0
147
- bestCity = null
146
+ bestScore = 0;
147
+ bestCity = null;
148
148
 
149
149
  for (const city of cities) {
150
- const match = StringCompare.matchCount(cityName, city.name)
150
+ const match = StringCompare.matchCount(cityName, city.name);
151
151
 
152
152
  if (bestCity === null || match > bestScore) {
153
- bestCity = city
154
- bestScore = match
153
+ bestCity = city;
154
+ bestScore = match;
155
155
  }
156
156
  }
157
157
 
158
- if (bestCity && (bestScore > cityName.length/2 || StringCompare.contains(cityName, bestCity.name))) {
159
- return bestCity
158
+ if (bestCity && (bestScore > cityName.length / 2 || StringCompare.contains(cityName, bestCity.name))) {
159
+ return bestCity;
160
160
  }
161
161
 
162
162
  return null;
163
163
  }
164
- }
164
+ }
@@ -1,20 +1,20 @@
1
- import { column,Model } from '@simonbackx/simple-database';
1
+ import { column, Model } from '@simonbackx/simple-database';
2
2
  import { Country } from '@stamhoofd/structures';
3
- import { v4 as uuidv4 } from "uuid";
3
+ import { v4 as uuidv4 } from 'uuid';
4
4
 
5
5
  export class Province extends Model {
6
- static table = "provinces"
6
+ static table = 'provinces';
7
7
 
8
8
  @column({
9
- primary: true, type: "string", beforeSave(value) {
9
+ primary: true, type: 'string', beforeSave(value) {
10
10
  return value ?? uuidv4();
11
- }
11
+ },
12
12
  })
13
13
  id!: string;
14
14
 
15
- @column({ type: "string" })
15
+ @column({ type: 'string' })
16
16
  name: string;
17
17
 
18
- @column({ type: "string" })
18
+ @column({ type: 'string' })
19
19
  country: Country;
20
- }
20
+ }
@@ -1,25 +1,23 @@
1
1
  import { column, ManyToOneRelation, Model } from '@simonbackx/simple-database';
2
- import { v4 as uuidv4 } from "uuid";
2
+ import { v4 as uuidv4 } from 'uuid';
3
3
 
4
4
  import { City } from './City';
5
5
 
6
6
  export class Street extends Model {
7
- static table = "streets"
7
+ static table = 'streets';
8
8
 
9
9
  @column({
10
- primary: true, type: "string", beforeSave(value) {
10
+ primary: true, type: 'string', beforeSave(value) {
11
11
  return value ?? uuidv4();
12
- }
12
+ },
13
13
  })
14
14
  id!: string;
15
-
16
- @column({ type: "string" })
15
+
16
+ @column({ type: 'string' })
17
17
  name: string;
18
-
19
- @column({ type: "string", foreignKey: Street.city })
20
- cityId: string;
21
18
 
22
- static city = new ManyToOneRelation(City, "city")
19
+ @column({ type: 'string', foreignKey: Street.city })
20
+ cityId: string;
23
21
 
24
-
25
- }
22
+ static city = new ManyToOneRelation(City, 'city');
23
+ }
@@ -1,55 +1,54 @@
1
- /* eslint-disable simple-import-sort/exports */
2
- export {Organization} from "./Organization"
3
- export {User} from "./User"
4
- export {Payment} from "./Payment"
5
- export {Registration} from "./Registration"
6
- export {Member, RegistrationWithMember, MemberWithRegistrations} from "./Member"
7
- export {MergedMember} from "./MergedMember"
8
-
9
- export * from "./EmailVerificationCode"
10
-
11
- export * from "./Image"
12
- export * from "./MolliePayment"
13
- export * from "./MollieToken"
14
- export {Order} from "./Order"
15
- export * from "./PasswordToken"
16
- export * from "./PayconiqPayment"
17
- export * from "./RegisterCode"
18
- export * from "./STInvoice"
19
- export * from "./STPackage"
20
- export {STPendingInvoice} from "./STPendingInvoice"
21
- export {Token, TokenWithUser} from "./Token"
22
- export * from "./Webshop"
23
- export * from "./STCredit"
24
- export * from "./UsedRegisterCode"
25
- export * from "./Ticket"
26
- export * from "./EmailTemplate"
27
- export * from "./BuckarooPayment"
28
- export {BalanceItem} from "./BalanceItem"
29
- export {BalanceItemPayment} from "./BalanceItemPayment"
30
- export {Group} from "./Group"
31
-
32
- export * from "./addresses/Street"
33
- export * from "./addresses/City"
34
- export * from "./addresses/PostalCode"
35
- export * from "./addresses/Province"
36
-
37
- export * from "./StripeAccount"
38
- export * from "./StripePaymentIntent"
39
- export * from "./StripeCheckoutSession"
40
-
41
- export * from "./Document"
42
- export * from "./DocumentTemplate"
43
-
44
- export * from "./WebshopDiscountCode"
45
-
46
- export * from "./Platform"
47
- export * from "./MemberResponsibilityRecord"
48
-
49
- export * from "./OrganizationRegistrationPeriod"
50
- export * from "./RegistrationPeriod"
51
- export * from "./MemberPlatformMembership"
52
- export * from "./Email"
53
- export * from "./EmailRecipient"
54
- export * from "./Event"
55
- export * from "./CachedOutstandingBalance"
1
+ export { Organization } from './Organization';
2
+ export { User } from './User';
3
+ export { Payment } from './Payment';
4
+ export { Registration } from './Registration';
5
+ export { Member, RegistrationWithMember, MemberWithRegistrations } from './Member';
6
+ export { MergedMember } from './MergedMember';
7
+
8
+ export * from './EmailVerificationCode';
9
+
10
+ export * from './Image';
11
+ export * from './MolliePayment';
12
+ export * from './MollieToken';
13
+ export { Order } from './Order';
14
+ export * from './PasswordToken';
15
+ export * from './PayconiqPayment';
16
+ export * from './RegisterCode';
17
+ export * from './STInvoice';
18
+ export * from './STPackage';
19
+ export { STPendingInvoice } from './STPendingInvoice';
20
+ export { Token, TokenWithUser } from './Token';
21
+ export * from './Webshop';
22
+ export * from './STCredit';
23
+ export * from './UsedRegisterCode';
24
+ export * from './Ticket';
25
+ export * from './EmailTemplate';
26
+ export * from './BuckarooPayment';
27
+ export { BalanceItem } from './BalanceItem';
28
+ export { BalanceItemPayment } from './BalanceItemPayment';
29
+ export { Group } from './Group';
30
+
31
+ export * from './addresses/Street';
32
+ export * from './addresses/City';
33
+ export * from './addresses/PostalCode';
34
+ export * from './addresses/Province';
35
+
36
+ export * from './StripeAccount';
37
+ export * from './StripePaymentIntent';
38
+ export * from './StripeCheckoutSession';
39
+
40
+ export * from './Document';
41
+ export * from './DocumentTemplate';
42
+
43
+ export * from './WebshopDiscountCode';
44
+
45
+ export * from './Platform';
46
+ export * from './MemberResponsibilityRecord';
47
+
48
+ export * from './OrganizationRegistrationPeriod';
49
+ export * from './RegistrationPeriod';
50
+ export * from './MemberPlatformMembership';
51
+ export * from './Email';
52
+ export * from './EmailRecipient';
53
+ export * from './Event';
54
+ export * from './CachedOutstandingBalance';
@@ -1,78 +1,78 @@
1
- import { ArrayDecoder, AutoEncoder,BooleanDecoder,DateDecoder,field, IntegerDecoder, MapDecoder, StringDecoder } from '@simonbackx/simple-encoding';
1
+ import { ArrayDecoder, AutoEncoder, BooleanDecoder, DateDecoder, field, IntegerDecoder, MapDecoder, StringDecoder } from '@simonbackx/simple-encoding';
2
2
  import { OpenIDClientConfiguration } from '@stamhoofd/structures';
3
3
 
4
4
  export class DripEmail extends AutoEncoder {
5
5
  @field({ decoder: StringDecoder })
6
- id: string
6
+ id: string;
7
7
 
8
8
  @field({ decoder: DateDecoder })
9
- date = new Date()
9
+ date = new Date();
10
10
  }
11
11
 
12
12
  export class OrganizationServerMetaData extends AutoEncoder {
13
13
  @field({ decoder: StringDecoder, optional: true })
14
- privateDKIMKey?: string
14
+ privateDKIMKey?: string;
15
15
 
16
16
  @field({ decoder: StringDecoder, optional: true })
17
- publicDKIMKey?: string
17
+ publicDKIMKey?: string;
18
18
 
19
19
  @field({ decoder: StringDecoder, optional: true, version: 24 })
20
- usedRegisterCode?: string
20
+ usedRegisterCode?: string;
21
21
 
22
22
  /**
23
23
  * When the DNS records are invalid for the first time, this timestamp will get set.
24
24
  * When DNS is valid again, this will get cleared
25
25
  */
26
26
  @field({ decoder: DateDecoder, optional: true, version: 37 })
27
- firstInvalidDNSRecords?: Date
27
+ firstInvalidDNSRecords?: Date;
28
28
 
29
29
  /**
30
30
  * Whether an email has been send to say that the domain is setup correctly
31
31
  * Set back to false when changing the domain
32
32
  */
33
33
  @field({ decoder: BooleanDecoder, optional: true, version: 157 })
34
- didSendDomainSetupMail = true
34
+ didSendDomainSetupMail = true;
35
35
 
36
36
  /**
37
37
  * When the DNS records are invalid for the first time, this timestamp will get set.
38
38
  * When DNS is valid again, this will get cleared
39
39
  */
40
40
  @field({ decoder: IntegerDecoder, version: 37 })
41
- DNSRecordWarningCount = 0
42
-
41
+ DNSRecordWarningCount = 0;
42
+
43
43
  @field({ decoder: new ArrayDecoder(DateDecoder), optional: true, version: 230 })
44
- lastInvalidDNSDates?: Date[]
44
+ lastInvalidDNSDates?: Date[];
45
45
 
46
46
  @field({ decoder: BooleanDecoder, version: 230 })
47
- isDNSUnstable: boolean = false
47
+ isDNSUnstable: boolean = false;
48
48
 
49
49
  @field({ decoder: StringDecoder, optional: true, version: 86 })
50
- mollieCustomerId?: string
50
+ mollieCustomerId?: string;
51
51
 
52
52
  @field({ decoder: OpenIDClientConfiguration, nullable: true, version: 189 })
53
- ssoConfiguration: OpenIDClientConfiguration | null = null
53
+ ssoConfiguration: OpenIDClientConfiguration | null = null;
54
54
 
55
55
  /**
56
56
  * List of specific emails that were send to this organization
57
57
  */
58
58
  @field({ decoder: new MapDecoder(StringDecoder, DripEmail), optional: true, version: 230, upgrade: () => {
59
59
  const m = new Map<string, DripEmail>();
60
- const identifier = "OrganizationDripWelcome";
61
- m.set(identifier, DripEmail.create({id: identifier}))
62
- return m
60
+ const identifier = 'OrganizationDripWelcome';
61
+ m.set(identifier, DripEmail.create({ id: identifier }));
62
+ return m;
63
63
  } })
64
64
  @field({ decoder: new MapDecoder(StringDecoder, DripEmail), optional: true, version: 232, upgrade: () => {
65
65
  const m = new Map<string, DripEmail>();
66
- const identifier = "OrganizationDripWelcome";
67
- m.set(identifier, DripEmail.create({id: identifier}))
68
- return m
66
+ const identifier = 'OrganizationDripWelcome';
67
+ m.set(identifier, DripEmail.create({ id: identifier }));
68
+ return m;
69
69
  } })
70
- dripEmailList: Map<string, DripEmail> = new Map()
70
+ dripEmailList: Map<string, DripEmail> = new Map();
71
71
 
72
72
  markDNSValid() {
73
73
  // Reset if longer than 14 days without invalid DNS
74
- this.isDNSUnstable = this.recalculateIsDNSUnstable()
75
- this.firstInvalidDNSRecords = undefined
74
+ this.isDNSUnstable = this.recalculateIsDNSUnstable();
75
+ this.firstInvalidDNSRecords = undefined;
76
76
  }
77
77
 
78
78
  markDNSFailure() {
@@ -80,31 +80,31 @@ export class OrganizationServerMetaData extends AutoEncoder {
80
80
  // Hasn't been valid
81
81
  return;
82
82
  }
83
- console.warn("DNS settings became invalid")
84
- this.firstInvalidDNSRecords = new Date()
85
-
83
+ console.warn('DNS settings became invalid');
84
+ this.firstInvalidDNSRecords = new Date();
85
+
86
86
  // Remove all dates longer than 14 days ago, or more than 6 events
87
- const d14 = new Date(Date.now() - 1000 * 60 * 60 * 24 * 14)
88
- const maxLength = 6
87
+ const d14 = new Date(Date.now() - 1000 * 60 * 60 * 24 * 14);
88
+ const maxLength = 6;
89
89
  this.lastInvalidDNSDates = [...(this.lastInvalidDNSDates ?? []), new Date()].filter(d => d > d14).slice(0, maxLength);
90
- this.isDNSUnstable = this.recalculateIsDNSUnstable()
90
+ this.isDNSUnstable = this.recalculateIsDNSUnstable();
91
91
  }
92
92
 
93
93
  /**
94
94
  * DNS is unstable if it was marked invalid 4 times in the last 2 weeks. Then it stays unstable until there were no invalid DNS moments in the last 2 weeks.
95
95
  */
96
96
  recalculateIsDNSUnstable() {
97
- const d14 = new Date(Date.now() - 1000 * 60 * 60 * 24 * 14)
98
- return (this.lastInvalidDNSDates ?? []).filter(d => d > d14).length > (this.isDNSUnstable ? 0 : 4)
97
+ const d14 = new Date(Date.now() - 1000 * 60 * 60 * 24 * 14);
98
+ return (this.lastInvalidDNSDates ?? []).filter(d => d > d14).length > (this.isDNSUnstable ? 0 : 4);
99
99
  }
100
100
 
101
101
  addEmail(identifier: string) {
102
- console.log("Marked email ", identifier)
103
- const email = DripEmail.create({id: identifier})
102
+ console.log('Marked email ', identifier);
103
+ const email = DripEmail.create({ id: identifier });
104
104
  this.dripEmailList.set(email.id, email);
105
105
  }
106
106
 
107
- hasEmail(identifier: string, lastMs: number|null = null) {
107
+ hasEmail(identifier: string, lastMs: number | null = null) {
108
108
  if (!this.dripEmailList.has(identifier)) {
109
109
  return false;
110
110
  }
@@ -112,6 +112,6 @@ export class OrganizationServerMetaData extends AutoEncoder {
112
112
  return true;
113
113
  }
114
114
  const email = this.dripEmailList.get(identifier)!;
115
- return email.date.getTime() > Date.now() - lastMs
115
+ return email.date.getTime() > Date.now() - lastMs;
116
116
  }
117
- }
117
+ }