# Test-series notifications

Run `schema/testseries.sql` against the `testseries` database. It creates `test_notification_deliveries`, which stores one delivery record per test and student.

Set these environment values for the backend:

```dotenv
DB_NAME=iiitvrhb_studyplanner
DB_TESTSERIES_NAME=testseries
```

The admin page is available at `/test-series` and uses these endpoints:

- `GET /backend/study/admin/testSeries_index` lists published tests and delivery counts.
- `POST /backend/study/admin/testSeries_notify` with `{ "test_id": 14, "resend": true }` sends or resends one test notification.

The notification endpoint is public and can be called by cron every minute. It selects published tests whose availability window includes the current time and skips students already marked `Sent`:

```cron
* * * * * curl -fsS -X POST https://YOUR_API_HOST/backend/study/admin/testSeries_notify -H 'Content-Type: application/json' -d '{}' >/dev/null
```

Notifications open `https://nitish.mystudyplanner.in/testseries/` and include the test ID and course in FCM data. Cron retries failed deliveries; the admin Resend action deliberately sends again to all active student tokens.
