@frigear-nu/shifts 0.0.0-stage → 0.0.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 (341) hide show
  1. package/README.md +53 -2
  2. package/dist/module.d.mts +709 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +253 -0
  5. package/dist/runtime/access.d.ts +2 -0
  6. package/dist/runtime/access.js +84 -0
  7. package/dist/runtime/app/components/ShiftBroadcastSlideover.d.vue.ts +19 -0
  8. package/dist/runtime/app/components/ShiftBroadcastSlideover.vue +142 -0
  9. package/dist/runtime/app/components/ShiftBroadcastSlideover.vue.d.ts +19 -0
  10. package/dist/runtime/app/components/ShiftBroadcastsCard.d.vue.ts +9 -0
  11. package/dist/runtime/app/components/ShiftBroadcastsCard.vue +74 -0
  12. package/dist/runtime/app/components/ShiftBroadcastsCard.vue.d.ts +9 -0
  13. package/dist/runtime/app/components/ShiftBulkSlideover.d.vue.ts +15 -0
  14. package/dist/runtime/app/components/ShiftBulkSlideover.vue +185 -0
  15. package/dist/runtime/app/components/ShiftBulkSlideover.vue.d.ts +15 -0
  16. package/dist/runtime/app/components/ShiftCheckInCard.d.vue.ts +13 -0
  17. package/dist/runtime/app/components/ShiftCheckInCard.vue +238 -0
  18. package/dist/runtime/app/components/ShiftCheckInCard.vue.d.ts +13 -0
  19. package/dist/runtime/app/components/ShiftCopySlideover.d.vue.ts +11 -0
  20. package/dist/runtime/app/components/ShiftCopySlideover.vue +71 -0
  21. package/dist/runtime/app/components/ShiftCopySlideover.vue.d.ts +11 -0
  22. package/dist/runtime/app/components/ShiftDayView.d.vue.ts +16 -0
  23. package/dist/runtime/app/components/ShiftDayView.vue +124 -0
  24. package/dist/runtime/app/components/ShiftDayView.vue.d.ts +16 -0
  25. package/dist/runtime/app/components/ShiftFeedSlideover.d.vue.ts +7 -0
  26. package/dist/runtime/app/components/ShiftFeedSlideover.vue +172 -0
  27. package/dist/runtime/app/components/ShiftFeedSlideover.vue.d.ts +7 -0
  28. package/dist/runtime/app/components/ShiftNowCard.d.vue.ts +6 -0
  29. package/dist/runtime/app/components/ShiftNowCard.vue +83 -0
  30. package/dist/runtime/app/components/ShiftNowCard.vue.d.ts +6 -0
  31. package/dist/runtime/app/components/ShiftPassFullscreen.d.vue.ts +13 -0
  32. package/dist/runtime/app/components/ShiftPassFullscreen.vue +79 -0
  33. package/dist/runtime/app/components/ShiftPassFullscreen.vue.d.ts +13 -0
  34. package/dist/runtime/app/components/ShiftPerkSlideover.d.vue.ts +14 -0
  35. package/dist/runtime/app/components/ShiftPerkSlideover.vue +103 -0
  36. package/dist/runtime/app/components/ShiftPerkSlideover.vue.d.ts +14 -0
  37. package/dist/runtime/app/components/ShiftPerksCard.d.vue.ts +8 -0
  38. package/dist/runtime/app/components/ShiftPerksCard.vue +66 -0
  39. package/dist/runtime/app/components/ShiftPerksCard.vue.d.ts +8 -0
  40. package/dist/runtime/app/components/ShiftQrScanner.d.vue.ts +10 -0
  41. package/dist/runtime/app/components/ShiftQrScanner.vue +44 -0
  42. package/dist/runtime/app/components/ShiftQrScanner.vue.d.ts +10 -0
  43. package/dist/runtime/app/components/ShiftRoleSlideover.d.vue.ts +15 -0
  44. package/dist/runtime/app/components/ShiftRoleSlideover.vue +88 -0
  45. package/dist/runtime/app/components/ShiftRoleSlideover.vue.d.ts +15 -0
  46. package/dist/runtime/app/components/ShiftScheduleSettingsFields.d.vue.ts +11 -0
  47. package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue +61 -0
  48. package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue.d.ts +11 -0
  49. package/dist/runtime/app/components/ShiftScheduleSlideover.d.vue.ts +12 -0
  50. package/dist/runtime/app/components/ShiftScheduleSlideover.vue +129 -0
  51. package/dist/runtime/app/components/ShiftScheduleSlideover.vue.d.ts +12 -0
  52. package/dist/runtime/app/components/ShiftSlideover.d.vue.ts +13 -0
  53. package/dist/runtime/app/components/ShiftSlideover.vue +353 -0
  54. package/dist/runtime/app/components/ShiftSlideover.vue.d.ts +13 -0
  55. package/dist/runtime/app/components/ShiftStationSlideover.d.vue.ts +15 -0
  56. package/dist/runtime/app/components/ShiftStationSlideover.vue +92 -0
  57. package/dist/runtime/app/components/ShiftStationSlideover.vue.d.ts +15 -0
  58. package/dist/runtime/app/composables/index.d.ts +6 -0
  59. package/dist/runtime/app/composables/index.js +5 -0
  60. package/dist/runtime/app/composables/useShiftsActions.d.ts +61 -0
  61. package/dist/runtime/app/composables/useShiftsActions.js +224 -0
  62. package/dist/runtime/app/composables/useShiftsFormat.d.ts +12 -0
  63. package/dist/runtime/app/composables/useShiftsFormat.js +14 -0
  64. package/dist/runtime/app/composables/useShiftsLinks.d.ts +12 -0
  65. package/dist/runtime/app/composables/useShiftsLinks.js +6 -0
  66. package/dist/runtime/app/composables/useShiftsTranslate.d.ts +5 -0
  67. package/dist/runtime/app/composables/useShiftsTranslate.js +12 -0
  68. package/dist/runtime/app/composables/useShiftsVenueFeatures.d.ts +17 -0
  69. package/dist/runtime/app/composables/useShiftsVenueFeatures.js +18 -0
  70. package/dist/runtime/app/dashboard/NextShift.d.vue.ts +3 -0
  71. package/dist/runtime/app/dashboard/NextShift.vue +69 -0
  72. package/dist/runtime/app/dashboard/NextShift.vue.d.ts +3 -0
  73. package/dist/runtime/app/dashboard/OpenSwaps.d.vue.ts +3 -0
  74. package/dist/runtime/app/dashboard/OpenSwaps.vue +69 -0
  75. package/dist/runtime/app/dashboard/OpenSwaps.vue.d.ts +3 -0
  76. package/dist/runtime/app/dashboard/TeamOnNow.d.vue.ts +3 -0
  77. package/dist/runtime/app/dashboard/TeamOnNow.vue +72 -0
  78. package/dist/runtime/app/dashboard/TeamOnNow.vue.d.ts +3 -0
  79. package/dist/runtime/app/pages/check-in.d.vue.ts +3 -0
  80. package/dist/runtime/app/pages/check-in.vue +93 -0
  81. package/dist/runtime/app/pages/check-in.vue.d.ts +3 -0
  82. package/dist/runtime/app/pages/lead.d.vue.ts +3 -0
  83. package/dist/runtime/app/pages/lead.vue +300 -0
  84. package/dist/runtime/app/pages/lead.vue.d.ts +3 -0
  85. package/dist/runtime/app/pages/shift.d.vue.ts +3 -0
  86. package/dist/runtime/app/pages/shift.vue +482 -0
  87. package/dist/runtime/app/pages/shift.vue.d.ts +3 -0
  88. package/dist/runtime/app/pages/shifts.d.vue.ts +3 -0
  89. package/dist/runtime/app/pages/shifts.vue +169 -0
  90. package/dist/runtime/app/pages/shifts.vue.d.ts +3 -0
  91. package/dist/runtime/app/pages/station.d.vue.ts +3 -0
  92. package/dist/runtime/app/pages/station.vue +104 -0
  93. package/dist/runtime/app/pages/station.vue.d.ts +3 -0
  94. package/dist/runtime/app/pages/swaps.d.vue.ts +3 -0
  95. package/dist/runtime/app/pages/swaps.vue +192 -0
  96. package/dist/runtime/app/pages/swaps.vue.d.ts +3 -0
  97. package/dist/runtime/app/tabs/Shifts.d.vue.ts +9 -0
  98. package/dist/runtime/app/tabs/Shifts.vue +487 -0
  99. package/dist/runtime/app/tabs/Shifts.vue.d.ts +9 -0
  100. package/dist/runtime/app/utils/admin-shifts.d.ts +42 -0
  101. package/dist/runtime/app/utils/admin-shifts.js +36 -0
  102. package/dist/runtime/dashboard.d.ts +8 -0
  103. package/dist/runtime/dashboard.js +30 -0
  104. package/dist/runtime/emails/shifts-broadcast.d.vue.ts +8 -0
  105. package/dist/runtime/emails/shifts-broadcast.vue +24 -0
  106. package/dist/runtime/emails/shifts-broadcast.vue.d.ts +8 -0
  107. package/dist/runtime/emails/shifts-reminder.d.vue.ts +12 -0
  108. package/dist/runtime/emails/shifts-reminder.vue +34 -0
  109. package/dist/runtime/emails/shifts-reminder.vue.d.ts +12 -0
  110. package/dist/runtime/emails/shifts-swap-accepted.d.vue.ts +11 -0
  111. package/dist/runtime/emails/shifts-swap-accepted.vue +32 -0
  112. package/dist/runtime/emails/shifts-swap-accepted.vue.d.ts +11 -0
  113. package/dist/runtime/emails/shifts-swap-completed.d.vue.ts +11 -0
  114. package/dist/runtime/emails/shifts-swap-completed.vue +32 -0
  115. package/dist/runtime/emails/shifts-swap-completed.vue.d.ts +11 -0
  116. package/dist/runtime/emails/shifts-swap-offered.d.vue.ts +11 -0
  117. package/dist/runtime/emails/shifts-swap-offered.vue +32 -0
  118. package/dist/runtime/emails/shifts-swap-offered.vue.d.ts +11 -0
  119. package/dist/runtime/emails/shifts-swap-pending.d.vue.ts +11 -0
  120. package/dist/runtime/emails/shifts-swap-pending.vue +32 -0
  121. package/dist/runtime/emails/shifts-swap-pending.vue.d.ts +11 -0
  122. package/dist/runtime/emails/shifts-swap-proposed.d.vue.ts +11 -0
  123. package/dist/runtime/emails/shifts-swap-proposed.vue +32 -0
  124. package/dist/runtime/emails/shifts-swap-proposed.vue.d.ts +11 -0
  125. package/dist/runtime/emails/shifts-swap-rejected.d.vue.ts +11 -0
  126. package/dist/runtime/emails/shifts-swap-rejected.vue +32 -0
  127. package/dist/runtime/emails/shifts-swap-rejected.vue.d.ts +11 -0
  128. package/dist/runtime/i18n/lang/da.json +626 -0
  129. package/dist/runtime/i18n/lang/en.json +626 -0
  130. package/dist/runtime/menus.d.ts +2 -0
  131. package/dist/runtime/menus.js +17 -0
  132. package/dist/runtime/notifications.d.ts +9 -0
  133. package/dist/runtime/notifications.js +36 -0
  134. package/dist/runtime/server/db/schema.postgresql.d.ts +2151 -0
  135. package/dist/runtime/server/db/schema.postgresql.js +228 -0
  136. package/dist/runtime/server/db/schema.sqlite.d.ts +2263 -0
  137. package/dist/runtime/server/db/schema.sqlite.js +228 -0
  138. package/dist/runtime/server/digest-email.d.ts +17 -0
  139. package/dist/runtime/server/digest-email.js +42 -0
  140. package/dist/runtime/server/plugins/station-key.d.ts +2 -0
  141. package/dist/runtime/server/plugins/station-key.js +5 -0
  142. package/dist/runtime/server/plugins/teams.d.ts +2 -0
  143. package/dist/runtime/server/plugins/teams.js +19 -0
  144. package/dist/runtime/server/policies.d.ts +2 -0
  145. package/dist/runtime/server/policies.js +41 -0
  146. package/dist/runtime/server/reminder-email.d.ts +67 -0
  147. package/dist/runtime/server/reminder-email.js +109 -0
  148. package/dist/runtime/server/routes/admin/assignment.delete.d.ts +2 -0
  149. package/dist/runtime/server/routes/admin/assignment.delete.js +10 -0
  150. package/dist/runtime/server/routes/admin/assignments.post.d.ts +2 -0
  151. package/dist/runtime/server/routes/admin/assignments.post.js +11 -0
  152. package/dist/runtime/server/routes/admin/broadcasts.get.d.ts +2 -0
  153. package/dist/runtime/server/routes/admin/broadcasts.get.js +8 -0
  154. package/dist/runtime/server/routes/admin/broadcasts.post.d.ts +2 -0
  155. package/dist/runtime/server/routes/admin/broadcasts.post.js +9 -0
  156. package/dist/runtime/server/routes/admin/candidates.get.d.ts +2 -0
  157. package/dist/runtime/server/routes/admin/candidates.get.js +10 -0
  158. package/dist/runtime/server/routes/admin/operation-teams.get.d.ts +2 -0
  159. package/dist/runtime/server/routes/admin/operation-teams.get.js +9 -0
  160. package/dist/runtime/server/routes/admin/perk.delete.d.ts +2 -0
  161. package/dist/runtime/server/routes/admin/perk.delete.js +10 -0
  162. package/dist/runtime/server/routes/admin/perk.patch.d.ts +2 -0
  163. package/dist/runtime/server/routes/admin/perk.patch.js +10 -0
  164. package/dist/runtime/server/routes/admin/perks.get.d.ts +2 -0
  165. package/dist/runtime/server/routes/admin/perks.get.js +9 -0
  166. package/dist/runtime/server/routes/admin/perks.post.d.ts +2 -0
  167. package/dist/runtime/server/routes/admin/perks.post.js +10 -0
  168. package/dist/runtime/server/routes/admin/role.delete.d.ts +2 -0
  169. package/dist/runtime/server/routes/admin/role.delete.js +11 -0
  170. package/dist/runtime/server/routes/admin/role.patch.d.ts +2 -0
  171. package/dist/runtime/server/routes/admin/role.patch.js +11 -0
  172. package/dist/runtime/server/routes/admin/roles.get.d.ts +2 -0
  173. package/dist/runtime/server/routes/admin/roles.get.js +9 -0
  174. package/dist/runtime/server/routes/admin/roles.post.d.ts +2 -0
  175. package/dist/runtime/server/routes/admin/roles.post.js +10 -0
  176. package/dist/runtime/server/routes/admin/schedule-copy.post.d.ts +2 -0
  177. package/dist/runtime/server/routes/admin/schedule-copy.post.js +12 -0
  178. package/dist/runtime/server/routes/admin/schedule-publish.post.d.ts +2 -0
  179. package/dist/runtime/server/routes/admin/schedule-publish.post.js +9 -0
  180. package/dist/runtime/server/routes/admin/schedule.delete.d.ts +2 -0
  181. package/dist/runtime/server/routes/admin/schedule.delete.js +10 -0
  182. package/dist/runtime/server/routes/admin/schedule.get.d.ts +2 -0
  183. package/dist/runtime/server/routes/admin/schedule.get.js +9 -0
  184. package/dist/runtime/server/routes/admin/schedule.patch.d.ts +2 -0
  185. package/dist/runtime/server/routes/admin/schedule.patch.js +10 -0
  186. package/dist/runtime/server/routes/admin/schedules.get.d.ts +2 -0
  187. package/dist/runtime/server/routes/admin/schedules.get.js +10 -0
  188. package/dist/runtime/server/routes/admin/schedules.post.d.ts +2 -0
  189. package/dist/runtime/server/routes/admin/schedules.post.js +9 -0
  190. package/dist/runtime/server/routes/admin/shift.delete.d.ts +2 -0
  191. package/dist/runtime/server/routes/admin/shift.delete.js +10 -0
  192. package/dist/runtime/server/routes/admin/shift.patch.d.ts +2 -0
  193. package/dist/runtime/server/routes/admin/shift.patch.js +10 -0
  194. package/dist/runtime/server/routes/admin/shifts-bulk.post.d.ts +2 -0
  195. package/dist/runtime/server/routes/admin/shifts-bulk.post.js +10 -0
  196. package/dist/runtime/server/routes/admin/shifts.get.d.ts +2 -0
  197. package/dist/runtime/server/routes/admin/shifts.get.js +10 -0
  198. package/dist/runtime/server/routes/admin/station.delete.d.ts +2 -0
  199. package/dist/runtime/server/routes/admin/station.delete.js +11 -0
  200. package/dist/runtime/server/routes/admin/station.patch.d.ts +2 -0
  201. package/dist/runtime/server/routes/admin/station.patch.js +11 -0
  202. package/dist/runtime/server/routes/admin/stations.get.d.ts +2 -0
  203. package/dist/runtime/server/routes/admin/stations.get.js +9 -0
  204. package/dist/runtime/server/routes/admin/stations.post.d.ts +2 -0
  205. package/dist/runtime/server/routes/admin/stations.post.js +10 -0
  206. package/dist/runtime/server/routes/admin/swap-cancel.post.d.ts +2 -0
  207. package/dist/runtime/server/routes/admin/swap-cancel.post.js +10 -0
  208. package/dist/runtime/server/routes/admin/swaps.get.d.ts +2 -0
  209. package/dist/runtime/server/routes/admin/swaps.get.js +10 -0
  210. package/dist/runtime/server/routes/feed/feed.get.d.ts +2 -0
  211. package/dist/runtime/server/routes/feed/feed.get.js +9 -0
  212. package/dist/runtime/server/routes/lead/attended.post.d.ts +2 -0
  213. package/dist/runtime/server/routes/lead/attended.post.js +11 -0
  214. package/dist/runtime/server/routes/lead/broadcast.post.d.ts +2 -0
  215. package/dist/runtime/server/routes/lead/broadcast.post.js +12 -0
  216. package/dist/runtime/server/routes/lead/check-in.post.d.ts +2 -0
  217. package/dist/runtime/server/routes/lead/check-in.post.js +9 -0
  218. package/dist/runtime/server/routes/lead/exceptions.get.d.ts +2 -0
  219. package/dist/runtime/server/routes/lead/exceptions.get.js +8 -0
  220. package/dist/runtime/server/routes/lead/no-show.post.d.ts +2 -0
  221. package/dist/runtime/server/routes/lead/no-show.post.js +11 -0
  222. package/dist/runtime/server/routes/lead/now.get.d.ts +2 -0
  223. package/dist/runtime/server/routes/lead/now.get.js +9 -0
  224. package/dist/runtime/server/routes/lead/on-duty.get.d.ts +2 -0
  225. package/dist/runtime/server/routes/lead/on-duty.get.js +10 -0
  226. package/dist/runtime/server/routes/lead/stations.get.d.ts +2 -0
  227. package/dist/runtime/server/routes/lead/stations.get.js +8 -0
  228. package/dist/runtime/server/routes/lead/team-shifts.get.d.ts +2 -0
  229. package/dist/runtime/server/routes/lead/team-shifts.get.js +9 -0
  230. package/dist/runtime/server/routes/lead/team-swaps.get.d.ts +2 -0
  231. package/dist/runtime/server/routes/lead/team-swaps.get.js +9 -0
  232. package/dist/runtime/server/routes/me/check-in.post.d.ts +2 -0
  233. package/dist/runtime/server/routes/me/check-in.post.js +11 -0
  234. package/dist/runtime/server/routes/me/earned-perk-claim.post.d.ts +2 -0
  235. package/dist/runtime/server/routes/me/earned-perk-claim.post.js +10 -0
  236. package/dist/runtime/server/routes/me/earned-perks.get.d.ts +2 -0
  237. package/dist/runtime/server/routes/me/earned-perks.get.js +9 -0
  238. package/dist/runtime/server/routes/me/feed-token.delete.d.ts +2 -0
  239. package/dist/runtime/server/routes/me/feed-token.delete.js +7 -0
  240. package/dist/runtime/server/routes/me/feed-token.get.d.ts +2 -0
  241. package/dist/runtime/server/routes/me/feed-token.get.js +6 -0
  242. package/dist/runtime/server/routes/me/feed-token.post.d.ts +2 -0
  243. package/dist/runtime/server/routes/me/feed-token.post.js +7 -0
  244. package/dist/runtime/server/routes/me/leads.get.d.ts +2 -0
  245. package/dist/runtime/server/routes/me/leads.get.js +5 -0
  246. package/dist/runtime/server/routes/me/now.get.d.ts +2 -0
  247. package/dist/runtime/server/routes/me/now.get.js +5 -0
  248. package/dist/runtime/server/routes/me/pass.get.d.ts +2 -0
  249. package/dist/runtime/server/routes/me/pass.get.js +11 -0
  250. package/dist/runtime/server/routes/me/settle.post.d.ts +2 -0
  251. package/dist/runtime/server/routes/me/settle.post.js +14 -0
  252. package/dist/runtime/server/routes/me/shift.get.d.ts +2 -0
  253. package/dist/runtime/server/routes/me/shift.get.js +10 -0
  254. package/dist/runtime/server/routes/me/shifts.get.d.ts +2 -0
  255. package/dist/runtime/server/routes/me/shifts.get.js +6 -0
  256. package/dist/runtime/server/routes/me/swap.delete.d.ts +2 -0
  257. package/dist/runtime/server/routes/me/swap.delete.js +11 -0
  258. package/dist/runtime/server/routes/me/swap.post.d.ts +2 -0
  259. package/dist/runtime/server/routes/me/swap.post.js +11 -0
  260. package/dist/runtime/server/routes/stations/token.get.d.ts +2 -0
  261. package/dist/runtime/server/routes/stations/token.get.js +12 -0
  262. package/dist/runtime/server/routes/swaps/approve.post.d.ts +2 -0
  263. package/dist/runtime/server/routes/swaps/approve.post.js +9 -0
  264. package/dist/runtime/server/routes/swaps/list.get.d.ts +2 -0
  265. package/dist/runtime/server/routes/swaps/list.get.js +5 -0
  266. package/dist/runtime/server/routes/swaps/offer-accept.post.d.ts +2 -0
  267. package/dist/runtime/server/routes/swaps/offer-accept.post.js +9 -0
  268. package/dist/runtime/server/routes/swaps/offer-reject.post.d.ts +2 -0
  269. package/dist/runtime/server/routes/swaps/offer-reject.post.js +9 -0
  270. package/dist/runtime/server/routes/swaps/offer.delete.d.ts +2 -0
  271. package/dist/runtime/server/routes/swaps/offer.delete.js +11 -0
  272. package/dist/runtime/server/routes/swaps/offer.post.d.ts +2 -0
  273. package/dist/runtime/server/routes/swaps/offer.post.js +11 -0
  274. package/dist/runtime/server/routes/swaps/reject.post.d.ts +2 -0
  275. package/dist/runtime/server/routes/swaps/reject.post.js +9 -0
  276. package/dist/runtime/server/swap-email.d.ts +28 -0
  277. package/dist/runtime/server/swap-email.js +49 -0
  278. package/dist/runtime/server/tasks/close-shifts.d.ts +2 -0
  279. package/dist/runtime/server/tasks/close-shifts.js +9 -0
  280. package/dist/runtime/server/tasks/send-reminders.d.ts +2 -0
  281. package/dist/runtime/server/tasks/send-reminders.js +9 -0
  282. package/dist/runtime/server/utils/shifts-admin.d.ts +67 -0
  283. package/dist/runtime/server/utils/shifts-admin.js +312 -0
  284. package/dist/runtime/server/utils/shifts-assign.d.ts +89 -0
  285. package/dist/runtime/server/utils/shifts-assign.js +264 -0
  286. package/dist/runtime/server/utils/shifts-automation.d.ts +37 -0
  287. package/dist/runtime/server/utils/shifts-automation.js +171 -0
  288. package/dist/runtime/server/utils/shifts-broadcasts.d.ts +38 -0
  289. package/dist/runtime/server/utils/shifts-broadcasts.js +113 -0
  290. package/dist/runtime/server/utils/shifts-core.d.ts +78 -0
  291. package/dist/runtime/server/utils/shifts-core.js +142 -0
  292. package/dist/runtime/server/utils/shifts-dto.d.ts +32 -0
  293. package/dist/runtime/server/utils/shifts-dto.js +127 -0
  294. package/dist/runtime/server/utils/shifts-emails.d.ts +16 -0
  295. package/dist/runtime/server/utils/shifts-emails.js +44 -0
  296. package/dist/runtime/server/utils/shifts-exceptions.d.ts +7 -0
  297. package/dist/runtime/server/utils/shifts-exceptions.js +32 -0
  298. package/dist/runtime/server/utils/shifts-feed.d.ts +16 -0
  299. package/dist/runtime/server/utils/shifts-feed.js +73 -0
  300. package/dist/runtime/server/utils/shifts-notify.d.ts +40 -0
  301. package/dist/runtime/server/utils/shifts-notify.js +22 -0
  302. package/dist/runtime/server/utils/shifts-on-duty.d.ts +12 -0
  303. package/dist/runtime/server/utils/shifts-on-duty.js +37 -0
  304. package/dist/runtime/server/utils/shifts-perks.d.ts +46 -0
  305. package/dist/runtime/server/utils/shifts-perks.js +183 -0
  306. package/dist/runtime/server/utils/shifts-reminders.d.ts +30 -0
  307. package/dist/runtime/server/utils/shifts-reminders.js +102 -0
  308. package/dist/runtime/server/utils/shifts-schemas.d.ts +318 -0
  309. package/dist/runtime/server/utils/shifts-schemas.js +177 -0
  310. package/dist/runtime/server/utils/shifts-station-key.d.ts +7 -0
  311. package/dist/runtime/server/utils/shifts-station-key.js +22 -0
  312. package/dist/runtime/server/utils/shifts-stations.d.ts +28 -0
  313. package/dist/runtime/server/utils/shifts-stations.js +109 -0
  314. package/dist/runtime/server/utils/shifts-swaps.d.ts +114 -0
  315. package/dist/runtime/server/utils/shifts-swaps.js +559 -0
  316. package/dist/runtime/server/utils/shifts-views.d.ts +62 -0
  317. package/dist/runtime/server/utils/shifts-views.js +212 -0
  318. package/dist/runtime/utils/api.d.ts +108 -0
  319. package/dist/runtime/utils/api.js +111 -0
  320. package/dist/runtime/utils/checkin.d.ts +59 -0
  321. package/dist/runtime/utils/checkin.js +57 -0
  322. package/dist/runtime/utils/guards.d.ts +21 -0
  323. package/dist/runtime/utils/guards.js +36 -0
  324. package/dist/runtime/utils/ics.d.ts +32 -0
  325. package/dist/runtime/utils/ics.js +56 -0
  326. package/dist/runtime/utils/index.d.ts +16 -0
  327. package/dist/runtime/utils/index.js +15 -0
  328. package/dist/runtime/utils/links.d.ts +30 -0
  329. package/dist/runtime/utils/links.js +18 -0
  330. package/dist/runtime/utils/reminders.d.ts +27 -0
  331. package/dist/runtime/utils/reminders.js +28 -0
  332. package/dist/runtime/utils/settings.d.ts +28 -0
  333. package/dist/runtime/utils/settings.js +18 -0
  334. package/dist/runtime/utils/station-key.d.ts +9 -0
  335. package/dist/runtime/utils/station-key.js +12 -0
  336. package/dist/runtime/utils/status.d.ts +23 -0
  337. package/dist/runtime/utils/status.js +46 -0
  338. package/dist/runtime/utils/time.d.ts +22 -0
  339. package/dist/runtime/utils/time.js +14 -0
  340. package/dist/types.d.mts +5 -0
  341. package/package.json +131 -3
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { perksAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ const principal = await authorize(event, perksAccess.permissions["perks:read"]);
4
+ const { status } = await getValidatedQuery(event, shiftsEarnedPerksQuery.parse);
5
+ const userId = Number(principal.user.id);
6
+ await authorize(event, perksAccess.permissions["perks:read"], { userId });
7
+ setResponseHeader(event, "cache-control", "no-store");
8
+ return { items: await shiftsMyEarnedPerks(userId, status, shiftsRequestLocale(event)) };
9
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { noContent } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.feed);
5
+ await shiftsRevokeFeedToken(Number(principal.user.id));
6
+ return noContent(event);
7
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { shiftsAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ const principal = await authorize(event, shiftsAccess.permissions.feed);
4
+ setResponseHeader(event, "cache-control", "no-store");
5
+ return shiftsFeedStatus(Number(principal.user.id));
6
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { created } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.feed);
5
+ setResponseHeader(event, "cache-control", "no-store");
6
+ return created(event, await shiftsMintFeedToken(event, Number(principal.user.id)));
7
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { shiftsAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ const principal = await authorize(event, shiftsAccess.permissions.read);
4
+ return shiftsLedTeams(event, Number(principal.user.id));
5
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { shiftsAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ const principal = await authorize(event, shiftsAccess.permissions.read);
4
+ return shiftsMyNow(event, Number(principal.user.id));
5
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { idParams, notFound } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.read);
5
+ const { assignmentId } = await getValidatedRouterParams(event, idParams("assignmentId").parse);
6
+ const entry = await getShiftAssignmentEntryOr404(assignmentId);
7
+ if (entry.assignment.userId !== Number(principal.user.id) || entry.schedule.status !== "published") throw notFound("Assignment not found.");
8
+ await authorize(event, shiftsAccess.permissions.read, { userId: entry.assignment.userId });
9
+ setResponseHeader(event, "cache-control", "no-store");
10
+ return shiftsPassDto(event, entry);
11
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { idParams, notFound } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.attend);
5
+ const { assignmentId } = await getValidatedRouterParams(event, idParams("assignmentId").parse);
6
+ const entry = await getShiftAssignmentEntryOr404(assignmentId);
7
+ if (entry.assignment.userId !== Number(principal.user.id) || entry.schedule.status !== "published") throw notFound("Assignment not found.");
8
+ await authorize(event, shiftsAccess.permissions.attend, { userId: entry.assignment.userId });
9
+ setResponseHeader(event, "cache-control", "no-store");
10
+ if (!await shiftsStillEligible(event, entry.assignment, entry.shift.teamId)) {
11
+ await shiftsCancelFutureAssignments(event, entry.assignment.userId, entry.shift.teamId, (row) => shiftsStillEligible(event, row, entry.shift.teamId));
12
+ }
13
+ return shiftsPassDto(event, await getShiftAssignmentEntryOr404(assignmentId));
14
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { idParams, notFound } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.read);
5
+ const { assignmentId } = await getValidatedRouterParams(event, idParams("assignmentId").parse);
6
+ const entry = await getShiftAssignmentEntryOr404(assignmentId);
7
+ if (entry.assignment.userId !== Number(principal.user.id) || entry.schedule.status !== "published") throw notFound("Assignment not found.");
8
+ await authorize(event, shiftsAccess.permissions.read, { userId: entry.assignment.userId, teamId: entry.shift.teamId });
9
+ return shiftsMyShiftDetail(event, entry);
10
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { shiftsAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ const principal = await authorize(event, shiftsAccess.permissions.read);
4
+ const query = await getValidatedQuery(event, shiftsRangeQuery.parse);
5
+ return shiftsMyShifts(Number(principal.user.id), query);
6
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { idParams, noContent, notFound } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.swap);
5
+ const { assignmentId } = await getValidatedRouterParams(event, idParams("assignmentId").parse);
6
+ const entry = await getShiftAssignmentEntryOr404(assignmentId);
7
+ if (entry.assignment.userId !== Number(principal.user.id)) throw notFound("Assignment not found.");
8
+ await authorize(event, shiftsAccess.permissions.swap, { userId: entry.assignment.userId });
9
+ await shiftsWithdrawSwap(entry);
10
+ return noContent(event);
11
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { created, idParams, notFound } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.swap);
5
+ const { assignmentId } = await getValidatedRouterParams(event, idParams("assignmentId").parse);
6
+ const input = await readValidatedBody(event, shiftsOpenSwapInput.parse);
7
+ const entry = await getShiftAssignmentEntryOr404(assignmentId);
8
+ if (entry.assignment.userId !== Number(principal.user.id)) throw notFound("Assignment not found.");
9
+ await authorize(event, shiftsAccess.permissions.swap, { userId: entry.assignment.userId });
10
+ return created(event, await shiftsOpenSwap(event, entry, input));
11
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { idParams } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ await authorize(event, shiftsAccess.permissions.lead);
5
+ shiftsRequireStationKey(event);
6
+ const { stationId } = await getValidatedRouterParams(event, idParams("stationId").parse);
7
+ const station = await getShiftStationOr404(stationId);
8
+ await authorize(event, shiftsAccess.permissions.lead, { teamId: station.teamId });
9
+ setResponseHeader(event, "cache-control", "no-store");
10
+ const teams = await shiftsTeamsById([station.teamId]);
11
+ return shiftsStationTokenDto(event, station, teams.get(station.teamId)?.name ?? station.teamId);
12
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { idParams } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.lead);
5
+ const { swapId } = await getValidatedRouterParams(event, idParams("swapId").parse);
6
+ const swap = await getShiftSwapOr404(swapId);
7
+ await shiftsAuthorizeSwapApprover(event, swap, Number(principal.user.id));
8
+ return shiftsApproveSwap(event, swap, Number(principal.user.id));
9
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { shiftsAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ const principal = await authorize(event, shiftsAccess.permissions.read);
4
+ return shiftsAvailableSwaps(event, Number(principal.user.id));
5
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { shiftsAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ await authorize(event, shiftsAccess.permissions.swap);
4
+ const { swapId, offerId } = await getValidatedRouterParams(event, shiftsOfferParams.parse);
5
+ const swap = await getShiftSwapOr404(swapId);
6
+ const offer = await getShiftSwapOfferOr404(swap.id, offerId);
7
+ await authorize(event, shiftsAccess.permissions.swap, { userId: shiftsSwapOwnerId(swap) });
8
+ return shiftsAcceptOffer(event, swap, offer);
9
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { shiftsAccess } from "../../../access.js";
2
+ export default defineEventHandler(async (event) => {
3
+ await authorize(event, shiftsAccess.permissions.swap);
4
+ const { swapId, offerId } = await getValidatedRouterParams(event, shiftsOfferParams.parse);
5
+ const swap = await getShiftSwapOr404(swapId);
6
+ const offer = await getShiftSwapOfferOr404(swap.id, offerId);
7
+ await authorize(event, shiftsAccess.permissions.swap, { userId: shiftsSwapOwnerId(swap) });
8
+ return shiftsRejectOffer(event, swap, offer);
9
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { noContent } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ await authorize(event, shiftsAccess.permissions.swap);
5
+ const { swapId, offerId } = await getValidatedRouterParams(event, shiftsOfferParams.parse);
6
+ const swap = await getShiftSwapOr404(swapId);
7
+ const offer = await getShiftSwapOfferOr404(swap.id, offerId);
8
+ await authorize(event, shiftsAccess.permissions.swap, { userId: offer.userId });
9
+ await shiftsWithdrawOffer(swap, offer);
10
+ return noContent(event);
11
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { created, idParams } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.swap);
5
+ const { swapId } = await getValidatedRouterParams(event, idParams("swapId").parse);
6
+ const input = await readValidatedBody(event, shiftsOfferInput.parse);
7
+ const userId = Number(principal.user.id);
8
+ const swap = await getShiftSwapOr404(swapId);
9
+ await authorize(event, shiftsAccess.permissions.swap, { userId });
10
+ return created(event, await shiftsOffer(event, swap, userId, input.assignmentId ?? null));
11
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { idParams } from "@frigear-nu/module-kit/server";
2
+ import { shiftsAccess } from "../../../access.js";
3
+ export default defineEventHandler(async (event) => {
4
+ const principal = await authorize(event, shiftsAccess.permissions.lead);
5
+ const { swapId } = await getValidatedRouterParams(event, idParams("swapId").parse);
6
+ const swap = await getShiftSwapOr404(swapId);
7
+ await shiftsAuthorizeSwapApprover(event, swap, Number(principal.user.id));
8
+ return shiftsRejectSwap(event, swap, Number(principal.user.id));
9
+ });
@@ -0,0 +1,28 @@
1
+ import type { EmailNotification } from '@frigear-nu/notify/types';
2
+ /**
3
+ * The swap emails: a new offer (to the owner), accepted / rejected (to the offerer, and the owner on an approver's
4
+ * rejection), completed (both), pending approval (to the leads), and proposed (a trade aimed at one shift, to its holder).
5
+ */
6
+ export type ShiftSwapEmailKind = 'offered' | 'accepted' | 'rejected' | 'completed' | 'pending' | 'proposed';
7
+ /**
8
+ * `{{name}}` style variables of a swap email. `team` and `when` are the owner's shift; `backTeam` and `backWhen` the shift
9
+ * given in return (a trade), empty for a release.
10
+ */
11
+ export type ShiftSwapEmailVariables = {
12
+ name: string;
13
+ owner: string;
14
+ offerer: string;
15
+ team: string;
16
+ when: string;
17
+ backTeam: string;
18
+ backWhen: string;
19
+ };
20
+ /** The email of a swap event to one person. `trade` names both shifts. `null` without an address. */
21
+ export declare function buildShiftSwapEmail(input: {
22
+ kind: ShiftSwapEmailKind;
23
+ email: string | null;
24
+ variables: ShiftSwapEmailVariables;
25
+ trade?: boolean;
26
+ url?: string;
27
+ locale?: string;
28
+ }): EmailNotification | null;
@@ -0,0 +1,49 @@
1
+ const escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2
+ const SUBJECTS = {
3
+ offered: "New offer for your shift on {{when}}",
4
+ accepted: "Your offer for the shift on {{when}} was accepted",
5
+ rejected: "The swap of the shift on {{when}} did not go through",
6
+ completed: "Shift swap done: {{when}}",
7
+ pending: "A shift swap waits for your approval: {{when}}",
8
+ proposed: "{{owner}} wants to trade shifts with you: {{backWhen}}"
9
+ };
10
+ const RELEASE = {
11
+ offered: "{{offerer}} offers to take your shift on {{team}} on {{when}} over. Accept or reject the offer on the shift's page.",
12
+ accepted: "{{owner}} accepted your offer for the shift on {{team}} on {{when}}. When the swap is done you get another email.",
13
+ rejected: "The swap of the shift on {{team}} on {{when}} did not go through. The shift stays as it was.",
14
+ completed: "The swap of the shift on {{team}} on {{when}} is done: {{offerer}} took it over. Check your shifts for your new plan.",
15
+ pending: "{{offerer}} wants to take over {{owner}}'s shift on {{team}} on {{when}}. As a lead of the team, approve or reject the swap.",
16
+ proposed: "{{owner}} wants your shift on {{backTeam}} on {{backWhen}} for theirs on {{team}} on {{when}}. Offer your shift on the open swaps page to trade."
17
+ };
18
+ const TRADE = {
19
+ offered: "{{offerer}} offers their shift on {{backTeam}} on {{backWhen}} for your shift on {{team}} on {{when}}. Accept or reject the trade on the shift's page.",
20
+ accepted: "{{owner}} accepted your trade: your shift on {{backTeam}} on {{backWhen}} for theirs on {{team}} on {{when}}. When the trade is done you get another email.",
21
+ rejected: "The trade of the shift on {{team}} on {{when}} for the one on {{backTeam}} on {{backWhen}} did not go through. Both shifts stay as they were.",
22
+ completed: "The trade is done: {{offerer}} works {{owner}}'s shift on {{team}} on {{when}}, and {{owner}} works {{offerer}}'s shift on {{backTeam}} on {{backWhen}}. Check your shifts for your new plan.",
23
+ pending: "{{owner}} and {{offerer}} want to trade shifts: {{owner}}'s shift on {{team}} on {{when}} for {{offerer}}'s on {{backTeam}} on {{backWhen}}. As a lead of the team, approve or reject the trade.",
24
+ proposed: "{{owner}} wants your shift on {{backTeam}} on {{backWhen}} for theirs on {{team}} on {{when}}. Offer your shift on the open swaps page to trade."
25
+ };
26
+ const fill = (text, variables) => text.replace(/\{\{\s*(name|owner|offerer|team|when|backTeam|backWhen)\s*\}\}/g, (_match, key) => variables[key]);
27
+ export function buildShiftSwapEmail(input) {
28
+ const { kind, email, variables, url } = input;
29
+ if (!email) return null;
30
+ const subject = fill(SUBJECTS[kind], variables);
31
+ const message = fill((input.trade ? TRADE : RELEASE)[kind], variables);
32
+ const link = url ? `<p><a href="${escapeHtml(url)}">${escapeHtml(url)}</a></p>` : "";
33
+ return {
34
+ to: email,
35
+ subject,
36
+ body: `<p>Hi ${escapeHtml(variables.name)},</p><p>${escapeHtml(message)}</p>${link}`,
37
+ text: `Hi ${variables.name},
38
+
39
+ ${message}${url ? `
40
+
41
+ ${url}` : ""}`,
42
+ template: {
43
+ name: `shifts-swap-${kind}`,
44
+ props: { name: variables.name, subject, message, url: url ?? null, trade: !!input.trade },
45
+ locale: input.locale ?? "en"
46
+ },
47
+ meta: { shiftSwap: kind }
48
+ };
49
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export default defineTask({
2
+ meta: {
3
+ name: "shifts:close-shifts",
4
+ description: "Give out the perks of ended shifts, mark auto no-shows and send the leads their digest."
5
+ },
6
+ async run() {
7
+ return { result: await shiftsCloseShifts() };
8
+ }
9
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export default defineTask({
2
+ meta: {
3
+ name: "shifts:send-reminders",
4
+ description: "Email (and optionally text) people before their shifts start."
5
+ },
6
+ async run() {
7
+ return { result: await shiftsSendReminders() };
8
+ }
9
+ });
@@ -0,0 +1,67 @@
1
+ import type { H3Event } from 'h3';
2
+ import type { z } from 'zod';
3
+ import type { ShiftCopyResultDto, ShiftDto, ShiftScheduleDto, ShiftWithAssigneesDto } from '../../../types.js';
4
+ import type { ShiftRoleRow, ShiftRow, ShiftScheduleRow } from './shifts-dto.js';
5
+ import type { ShiftEntry } from './shifts-core.js';
6
+ import type { shiftsBulkInput, shiftsRoleInput, shiftsRolePatch, shiftsScheduleInput, shiftsSchedulePatch, shiftsShiftPatch } from './shifts-schemas.js';
7
+ type ScheduleInput = z.output<typeof shiftsScheduleInput>;
8
+ type SchedulePatch = z.output<typeof shiftsSchedulePatch>;
9
+ type RoleInput = z.output<typeof shiftsRoleInput>;
10
+ type RolePatch = z.output<typeof shiftsRolePatch>;
11
+ type BulkInput = z.output<typeof shiftsBulkInput>;
12
+ type ShiftPatch = z.output<typeof shiftsShiftPatch>;
13
+ /**
14
+ * Shift rows per insert. A row binds 11 parameters (`closedAt` is the only `null` literal; `createdAt`/`updatedAt` come
15
+ * from `$defaultFn`), so 8 rows (88) stay within 90 bound parameters, under D1's 100 per statement.
16
+ */
17
+ export declare const SHIFT_INSERT_ROWS: number;
18
+ /** The schedules of an operation (or every one), newest first, with how many shifts each has. */
19
+ export declare function shiftsListSchedules(operationId?: string, event?: H3Event): Promise<ShiftScheduleDto[]>;
20
+ /** Creates a draft schedule. 400 `invalid_schedule_settings` when the settings do not fit together. */
21
+ export declare function shiftsCreateSchedule(input: ScheduleInput): Promise<ShiftScheduleRow>;
22
+ /**
23
+ * Changes a schedule's name, settings, sizes or guards (not its status: see publish). The settings are checked merged
24
+ * with the stored ones (400 `invalid_schedule_settings`). Live swaps are not touched: accepting or approving one checks
25
+ * the settings of that moment.
26
+ */
27
+ export declare function shiftsPatchSchedule(existing: ShiftScheduleRow, patch: SchedulePatch): Promise<ShiftScheduleRow>;
28
+ /**
29
+ * Publishes a draft schedule (a conditional write: publishing twice at once publishes once) and fires
30
+ * `shifts:schedule:published`. Publishing a published schedule is a no-op.
31
+ */
32
+ export declare function shiftsPublishSchedule(event: H3Event, existing: ShiftScheduleRow): Promise<ShiftScheduleRow>;
33
+ /** Deletes a schedule with its roles and shifts. 409 `schedule_in_use` while people are (or were) on its shifts. */
34
+ export declare function shiftsDeleteSchedule(existing: ShiftScheduleRow): Promise<void>;
35
+ export declare function shiftsListRoles(scheduleId: string): Promise<any>;
36
+ /** Creates a shift role on a team of the schedule's operation; `teamRole` must be on the team kind's ladder. */
37
+ export declare function shiftsCreateRole(event: H3Event, schedule: ShiftScheduleRow, input: RoleInput): Promise<ShiftRoleRow>;
38
+ export declare function shiftsPatchRole(event: H3Event, role: ShiftRoleRow, patch: RolePatch): Promise<ShiftRoleRow>;
39
+ /** Deletes a shift role. 409 `role_in_use` while a shift or an active assignment uses it. */
40
+ export declare function shiftsDeleteRole(role: ShiftRoleRow): Promise<void>;
41
+ /**
42
+ * Creates every slot on every day as a shift of one team. Days and `HH:mm` slots are wall-clock times in the module's
43
+ * `timeZone`; a slot that ends at or before it starts ends the next day. Fires `shifts:shift:created` per shift.
44
+ */
45
+ export declare function shiftsBulkCreate(event: H3Event, schedule: ShiftScheduleRow, input: BulkInput): Promise<ShiftDto[]>;
46
+ /**
47
+ * Changes a shift and fires `shifts:shift:updated`. Moving it to another team, or changing its role, is refused (409
48
+ * `shift_in_use`) while people hold a place on it: they were checked against the old team.
49
+ */
50
+ export declare function shiftsPatchShift(event: H3Event, entry: ShiftEntry, patch: ShiftPatch): Promise<ShiftDto>;
51
+ /** Deletes a shift. 409 `shift_in_use` while people are (or were) on it. */
52
+ export declare function shiftsDeleteShift(entry: ShiftEntry): Promise<void>;
53
+ /** The shifts of a schedule (`teamId`, `from`, `to` narrow it) with their assignments; contact details only with `pii`. */
54
+ export declare function shiftsScheduleShifts(schedule: ShiftScheduleRow, query: {
55
+ teamId?: string;
56
+ from?: Date;
57
+ to?: Date;
58
+ }, pii: boolean): Promise<ShiftWithAssigneesDto[]>;
59
+ /** Shifts with their team names and assignments (cancelled ones left out). */
60
+ export declare function shiftsWithAssignees(rows: ShiftRow[], schedules: Map<string, Pick<ShiftScheduleRow, 'operationId' | 'maxPerShift'>>, pii: boolean): Promise<ShiftWithAssigneesDto[]>;
61
+ /**
62
+ * Copies the roles and shifts of another schedule into this one, the shifts moved by `offsetDays` at the same wall-clock
63
+ * time, and its coverage, handover and approval. Assignments are not copied. A source of another operation maps its teams to this operation's teams by name;
64
+ * teams without a match are skipped (`skippedTeamIds`). Fires `shifts:shift:created` per shift.
65
+ */
66
+ export declare function shiftsCopyFrom(event: H3Event, target: ShiftScheduleRow, sourceId: string, offsetDays: number): Promise<ShiftCopyResultDto>;
67
+ export {};