npsplk/npsp

Notification API

Opened this issue · 0 comments

API for requesting system notifications

GET url: /api/notifications

Sample Response:
[{
"id":1,
"message": "Vehicle has not arrived for scheduled trip at 3:30 PM Matara Bay 06",
"type": "warning"
},{
"id":2,
"message": "Call in Vehicle [Registration number] to bay for scheduled trip at 3:30 PM Fort Bay 08",
"type": "info"
}]

preface: initially the schedule instances' state will be set to "DELAYED" by default. When the bus arrives to the premises through the gate the operator will manually update the schedule instance state to "PENDING". Thus a schedule instance in delayed state implies the vehicle has not arrived and a schedule instance in pending state implies that the vehicle has arrived.

Notifications required on:

  1. notification when a schedule instance is in delayed state(bus has not arrived) x mins ahead of departure time.
  2. notification when a schedule instance is in pending state and should be parked in to the bay for boarding y mins ahead of departure time.

Special notices:

  1. notifications should be in descending order (most recent first)
  2. x & y should be configurable
  3. a schedule instance may only cause maximum of two notifications. 1 if the bus has not arrived. another for reminding to call in for boarding.