@passly-nl/data 0.1.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 (309) hide show
  1. package/CODEOWNERS +1 -0
  2. package/LICENSE +21 -0
  3. package/README.md +19 -0
  4. package/dist/adapter/AddressAdapter.d.ts +3 -0
  5. package/dist/adapter/AuthAdapter.d.ts +6 -0
  6. package/dist/adapter/BuyerAdapter.d.ts +4 -0
  7. package/dist/adapter/CommonAdapter.d.ts +4 -0
  8. package/dist/adapter/DateTimeAdapter.d.ts +4 -0
  9. package/dist/adapter/EventAdapter.d.ts +22 -0
  10. package/dist/adapter/FileSystemAdapter.d.ts +4 -0
  11. package/dist/adapter/FinanceAdapter.d.ts +6 -0
  12. package/dist/adapter/FluxAdapter.d.ts +6 -0
  13. package/dist/adapter/MerchantAdapter.d.ts +8 -0
  14. package/dist/adapter/MerchantDashboardAdapter.d.ts +5 -0
  15. package/dist/adapter/OrderAdapter.d.ts +7 -0
  16. package/dist/adapter/PaymentAdapter.d.ts +7 -0
  17. package/dist/adapter/ProductAdapter.d.ts +4 -0
  18. package/dist/adapter/PublicPayAdapter.d.ts +4 -0
  19. package/dist/adapter/PublicShopAdapter.d.ts +13 -0
  20. package/dist/adapter/ReservationAdapter.d.ts +6 -0
  21. package/dist/adapter/TicketAdapter.d.ts +4 -0
  22. package/dist/adapter/index.d.ts +18 -0
  23. package/dist/dto/address/AddressDto.d.ts +20 -0
  24. package/dist/dto/address/index.d.ts +1 -0
  25. package/dist/dto/auth/TotpStateDto.d.ts +10 -0
  26. package/dist/dto/auth/UserDto.d.ts +23 -0
  27. package/dist/dto/auth/UserTokenDto.d.ts +23 -0
  28. package/dist/dto/auth/index.d.ts +3 -0
  29. package/dist/dto/common/StatusResponseDto.d.ts +8 -0
  30. package/dist/dto/common/index.d.ts +1 -0
  31. package/dist/dto/event/EventAvailabilityDto.d.ts +14 -0
  32. package/dist/dto/event/EventCountersDto.d.ts +10 -0
  33. package/dist/dto/event/EventDto.d.ts +29 -0
  34. package/dist/dto/event/EventStatisticsAttendanceDto.d.ts +10 -0
  35. package/dist/dto/event/EventStatisticsBuyerTotalsDto.d.ts +14 -0
  36. package/dist/dto/event/EventStatisticsFinancialDto.d.ts +9 -0
  37. package/dist/dto/event/EventStatisticsOrderTotalsDto.d.ts +12 -0
  38. package/dist/dto/event/EventStatisticsOrdersDto.d.ts +10 -0
  39. package/dist/dto/event/EventStatisticsScanTotalsDto.d.ts +10 -0
  40. package/dist/dto/event/EventStatisticsScansDto.d.ts +12 -0
  41. package/dist/dto/event/EventStatisticsScansPerAppTeamDto.d.ts +10 -0
  42. package/dist/dto/event/EventStatisticsSwapTotalsDto.d.ts +10 -0
  43. package/dist/dto/event/ShopDesignDto.d.ts +10 -0
  44. package/dist/dto/event/ShopDto.d.ts +35 -0
  45. package/dist/dto/event/ShopElementButtonDto.d.ts +12 -0
  46. package/dist/dto/event/ShopElementDividerDto.d.ts +10 -0
  47. package/dist/dto/event/ShopElementDto.d.ts +9 -0
  48. package/dist/dto/event/ShopElementHeadingDto.d.ts +10 -0
  49. package/dist/dto/event/ShopElementNoticeDto.d.ts +15 -0
  50. package/dist/dto/event/ShopElementProductDto.d.ts +7 -0
  51. package/dist/dto/event/ShopElementTextDto.d.ts +7 -0
  52. package/dist/dto/event/StockOverviewDto.d.ts +13 -0
  53. package/dist/dto/event/StockOverviewItemDto.d.ts +13 -0
  54. package/dist/dto/event/StockPoolDto.d.ts +25 -0
  55. package/dist/dto/event/TicketTemplateDto.d.ts +18 -0
  56. package/dist/dto/event/index.d.ts +25 -0
  57. package/dist/dto/fileSystem/PictureDto.d.ts +10 -0
  58. package/dist/dto/fileSystem/index.d.ts +1 -0
  59. package/dist/dto/finance/FinanceOverviewDto.d.ts +13 -0
  60. package/dist/dto/finance/InvoiceDto.d.ts +25 -0
  61. package/dist/dto/finance/InvoiceLineDto.d.ts +17 -0
  62. package/dist/dto/finance/index.d.ts +3 -0
  63. package/dist/dto/index.d.ts +14 -0
  64. package/dist/dto/merchant/ContractDto.d.ts +16 -0
  65. package/dist/dto/merchant/InvitationDto.d.ts +25 -0
  66. package/dist/dto/merchant/MerchantDashboardKeyMetricsDto.d.ts +22 -0
  67. package/dist/dto/merchant/MerchantDashboardUpcomingEventDto.d.ts +25 -0
  68. package/dist/dto/merchant/MerchantDto.d.ts +32 -0
  69. package/dist/dto/merchant/MerchantUserDto.d.ts +14 -0
  70. package/dist/dto/merchant/VatNumberDto.d.ts +19 -0
  71. package/dist/dto/merchant/index.d.ts +7 -0
  72. package/dist/dto/order/BuyerDto.d.ts +27 -0
  73. package/dist/dto/order/OrderDto.d.ts +37 -0
  74. package/dist/dto/order/OrderLineDto.d.ts +20 -0
  75. package/dist/dto/order/OrderPaymentProviderDto.d.ts +8 -0
  76. package/dist/dto/order/OrderProductDto.d.ts +12 -0
  77. package/dist/dto/order/index.d.ts +5 -0
  78. package/dist/dto/payment/CostDto.d.ts +16 -0
  79. package/dist/dto/payment/PaymentMethodDto.d.ts +10 -0
  80. package/dist/dto/payment/PaymentProviderDto.d.ts +12 -0
  81. package/dist/dto/payment/TransactionDto.d.ts +24 -0
  82. package/dist/dto/payment/index.d.ts +4 -0
  83. package/dist/dto/product/ProductDto.d.ts +30 -0
  84. package/dist/dto/product/index.d.ts +1 -0
  85. package/dist/dto/publicPay/PublicPaymentMethodDto.d.ts +10 -0
  86. package/dist/dto/publicPay/index.d.ts +1 -0
  87. package/dist/dto/publicShop/PublicShopCartProductDto.d.ts +10 -0
  88. package/dist/dto/publicShop/PublicShopDesignDto.d.ts +10 -0
  89. package/dist/dto/publicShop/PublicShopDto.d.ts +31 -0
  90. package/dist/dto/publicShop/PublicShopElementButtonDto.d.ts +12 -0
  91. package/dist/dto/publicShop/PublicShopElementDividerDto.d.ts +10 -0
  92. package/dist/dto/publicShop/PublicShopElementDto.d.ts +9 -0
  93. package/dist/dto/publicShop/PublicShopElementHeadingDto.d.ts +10 -0
  94. package/dist/dto/publicShop/PublicShopElementNoticeDto.d.ts +15 -0
  95. package/dist/dto/publicShop/PublicShopElementProductDto.d.ts +7 -0
  96. package/dist/dto/publicShop/PublicShopElementTextDto.d.ts +7 -0
  97. package/dist/dto/publicShop/PublicShopEventDto.d.ts +16 -0
  98. package/dist/dto/publicShop/PublicShopMerchantDto.d.ts +8 -0
  99. package/dist/dto/publicShop/PublicShopProductDto.d.ts +28 -0
  100. package/dist/dto/publicShop/PublicShopReservationDto.d.ts +14 -0
  101. package/dist/dto/publicShop/PublicShopReservationProductDetailsDto.d.ts +13 -0
  102. package/dist/dto/publicShop/PublicShopReservationProductDto.d.ts +9 -0
  103. package/dist/dto/publicShop/PublicShopTimeSlotDto.d.ts +15 -0
  104. package/dist/dto/publicShop/index.d.ts +17 -0
  105. package/dist/dto/reservation/ReservationDto.d.ts +16 -0
  106. package/dist/dto/reservation/ReservationItemDto.d.ts +9 -0
  107. package/dist/dto/reservation/ReservationProductDto.d.ts +13 -0
  108. package/dist/dto/reservation/index.d.ts +3 -0
  109. package/dist/dto/ticket/TicketDto.d.ts +31 -0
  110. package/dist/dto/ticket/index.d.ts +1 -0
  111. package/dist/index.d.ts +5 -0
  112. package/dist/index.js +4 -0
  113. package/dist/index.js.map +136 -0
  114. package/dist/service/AuthService.d.ts +11 -0
  115. package/dist/service/InvitationService.d.ts +7 -0
  116. package/dist/service/MeService.d.ts +12 -0
  117. package/dist/service/MerchantBuyerService.d.ts +7 -0
  118. package/dist/service/MerchantBuyersService.d.ts +5 -0
  119. package/dist/service/MerchantDashboardService.d.ts +6 -0
  120. package/dist/service/MerchantEventProductService.d.ts +10 -0
  121. package/dist/service/MerchantEventProductsService.d.ts +8 -0
  122. package/dist/service/MerchantEventService.d.ts +13 -0
  123. package/dist/service/MerchantEventShopService.d.ts +9 -0
  124. package/dist/service/MerchantEventShopsService.d.ts +8 -0
  125. package/dist/service/MerchantEventStatisticsService.d.ts +10 -0
  126. package/dist/service/MerchantEventStockPoolsService.d.ts +9 -0
  127. package/dist/service/MerchantEventTicketTemplateService.d.ts +11 -0
  128. package/dist/service/MerchantEventTicketTemplatesService.d.ts +9 -0
  129. package/dist/service/MerchantEventsService.d.ts +7 -0
  130. package/dist/service/MerchantFinanceInvoiceService.d.ts +6 -0
  131. package/dist/service/MerchantFinanceInvoicesService.d.ts +5 -0
  132. package/dist/service/MerchantFinanceService.d.ts +8 -0
  133. package/dist/service/MerchantOrderService.d.ts +9 -0
  134. package/dist/service/MerchantOrdersService.d.ts +5 -0
  135. package/dist/service/MerchantService.d.ts +14 -0
  136. package/dist/service/MerchantStatisticsService.d.ts +5 -0
  137. package/dist/service/MerchantTicketService.d.ts +7 -0
  138. package/dist/service/MerchantTicketsService.d.ts +5 -0
  139. package/dist/service/MerchantUsersService.d.ts +7 -0
  140. package/dist/service/MerchantsService.d.ts +5 -0
  141. package/dist/service/PublicOrderService.d.ts +7 -0
  142. package/dist/service/PublicShopService.d.ts +9 -0
  143. package/dist/service/ReservationService.d.ts +6 -0
  144. package/dist/service/ServicesService.d.ts +9 -0
  145. package/dist/service/UiSelectOptionsService.d.ts +6 -0
  146. package/dist/service/index.d.ts +32 -0
  147. package/dist/types/index.d.ts +9 -0
  148. package/dist/util/emptyNull.d.ts +1 -0
  149. package/dist/util/index.d.ts +4 -0
  150. package/dist/util/jsonBlob.d.ts +1 -0
  151. package/dist/util/optional.d.ts +4 -0
  152. package/dist/util/optionalArray.d.ts +1 -0
  153. package/package.json +62 -0
  154. package/src/adapter/AddressAdapter.ts +18 -0
  155. package/src/adapter/AuthAdapter.ts +42 -0
  156. package/src/adapter/BuyerAdapter.ts +22 -0
  157. package/src/adapter/CommonAdapter.ts +12 -0
  158. package/src/adapter/DateTimeAdapter.ts +11 -0
  159. package/src/adapter/EventAdapter.ts +237 -0
  160. package/src/adapter/FileSystemAdapter.ts +13 -0
  161. package/src/adapter/FinanceAdapter.ts +40 -0
  162. package/src/adapter/FluxAdapter.ts +21 -0
  163. package/src/adapter/MerchantAdapter.ts +70 -0
  164. package/src/adapter/MerchantDashboardAdapter.ts +29 -0
  165. package/src/adapter/OrderAdapter.ts +55 -0
  166. package/src/adapter/PaymentAdapter.ts +48 -0
  167. package/src/adapter/ProductAdapter.ts +24 -0
  168. package/src/adapter/PublicPayAdapter.ts +13 -0
  169. package/src/adapter/PublicShopAdapter.ts +149 -0
  170. package/src/adapter/ReservationAdapter.ts +33 -0
  171. package/src/adapter/TicketAdapter.ts +24 -0
  172. package/src/adapter/index.ts +18 -0
  173. package/src/dto/address/AddressDto.ts +88 -0
  174. package/src/dto/address/index.ts +1 -0
  175. package/src/dto/auth/TotpStateDto.ts +38 -0
  176. package/src/dto/auth/UserDto.ts +99 -0
  177. package/src/dto/auth/UserTokenDto.ts +91 -0
  178. package/src/dto/auth/index.ts +3 -0
  179. package/src/dto/common/StatusResponseDto.ts +28 -0
  180. package/src/dto/common/index.ts +1 -0
  181. package/src/dto/event/EventAvailabilityDto.ts +58 -0
  182. package/src/dto/event/EventCountersDto.ts +38 -0
  183. package/src/dto/event/EventDto.ts +121 -0
  184. package/src/dto/event/EventStatisticsAttendanceDto.ts +38 -0
  185. package/src/dto/event/EventStatisticsBuyerTotalsDto.ts +58 -0
  186. package/src/dto/event/EventStatisticsFinancialDto.ts +29 -0
  187. package/src/dto/event/EventStatisticsOrderTotalsDto.ts +48 -0
  188. package/src/dto/event/EventStatisticsOrdersDto.ts +30 -0
  189. package/src/dto/event/EventStatisticsScanTotalsDto.ts +38 -0
  190. package/src/dto/event/EventStatisticsScansDto.ts +40 -0
  191. package/src/dto/event/EventStatisticsScansPerAppTeamDto.ts +38 -0
  192. package/src/dto/event/EventStatisticsSwapTotalsDto.ts +38 -0
  193. package/src/dto/event/ShopDesignDto.ts +38 -0
  194. package/src/dto/event/ShopDto.ts +151 -0
  195. package/src/dto/event/ShopElementButtonDto.ts +41 -0
  196. package/src/dto/event/ShopElementDividerDto.ts +31 -0
  197. package/src/dto/event/ShopElementDto.ts +27 -0
  198. package/src/dto/event/ShopElementHeadingDto.ts +31 -0
  199. package/src/dto/event/ShopElementNoticeDto.ts +52 -0
  200. package/src/dto/event/ShopElementProductDto.ts +20 -0
  201. package/src/dto/event/ShopElementTextDto.ts +20 -0
  202. package/src/dto/event/StockOverviewDto.ts +49 -0
  203. package/src/dto/event/StockOverviewItemDto.ts +49 -0
  204. package/src/dto/event/StockPoolDto.ts +109 -0
  205. package/src/dto/event/TicketTemplateDto.ts +70 -0
  206. package/src/dto/event/index.ts +25 -0
  207. package/src/dto/fileSystem/PictureDto.ts +38 -0
  208. package/src/dto/fileSystem/index.ts +1 -0
  209. package/src/dto/finance/FinanceOverviewDto.ts +49 -0
  210. package/src/dto/finance/InvoiceDto.ts +101 -0
  211. package/src/dto/finance/InvoiceLineDto.ts +61 -0
  212. package/src/dto/finance/index.ts +3 -0
  213. package/src/dto/index.ts +14 -0
  214. package/src/dto/merchant/ContractDto.ts +60 -0
  215. package/src/dto/merchant/InvitationDto.ts +101 -0
  216. package/src/dto/merchant/MerchantDashboardKeyMetricsDto.ts +59 -0
  217. package/src/dto/merchant/MerchantDashboardUpcomingEventDto.ts +101 -0
  218. package/src/dto/merchant/MerchantDto.ts +140 -0
  219. package/src/dto/merchant/MerchantUserDto.ts +50 -0
  220. package/src/dto/merchant/VatNumberDto.ts +79 -0
  221. package/src/dto/merchant/index.ts +7 -0
  222. package/src/dto/order/BuyerDto.ts +111 -0
  223. package/src/dto/order/OrderDto.ts +161 -0
  224. package/src/dto/order/OrderLineDto.ts +80 -0
  225. package/src/dto/order/OrderPaymentProviderDto.ts +28 -0
  226. package/src/dto/order/OrderProductDto.ts +48 -0
  227. package/src/dto/order/index.ts +5 -0
  228. package/src/dto/payment/CostDto.ts +68 -0
  229. package/src/dto/payment/PaymentMethodDto.ts +38 -0
  230. package/src/dto/payment/PaymentProviderDto.ts +40 -0
  231. package/src/dto/payment/TransactionDto.ts +100 -0
  232. package/src/dto/payment/index.ts +4 -0
  233. package/src/dto/product/ProductDto.ts +130 -0
  234. package/src/dto/product/index.ts +1 -0
  235. package/src/dto/publicPay/PublicPaymentMethodDto.ts +38 -0
  236. package/src/dto/publicPay/index.ts +1 -0
  237. package/src/dto/publicShop/PublicShopCartProductDto.ts +38 -0
  238. package/src/dto/publicShop/PublicShopDesignDto.ts +38 -0
  239. package/src/dto/publicShop/PublicShopDto.ts +131 -0
  240. package/src/dto/publicShop/PublicShopElementButtonDto.ts +41 -0
  241. package/src/dto/publicShop/PublicShopElementDividerDto.ts +31 -0
  242. package/src/dto/publicShop/PublicShopElementDto.ts +27 -0
  243. package/src/dto/publicShop/PublicShopElementHeadingDto.ts +31 -0
  244. package/src/dto/publicShop/PublicShopElementNoticeDto.ts +52 -0
  245. package/src/dto/publicShop/PublicShopElementProductDto.ts +20 -0
  246. package/src/dto/publicShop/PublicShopElementTextDto.ts +20 -0
  247. package/src/dto/publicShop/PublicShopEventDto.ts +60 -0
  248. package/src/dto/publicShop/PublicShopMerchantDto.ts +28 -0
  249. package/src/dto/publicShop/PublicShopProductDto.ts +120 -0
  250. package/src/dto/publicShop/PublicShopReservationDto.ts +50 -0
  251. package/src/dto/publicShop/PublicShopReservationProductDetailsDto.ts +49 -0
  252. package/src/dto/publicShop/PublicShopReservationProductDto.ts +29 -0
  253. package/src/dto/publicShop/PublicShopTimeSlotDto.ts +59 -0
  254. package/src/dto/publicShop/index.ts +17 -0
  255. package/src/dto/reservation/ReservationDto.ts +60 -0
  256. package/src/dto/reservation/ReservationItemDto.ts +29 -0
  257. package/src/dto/reservation/ReservationProductDto.ts +49 -0
  258. package/src/dto/reservation/index.ts +3 -0
  259. package/src/dto/ticket/TicketDto.ts +131 -0
  260. package/src/dto/ticket/index.ts +1 -0
  261. package/src/index.ts +5 -0
  262. package/src/service/AuthService.ts +71 -0
  263. package/src/service/InvitationService.ts +35 -0
  264. package/src/service/MeService.ts +106 -0
  265. package/src/service/MerchantBuyerService.ts +37 -0
  266. package/src/service/MerchantBuyersService.ts +17 -0
  267. package/src/service/MerchantDashboardService.ts +23 -0
  268. package/src/service/MerchantEventProductService.ts +76 -0
  269. package/src/service/MerchantEventProductsService.ts +48 -0
  270. package/src/service/MerchantEventService.ts +115 -0
  271. package/src/service/MerchantEventShopService.ts +66 -0
  272. package/src/service/MerchantEventShopsService.ts +43 -0
  273. package/src/service/MerchantEventStatisticsService.ts +65 -0
  274. package/src/service/MerchantEventStockPoolsService.ts +54 -0
  275. package/src/service/MerchantEventTicketTemplateService.ts +75 -0
  276. package/src/service/MerchantEventTicketTemplatesService.ts +53 -0
  277. package/src/service/MerchantEventsService.ts +35 -0
  278. package/src/service/MerchantFinanceInvoiceService.ts +25 -0
  279. package/src/service/MerchantFinanceInvoicesService.ts +17 -0
  280. package/src/service/MerchantFinanceService.ts +36 -0
  281. package/src/service/MerchantOrderService.ts +55 -0
  282. package/src/service/MerchantOrdersService.ts +26 -0
  283. package/src/service/MerchantService.ts +117 -0
  284. package/src/service/MerchantStatisticsService.ts +14 -0
  285. package/src/service/MerchantTicketService.ts +35 -0
  286. package/src/service/MerchantTicketsService.ts +26 -0
  287. package/src/service/MerchantUsersService.ts +34 -0
  288. package/src/service/MerchantsService.ts +15 -0
  289. package/src/service/PublicOrderService.ts +35 -0
  290. package/src/service/PublicShopService.ts +49 -0
  291. package/src/service/ReservationService.ts +23 -0
  292. package/src/service/ServicesService.ts +18 -0
  293. package/src/service/UiSelectOptionsService.ts +33 -0
  294. package/src/service/index.ts +32 -0
  295. package/src/types/auth.ts +47 -0
  296. package/src/types/event.ts +28 -0
  297. package/src/types/finance.ts +14 -0
  298. package/src/types/general.ts +19 -0
  299. package/src/types/index.ts +9 -0
  300. package/src/types/order.ts +7 -0
  301. package/src/types/payment.ts +11 -0
  302. package/src/types/product.ts +2 -0
  303. package/src/types/publicShop.ts +7 -0
  304. package/src/types/ticket.ts +12 -0
  305. package/src/util/emptyNull.ts +9 -0
  306. package/src/util/index.ts +4 -0
  307. package/src/util/jsonBlob.ts +5 -0
  308. package/src/util/optional.ts +7 -0
  309. package/src/util/optionalArray.ts +7 -0
