Commit graph

127 commits

Author SHA1 Message Date
905ec8a38b Add editing of shift time slots 2025-03-15 16:45:02 +01:00
accc1690ff Add editing of roles for shifts 2025-03-15 15:10:42 +01:00
27d853d102 Disable editing of public events in UI for crew 2025-03-15 14:28:27 +01:00
b22d32dada Add editing of events 2025-03-15 14:20:38 +01:00
262a691ed6 Move toId to shared/utils/functions.ts 2025-03-15 13:46:13 +01:00
02be8a37a5 Implement editing of time slots
Render the timeslots as an editable table of times with associated
event.  When the event it's linked to is edited the time slot is removed
from the original event it belonged to and added to the possibly new
event it now belongs to.  This gives a somewhat intutive editing
experience when editing time slots linked to events with multiple times.
2025-03-14 18:19:58 +01:00
3cdfceb037 Reconfigure VsCode to not remove dead code
I have no idea why this is even a thing.  Removing dead code on save is
stupid.
2025-03-14 17:51:07 +01:00
d0ee6a40eb Pass schedule as a prop to Timetable 2025-03-14 17:38:01 +01:00
f550ca921b Share utility functions from Timetable
Move the genereic pairs, enumerate and setEquals functions from
Timetable to shared/utils/functions to make them available for reuse.
2025-03-12 14:44:06 +01:00
29b34deef0 Make session cookie permament
Set a max age for the session cookie to prevent it from expiring when
the browser is closed.  To prevent the age limit from being being
reached the session cookie is refreshed every time the session is
loaded.  This should fix login being lost when the browser is stopped.
2025-03-11 16:30:51 +01:00
c940f785c5 Add editable LocationsTable 2025-03-11 16:05:38 +01:00
5255ed698e Implement access controlled edit schedule endpoint
Add PATCH /api/schedule endpoint for editing the schedule in a manner
that's access controlled.
2025-03-11 14:11:05 +01:00
bb306ee938 Pass headers when server fetches the schedule
Fix the inital server side load of the schedule not including crew only
items due to headers not being passed from the client to server side
request made to fetch the schedule.
2025-03-10 20:59:22 +01:00
5256f3fcf8 Remove unused items in Timetable 2025-03-10 20:59:04 +01:00
a9ba0c55e1 Implement role based shifts for crew 2025-03-10 20:58:33 +01:00
f69ca520c0 Refetch schedule and stream if session is updated 2025-03-10 16:43:21 +01:00
4806343250 Filter crew events to only be visible for crew 2025-03-10 16:26:52 +01:00
13f344472e Move schedule fetching into useSchedule composable 2025-03-10 15:41:32 +01:00
ddecfa3805 Set seed when generating interests into events
Prevent adding accounts from changing who's interestin in what in the
generated demo schedule.
2025-03-10 14:42:40 +01:00
6c4107a1cb Fix incorrect time offset in generated schedule
When correcting for a timezone being ahead of UTC the start has to be
moved backwards in time, not forward.  Fixes the generated schodule
not using central european times.
2025-03-10 14:40:52 +01:00
db8393c3a9 Add crew designator to events
Distinguish between events for attendees to see and events that are
meant only for the crew.
2025-03-10 14:40:02 +01:00
40c25f8990 Fix logic inversion braking interested 2025-03-09 23:56:39 +01:00
e8226e0062 Implement account type restricted page
Add allowedAccountTypes page metadata which the authenticated middleware
uses to further restrict the types of accounts that can access the page.

If the account type is insufficent to access the page it will return an
HTTP 403 Forbidden status, which is rendered using the error page.
2025-03-09 22:37:07 +01:00
245169950a Fixes on reading the session object 2025-03-09 22:18:42 +01:00
41528e8193 Display time in timezone configured on the account
Use the timezone configured on the account, or the default timezone if
no timezone is confirude to display the timetable and events in local
time.
2025-03-09 18:35:38 +01:00
1ac607a712 Use unix timestamps in timetable logic
Parse the iso date strings into millseconds from the unix epoch and use
that through the timetable logic instead of reparsing the strings over
and over.
2025-03-09 16:49:57 +01:00
c4a6f6b3f9 Add per account overridable timezone setting
To make it possible to render the timetable in the user's local time we
need to know the timezone to render it in on the server.  Otherwise
there will be hydration errors and paint flashing as the client renders
a different timezone.

