Voile.Notifications.ReservationNotifier (Voile v0.1.23)

Copy Markdown View Source

Handles broadcasting and subscribing to reservation notifications. Staff and admin users can subscribe to get notified when members request reservations.

Summary

Functions

Broadcasts a new reservation notification to all subscribed staff/admin.

Notify the reservation member (via email) that their reservation is ready or a staff action occurred.

Subscribe the current process to a member-specific reservation topic. Use this in member-facing LiveViews to receive realtime reservation notifications.

Subscribe to new reservation notifications. Should only be called by staff/admin users.

Unsubscribe from reservation notifications.

Unsubscribe the current process from a member-specific reservation topic.

Functions

broadcast_new_reservation(reservation)

Broadcasts a new reservation notification to all subscribed staff/admin.

notify_member(reservation)

Notify the reservation member (via email) that their reservation is ready or a staff action occurred.

Returns {:ok, _} on success or {:error, reason} on failure. If the member has no email, returns {:error, :no_recipient} but still broadcasts an internal message for staff.

subscribe_member(member_id)

Subscribe the current process to a member-specific reservation topic. Use this in member-facing LiveViews to receive realtime reservation notifications.

subscribe_to_reservations()

Subscribe to new reservation notifications. Should only be called by staff/admin users.

unsubscribe_from_reservations()

Unsubscribe from reservation notifications.

unsubscribe_member(member_id)

Unsubscribe the current process from a member-specific reservation topic.