@@ -0,0 +1,149 @@
1
+ import { adapter } from '@basmilius/http-client';
2
+ import { AddressAdapter, DateTimeAdapter, FileSystemAdapter, PaymentAdapter } from '#data/adapter';
3
+ import { PublicShopDesignDto, PublicShopDto, PublicShopElementButtonDto, PublicShopElementDividerDto, PublicShopElementDto, PublicShopElementHeadingDto, PublicShopElementNoticeDto, PublicShopElementProductDto, PublicShopElementTextDto, PublicShopEventDto, PublicShopMerchantDto, PublicShopProductDto, PublicShopReservationDto, PublicShopReservationProductDetailsDto, PublicShopReservationProductDto, PublicShopTimeSlotDto } from '#data/dto';
4
+ import { optional, optionalArray } from '#data/util';
5
+
6
+ @adapter
7
+ export class PublicShopAdapter {
8
+ static parsePublicShopFromObject(shop: Record<string, any>): PublicShopDto {
9
+ return new PublicShopDto(
10
+ shop.id,
11
+ shop.name,
12
+ DateTimeAdapter.parseDateTimeFromString(shop.starts_on),
13
+ DateTimeAdapter.parseDateTimeFromString(shop.ends_on),
14
+ shop.field_address,
15
+ shop.field_birthdate,
16
+ shop.field_gender,
17
+ shop.field_phone_number,
18
+ optional(shop.design, PublicShopAdapter.parsePublicShopDesignFromObject),
19
+ optionalArray(shop.elements, PublicShopAdapter.parsePublicShopElementFromObject),
20
+ PublicShopAdapter.parsePublicShopEventFromObject(shop.event),
21
+ PublicShopAdapter.parsePublicShopMerchantFromObject(shop.merchant)
22
+ );
23
+ }
24
+
25
+ static parsePublicShopDesignFromObject(design: Record<string, any>): PublicShopDesignDto {
26
+ return new PublicShopDesignDto(
27
+ design.background_color,
28
+ design.foreground_color,
29
+ design.primary_color
30
+ );
31
+ }
32
+
33
+ static parsePublicShopElementFromObject(element: Record<string, any>): PublicShopElementDto {
34
+ switch (element.type) {
35
+ case 'button':
36
+ return new PublicShopElementButtonDto(
37
+ element.id,
38
+ element.icon,
39
+ element.text,
40
+ element.url
41
+ );
42
+
43
+ case 'divider':
44
+ return new PublicShopElementDividerDto(
45
+ element.id,
46
+ element.icon,
47
+ element.text
48
+ );
49
+
50
+ case 'heading':
51
+ return new PublicShopElementHeadingDto(
52
+ element.id,
53
+ element.heading_level,
54
+ element.title
55
+ );
56
+
57
+ case 'notice':
58
+ return new PublicShopElementNoticeDto(
59
+ element.id,
60
+ element.icon,
61
+ element.notice_type,
62
+ element.title,
63
+ element.text
64
+ );
65
+
66
+ case 'product':
67
+ return new PublicShopElementProductDto(
68
+ element.id,
69
+ PublicShopAdapter.parsePublicShopProductFromObject(element.product)
70
+ );
71
+
72
+ case 'text':
73
+ return new PublicShopElementTextDto(
74
+ element.id,
75
+ element.text
76
+ );
77
+ }
78
+
79
+ throw new Error('Unknown shop element.');
80
+ }
81
+
82
+ static parsePublicShopEventFromObject(event: Record<string, any>): PublicShopEventDto {
83
+ return new PublicShopEventDto(
84
+ event.id,
85
+ event.name,
86
+ event.status,
87
+ AddressAdapter.parseAddressFromObject(event.address),
88
+ optional(event.header_file, FileSystemAdapter.parsePictureFromObject)
89
+ );
90
+ }
91
+
92
+ static parsePublicShopMerchantFromObject(merchant: Record<string, any>): PublicShopMerchantDto {
93
+ return new PublicShopMerchantDto(
94
+ merchant.id,
95
+ merchant.name
96
+ );
97
+ }
98
+
99
+ static parsePublicShopProductFromObject(product: Record<string, any>): PublicShopProductDto {
100
+ return new PublicShopProductDto(
101
+ product.id,
102
+ product.type,
103
+ product.name,
104
+ product.description,
105
+ PaymentAdapter.parseCostFromObject(product.price),
106
+ product.max_quantity,
107
+ product.is_active,
108
+ product.is_timeslotted,
109
+ optionalArray(product.time_slots, PublicShopAdapter.parsePublicShopTimeSlotFromObject)!,
110
+ optional(product.image, FileSystemAdapter.parsePictureFromObject),
111
+ optionalArray(product.images, FileSystemAdapter.parsePictureFromObject)!
112
+ );
113
+ }
114
+
115
+ static parsePublicShopReservationFromObject(reservation: Record<string, any>): PublicShopReservationDto {
116
+ return new PublicShopReservationDto(
117
+ reservation.id,
118
+ DateTimeAdapter.parseDateTimeFromString(reservation.created_on),
119
+ DateTimeAdapter.parseDateTimeFromString(reservation.expires_on),
120
+ reservation.products.map(PublicShopAdapter.parsePublicShopReservationProductFromObject)
121
+ );
122
+ }
123
+
124
+ static parsePublicShopReservationProductFromObject(product: Record<string, any>): PublicShopReservationProductDto {
125
+ return new PublicShopReservationProductDto(
126
+ PublicShopAdapter.parsePublicShopReservationProductDetailsFromObject(product.product),
127
+ product.quantity
128
+ );
129
+ }
130
+
131
+ static parsePublicShopReservationProductDetailsFromObject(details: Record<string, any>): PublicShopReservationProductDetailsDto {
132
+ return new PublicShopReservationProductDetailsDto(
133
+ details.id,
134
+ details.name,
135
+ details.description,
136
+ optional(details.image, FileSystemAdapter.parsePictureFromObject)
137
+ );
138
+ }
139
+
140
+ static parsePublicShopTimeSlotFromObject(timeSlot: Record<string, any>): PublicShopTimeSlotDto {
141
+ return new PublicShopTimeSlotDto(
142
+ timeSlot.id,
143
+ timeSlot.label,
144
+ DateTimeAdapter.parseDateTimeFromString(timeSlot.from_time),
145
+ DateTimeAdapter.parseDateTimeFromString(timeSlot.to_time),
146
+ timeSlot.max_quantity
147
+ );
148
+ }
149
+ }
@@ -0,0 +1,33 @@
1
+ import { adapter } from '@basmilius/http-client';
2
+ import { DateTimeAdapter, FileSystemAdapter } from '#data/adapter';
3
+ import { ReservationDto, ReservationItemDto, ReservationProductDto } from '#data/dto';
4
+ import { optional, optionalArray } from '#data/util';
5
+
6
+ @adapter
7
+ export class ReservationAdapter {
8
+ static parseReservationFromObject(reservation: Record<string, any>): ReservationDto {
9
+ return new ReservationDto(
10
+ reservation.id,
11
+ DateTimeAdapter.parseDateTimeFromString(reservation.created_on),
12
+ DateTimeAdapter.parseDateTimeFromString(reservation.expires_on),
13
+ reservation.is_expired,
14
+ optionalArray(reservation.products, ReservationAdapter.parseReservationItemFromObject)!
15
+ );
16
+ }
17
+
18
+ static parseReservationItemFromObject(item: Record<string, any>): ReservationItemDto {
19
+ return new ReservationItemDto(
20
+ item.quantity,
21
+ ReservationAdapter.parseReservationProductFromObject(item.product)
22
+ );
23
+ }
24
+
25
+ static parseReservationProductFromObject(product: Record<string, any>): ReservationProductDto {
26
+ return new ReservationProductDto(
27
+ product.id,
28
+ product.name,
29
+ product.description,
30
+ optional(product.image, FileSystemAdapter.parsePictureFromObject)
31
+ );
32
+ }
33
+ }
@@ -0,0 +1,24 @@
1
+ import { adapter } from '@basmilius/http-client';
2
+ import { BuyerAdapter, DateTimeAdapter, EventAdapter, OrderAdapter, ProductAdapter } from '#data/adapter';
3
+ import { TicketDto } from '#data/dto';
4
+ import { optional } from '#data/util';
5
+
6
+ @adapter
7
+ export class TicketAdapter {
8
+ static parseTicketFromObject(ticket: Record<string, any>): TicketDto {
9
+ return new TicketDto(
10
+ ticket.id,
11
+ ticket.sequence,
12
+ ticket.code,
13
+ ticket.status,
14
+ ticket.validity,
15
+ optional(ticket.buyer, BuyerAdapter.parseBuyerFromObject)!,
16
+ optional(ticket.event, EventAdapter.parseEventFromObject)!,
17
+ optional(ticket.holder, BuyerAdapter.parseBuyerFromObject)!,
18
+ optional(ticket.order, OrderAdapter.parseOrderFromObject)!,
19
+ optional(ticket.product, ProductAdapter.parseProductFromObject)!,
20
+ DateTimeAdapter.parseDateTimeFromString(ticket.created_on),
21
+ DateTimeAdapter.parseDateTimeFromString(ticket.updated_on)
22
+ );
23
+ }
24
+ }
@@ -0,0 +1,18 @@
1
+ export * from './AddressAdapter';
2
+ export * from './AuthAdapter';
3
+ export * from './BuyerAdapter';
4
+ export * from './CommonAdapter';
5
+ export * from './DateTimeAdapter';
6
+ export * from './EventAdapter';
7
+ export * from './FileSystemAdapter';
8
+ export * from './FinanceAdapter';
9
+ export * from './FluxAdapter';
10
+ export * from './MerchantAdapter';
11
+ export * from './MerchantDashboardAdapter';
12
+ export * from './OrderAdapter';
13
+ export * from './PaymentAdapter';
14
+ export * from './ProductAdapter';
15
+ export * from './PublicPayAdapter';
16
+ export * from './PublicShopAdapter';
17
+ export * from './ReservationAdapter';
18
+ export * from './TicketAdapter';
@@ -0,0 +1,88 @@
1
+ import { dto } from '@basmilius/http-client';
2
+
3
+ @dto
4
+ export class AddressDto {
5
+ get id(): string {
6
+ return this.#id;
7
+ }
8
+
9
+ set id(value: string) {
10
+ this.#id = value;
11
+ }
12
+
13
+ get label(): string | null {
14
+ return this.#label;
15
+ }
16
+
17
+ set label(value: string | null) {
18
+ this.#label = value;
19
+ }
20
+
21
+ get street(): string {
22
+ return this.#street;
23
+ }
24
+
25
+ set street(value: string) {
26
+ this.#street = value;
27
+ }
28
+
29
+ get number(): string {
30
+ return this.#number;
31
+ }
32
+
33
+ set number(value: string) {
34
+ this.#number = value;
35
+ }
36
+
37
+ get postalCode(): string {
38
+ return this.#postalCode;
39
+ }
40
+
41
+ set postalCode(value: string) {
42
+ this.#postalCode = value;
43
+ }
44
+
45
+ get city(): string {
46
+ return this.#city;
47
+ }
48
+
49
+ set city(value: string) {
50
+ this.#city = value;
51
+ }
52
+
53
+ get country(): string {
54
+ return this.#country;
55
+ }
56
+
57
+ set country(value: string) {
58
+ this.#country = value;
59
+ }
60
+
61
+ get formatted(): string {
62
+ return this.#formatted;
63
+ }
64
+
65
+ set formatted(value: string) {
66
+ this.#formatted = value;
67
+ }
68
+
69
+ #id: string;
70
+ #label: string | null;
71
+ #street: string;
72
+ #number: string;
73
+ #postalCode: string;
74
+ #city: string;
75
+ #country: string;
76
+ #formatted: string;
77
+
78
+ constructor(id: string, label: string | null, street: string, number: string, postalCode: string, city: string, country: string, formatted: string) {
79
+ this.#id = id;
80
+ this.#label = label;
81
+ this.#street = street;
82
+ this.#number = number;
83
+ this.#postalCode = postalCode;
84
+ this.#city = city;
85
+ this.#country = country;
86
+ this.#formatted = formatted;
87
+ }
88
+ }
@@ -0,0 +1 @@
1
+ export * from './AddressDto';
@@ -0,0 +1,38 @@
1
+ import { dto } from '@basmilius/http-client';
2
+
3
+ @dto
4
+ export class TotpStateDto {
5
+ get enabled(): boolean {
6
+ return this.#enabled;
7
+ }
8
+
9
+ set enabled(value: boolean) {
10
+ this.#enabled = value;
11
+ }
12
+
13
+ get secret(): string | null {
14
+ return this.#secret;
15
+ }
16
+
17
+ set secret(value: string | null) {
18
+ this.#secret = value;
19
+ }
20
+
21
+ get qr(): string | null {
22
+ return this.#qr;
23
+ }
24
+
25
+ set qr(value: string | null) {
26
+ this.#qr = value;
27
+ }
28
+
29
+ #enabled: boolean;
30
+ #secret: string | null;
31
+ #qr: string | null;
32
+
33
+ constructor(enabled: boolean, secret: string | null, qr: string | null) {
34
+ this.#enabled = enabled;
35
+ this.#secret = secret;
36
+ this.#qr = qr;
37
+ }
38
+ }
@@ -0,0 +1,99 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { PictureDto } from '#data/dto';
3
+
4
+ @dto
5
+ export class UserDto {
6
+ get id(): string {
7
+ return this.#id;
8
+ }
9
+
10
+ set id(value: string) {
11
+ this.#id = value;
12
+ }
13
+
14
+ get email(): string {
15
+ return this.#email;
16
+ }
17
+
18
+ set email(value: string) {
19
+ this.#email = value;
20
+ }
21
+
22
+ get firstName(): string {
23
+ return this.#firstName;
24
+ }
25
+
26
+ set firstName(value: string) {
27
+ this.#firstName = value;
28
+ }
29
+
30
+ get lastName(): string {
31
+ return this.#lastName;
32
+ }
33
+
34
+ set lastName(value: string) {
35
+ this.#lastName = value;
36
+ }
37
+
38
+ get fullName(): string {
39
+ return this.#fullName;
40
+ }
41
+
42
+ set fullName(value: string) {
43
+ this.#fullName = value;
44
+ }
45
+
46
+ get initials(): string {
47
+ return this.#initials;
48
+ }
49
+
50
+ set initials(value: string) {
51
+ this.#initials = value;
52
+ }
53
+
54
+ get phoneNumber(): string | null {
55
+ return this.#phoneNumber;
56
+ }
57
+
58
+ set phoneNumber(value: string | null) {
59
+ this.#phoneNumber = value;
60
+ }
61
+
62
+ get isOnline(): boolean {
63
+ return this.#isOnline;
64
+ }
65
+
66
+ set isOnline(value: boolean) {
67
+ this.#isOnline = value;
68
+ }
69
+
70
+ get picture(): PictureDto | null {
71
+ return this.#picture;
72
+ }
73
+
74
+ set picture(value: PictureDto | null) {
75
+ this.#picture = value;
76
+ }
77
+
78
+ #id: string;
79
+ #email: string;
80
+ #firstName: string;
81
+ #lastName: string;
82
+ #fullName: string;
83
+ #initials: string;
84
+ #phoneNumber: string | null;
85
+ #isOnline: boolean;
86
+ #picture: PictureDto | null;
87
+
88
+ constructor(id: string, email: string, firstName: string, lastName: string, fullName: string, initials: string, phoneNumber: string | null, isOnline: boolean, picture: PictureDto | null) {
89
+ this.#id = id;
90
+ this.#email = email;
91
+ this.#firstName = firstName;
92
+ this.#lastName = lastName;
93
+ this.#fullName = fullName;
94
+ this.#initials = initials;
95
+ this.#phoneNumber = phoneNumber;
96
+ this.#isOnline = isOnline;
97
+ this.#picture = picture;
98
+ }
99
+ }
@@ -0,0 +1,91 @@
1
+ import { dto } from '@basmilius/http-client';
2
+ import type { DateTime } from 'luxon';
3
+ import type { UserDto } from '#data/dto';
4
+ import type { BrowserType, OperatingSystemType, UserTokenType } from '#data/types';
5
+
6
+ @dto
7
+ export class UserTokenDto {
8
+ get token(): string {
9
+ return this.#token;
10
+ }
11
+
12
+ set token(value: string) {
13
+ this.#token = value;
14
+ }
15
+
16
+ get type(): UserTokenType {
17
+ return this.#type;
18
+ }
19
+
20
+ set type(value: UserTokenType) {
21
+ this.#type = value;
22
+ }
23
+
24
+ get browser(): BrowserType | null {
25
+ return this.#browser;
26
+ }
27
+
28
+ set browser(value: BrowserType | null) {
29
+ this.#browser = value;
30
+ }
31
+
32
+ get operatingSystem(): OperatingSystemType | null {
33
+ return this.#operatingSystem;
34
+ }
35
+
36
+ set operatingSystem(value: OperatingSystemType | null) {
37
+ this.#operatingSystem = value;
38
+ }
39
+
40
+ get createdOn(): DateTime {
41
+ return this.#createdOn;
42
+ }
43
+
44
+ set createdOn(value: DateTime) {
45
+ this.#createdOn = value;
46
+ }
47
+
48
+ get expiresOn(): DateTime {
49
+ return this.#expiresOn;
50
+ }
51
+
52
+ set expiresOn(value: DateTime) {
53
+ this.#expiresOn = value;
54
+ }
55
+
56
+ get realtimeChannel(): string | null {
57
+ return this.#realtimeChannel;
58
+ }
59
+
60
+ set realtimeChannel(value: string | null) {
61
+ this.#realtimeChannel = value;
62
+ }
63
+
64
+ get user(): UserDto {
65
+ return this.#user;
66
+ }
67
+
68
+ set user(value: UserDto) {
69
+ this.#user = value;
70
+ }
71
+
72
+ #token: string;
73
+ #type: UserTokenType;
74
+ #browser: BrowserType | null;
75
+ #operatingSystem: OperatingSystemType | null;
76
+ #createdOn: DateTime;
77
+ #expiresOn: DateTime;
78
+ #realtimeChannel: string | null;
79
+ #user: UserDto;
80
+
81
+ constructor(token: string, type: UserTokenType, browser: BrowserType | null, operatingSystem: OperatingSystemType | null, createdOn: DateTime, expiresOn: DateTime, realtimeChannel: string | null, user: UserDto) {
82
+ this.#token = token;
83
+ this.#type = type;
84
+ this.#browser = browser;
85
+ this.#operatingSystem = operatingSystem;
86
+ this.#createdOn = createdOn;
87
+ this.#expiresOn = expiresOn;
88
+ this.#realtimeChannel = realtimeChannel;
89
+ this.#user = user;
90
+ }
91
+ }
@@ -0,0 +1,3 @@
1
+ export * from './TotpStateDto';
2
+ export * from './UserDto';
3
+ export * from './UserTokenDto';
@@ -0,0 +1,28 @@
1
+ import { dto } from '@basmilius/http-client';
2
+
3
+ @dto
4
+ export class StatusResponseDto {
5
+ get message(): string | null {
6
+ return this.#message;
7
+ }
8
+
9
+ set message(value: string | null) {
10
+ this.#message = value;
11
+ }
12
+
13
+ get status(): 'ok' | 'fail' {
14
+ return this.#status;
15
+ }
16
+
17
+ set status(value: 'ok' | 'fail') {
18
+ this.#status = value;
19
+ }
20
+
21
+ #message: string | null;
22
+ #status: 'ok' | 'fail';
23
+
24
+ constructor(message: string | null, status: 'ok' | 'fail') {
25
+ this.#message = message;
26
+ this.#status = status;
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export * from './StatusResponseDto';
@@ -0,0 +1,58 @@
1
+ import { dto } from '@basmilius/http-client';
2
+
3
+ @dto
4
+ export class EventAvailabilityDto {
5
+ get hasProducts(): boolean {
6
+ return this.#hasProducts;
7
+ }
8
+
9
+ set hasProducts(value: boolean) {
10
+ this.#hasProducts = value;
11
+ }
12
+
13
+ get hasShops(): boolean {
14
+ return this.#hasShops;
15
+ }
16
+
17
+ set hasShops(value: boolean) {
18
+ this.#hasShops = value;
19
+ }
20
+
21
+ get hasShopsWithProducts(): boolean {
22
+ return this.#hasShopsWithProducts;
23
+ }
24
+
25
+ set hasShopsWithProducts(value: boolean) {
26
+ this.#hasShopsWithProducts = value;
27
+ }
28
+
29
+ get isPublishable(): boolean {
30
+ return this.#isPublishable;
31
+ }
32
+
33
+ set isPublishable(value: boolean) {
34
+ this.#isPublishable = value;
35
+ }
36
+
37
+ get isPublished(): boolean {
38
+ return this.#isPublished;
39
+ }
40
+
41
+ set isPublished(value: boolean) {
42
+ this.#isPublished = value;
43
+ }
44
+
45
+ #hasProducts: boolean;
46
+ #hasShops: boolean;
47
+ #hasShopsWithProducts: boolean;
48
+ #isPublishable: boolean;
49
+ #isPublished: boolean;
50
+
51
+ constructor(hasProducts: boolean, hasShops: boolean, hasShopsWithProducts: boolean, isPublishable: boolean, isPublished: boolean) {
52
+ this.#hasProducts = hasProducts;
53
+ this.#hasShops = hasShops;
54
+ this.#hasShopsWithProducts = hasShopsWithProducts;
55
+ this.#isPublishable = isPublishable;
56
+ this.#isPublished = isPublished;
57
+ }
58
+ }
@@ -0,0 +1,38 @@
1
+ import { dto } from '@basmilius/http-client';
2
+
3
+ @dto
4
+ export class EventCountersDto {
5
+ get guests(): number {
6
+ return this.#guests;
7
+ }
8
+
9
+ set guests(value: number) {
10
+ this.#guests = value;
11
+ }
12
+
13
+ get orders(): number {
14
+ return this.#orders;
15
+ }
16
+
17
+ set orders(value: number) {
18
+ this.#orders = value;
19
+ }
20
+
21
+ get tickets(): number {
22
+ return this.#tickets;
23
+ }
24
+
25
+ set tickets(value: number) {
26
+ this.#tickets = value;
27
+ }
28
+
29
+ #guests: number;
30
+ #orders: number;
31
+ #tickets: number;
32
+
33
+ constructor(guests: number, orders: number, tickets: number) {
34
+ this.#guests = guests;
35
+ this.#orders = orders;
36
+ this.#tickets = tickets;
37
+ }
38
+ }