Add a server global default timezone that can be overriden on a
per-account bases to prepare for timezone handling the timetable.
2025-03-09 15:53:51 +01:00
264c97b586 Fix server redirectng to login when logged in
When rendering on the server the session is not eagerly loaded when the
authenticated middleware runs, causing it to think the user is not
logged in.  Fix by awaiting the session composable.
2025-03-09 15:51:00 +01:00
8c8f340553 Type false session as null
Make the typing for the session work again by telling TypeScript the
false value is actually null.
2025-03-09 15:50:18 +01:00
c71841801b Use deleteCookie to remove session cookie 2025-03-08 00:36:10 +01:00
2897542823 Cache session data
The session is always explicitly updated when it changes, cache it on
the client if it has already been loaded.
2025-03-08 00:34:46 +01:00
ed74f4bb0e Use false instead of null for empty session
The caching layer of Nuxt assumes no entry exists if it's nullish.  This
causes null to be treated as if the resource needs to be fetched.  Use
false instead.
2025-03-08 00:33:35 +01:00
8ef4636635 Add create account functionality 2025-03-07 23:53:57 +01:00
598b9fd7d6 Add delete account function 2025-03-07 22:28:55 +01:00
3535105744 Pull Log Out button into its own component 2025-03-07 21:46:44 +01:00
db9a12250e Track which account is interested in which events
Store a list of ids of events and slots that accounts have marked as
being interested in, and show aggeregate counts in the schedule.
2025-03-07 20:15:41 +01:00
ca51c07065 Move push notification setting to separate page
Set up a dedicated Account Setttings page to hold account specific
settings such as the push notifications.
2025-03-07 18:43:24 +01:00
d4cbbcbc2d Fix session being double requested
If the returned value of the fetched endpoint is blank that gets
converted to undefined, which confuses the request sharing between the
client and server causing the session to be requested on both sides.

Transform value to null if it's blank so that the session fetch is
de-duplicated.
2025-03-07 16:45:40 +01:00
b2a5b67096 Refactor push subscription logic into a composable 2025-03-07 16:08:45 +01:00
52dfde95d1 Tie push subscriptions to current session
If a user logs out from a device the expectation should be that device
no longer having any association with the user's account.  Any existing
push notifications should thefore be removed on server.  For this reason
tie push notifications to a session, and remove them when the session is
deleted.
2025-03-07 15:47:48 +01:00
150cb82f5c Basic account and session system
Provide a basic account system with login and server side session store
identified by a cookie.  Upon successful login a signed session cookie
is set by the server with the session stored on the server identifying
which account it is logged in as.  The client uses a shared useFetch on
the session endpoint to identify if it's logged in and which account it
is logged in as, and refreshes this when loggin in or out.
2025-03-07 12:41:57 +01:00
abdcc83eb9 Refactor subscription format
Place the actual push subscription data into a push property on the
subscription so that other properties can be added to it.
2025-03-07 12:37:47 +01:00
b4934005ae Pull JSON read file logic into a function 2025-03-07 12:27:19 +01:00
8da4b02154 Implement signed cookie helpers
Provide a convenient wrapper for setting SHA-256 HMAC signed cookies and
retreiving them with the signature validated.  The secret key is
configured in the NUXT_COOKIE_SECRET_KEY environment variable.
2025-03-06 22:07:51 +01:00
5044b7b58d Fix day header inserted into break
If a span ended on midnight the next day header would be started on the
break and the sameDay check would match the day of the next span causing
the day header to be inserted into the break column.  Fix by checking
that the last day header has a non-zero span in the same day check.
2025-03-06 00:37:40 +01:00
3da83a7feb Fix demo schedule origin being on Saturday
It was intended to have Monday as the origin point.
2025-03-05 22:54:43 +01:00
e703902c5e Fix generated schedule using wrong date format 2025-03-05 22:43:07 +01:00
228d75db72 Generate a demo schedule if no schedule exists 2025-03-05 22:15:46 +01:00
f42dfcc13d Gracefully handle events with invalid locations 2025-03-05 22:14:58 +01:00
e45e51ef7a EventsEdit: Handle no events existing 2025-03-05 19:10:24 +01:00