Notifications
CI / ci (push) Canceled after 0s

Added a cron job processor so emails and notifications can get processed.

Added super admin settings with a gui to edit.
This commit is contained in:
Stefan Lazic committed 2026-09-11 17:46:28 +01:00
1 parent cbeccc6c1f
commit 1a76d1cacb
17 files changed
+645 -48

No files matched your search

+32
View File
@@ -138,6 +138,38 @@ this for you), then finish its setup by visiting
Repeat this step for each additional business, whenever you want one.
### 6. Notification delivery (required once, covers every business)
Staff invitation emails, appointment reminders, loyalty reward emails,
and Google Reviews sync are **not sent automatically** — the app only
queues them; something has to actually trigger delivery on a schedule by
calling two `CRON_SECRET`-gated endpoints
(`/api/cron/process-notifications`, `/api/cron/sync-google-reviews` — see
their own route files for the full reasoning). Skip this step and every
business's queued notifications just sit as `PENDING` forever — the UI
still says "an invitation email has been sent" the moment it's queued,
regardless of whether anything has actually delivered it yet.
[stacks/infra/scripts/process-cron.sh](stacks/infra/scripts/process-cron.sh)
calls both endpoints for **every** business under `STACKS_DIR` in one
run, so a single crontab entry covers businesses added later too — no
per-business cron line to maintain. Add this to the VPS's crontab
(`crontab -e`) once:
```bash
# Deliver queued notifications every 2 minutes.
*/2 * * * * STACKS_DIR=/opt/nextchair/stacks /opt/nextchair/stacks/infra/scripts/process-cron.sh notifications >> /var/log/nextchair-cron.log 2>&1
# Refresh Google Reviews once a day.
0 3 * * * STACKS_DIR=/opt/nextchair/stacks /opt/nextchair/stacks/infra/scripts/process-cron.sh reviews >> /var/log/nextchair-cron.log 2>&1
```
(Adjust `STACKS_DIR` if you cloned this repo somewhere other than
`/opt/nextchair`.) To confirm it's working, or to flush a notification
that's stuck pending right now, run either line's command by hand and
check `/var/log/nextchair-cron.log` — a healthy run logs `<slug>
process-notifications ok` for every business.
## Updating after a code change
For an existing NextChair server, **do not re-run the fresh VPS setup above** and do not overwrite your production `.env` files.