Async jobs and notifications: data model, endpoints, permissions

Data model of main jobs and notifications, how the NAV query is started and its time budget, the bell endpoints, per-user filtering and the classification of the permission keys.

The async "main job" list shows the progress, state and queue item counters of NAV invoice queries; the header bell and the Notifications list are two views of the same notification table. The super administrator sees all jobs, other users their own; notifications are always the user's own.

Data model

Table names carry the installation's own prefix in the database.

TableRoleRelation
jobmain job: type, progress, state, userqueue items belong to the job
cron_queuethe job's itemsjob ID
notificationnotifications: type, read and delivered state, source linkuser_id, job ID

Endpoints

EndpointBehaviourPermission
job.list, .progress, .cancel, .notificationspagepaged list; progress map; stop (record and downloaded result remain); redirect to notifications with filter_job_idlist
job.deletedeletes the selected jobs with own-or-super filteringdelete
job.navqueryNAV query from the invoice filter: time windows per company (active, with tax number and NAV login only), then the worker is triggered within the synchronous budget (job_sync_budget setting, default 8 s); immediate reply if finished, otherwise 202 Acceptedfinance/invoice + navdata
job.testquerydiagnostic test job with a fixed company and a fixed periodfinance/invoice + navdata
job.notificationsthe user's undelivered notifications (at most 20) for pop-ups, then marked deliveredlogin
job.bellunread count, 5 latest, 10 undelivered (marked delivered)login
job.bellreadall own notifications readlogin
notification.list, .markread, .markreadallfilter: type, read state, job; viewing does not mark as readlist
notification.deletephysical delete of selected own notificationsdelete
notification.deletealldeletes all own notifications, with a countdeleteall (BASE)

The source link is built by a safe link builder.

Permissions

  • system/job: list unclassified, delete and debug not in the seeds.
  • system/notification: list unclassified, deleteall BASE, delete and debug not in the seeds.
  • Content scope: the job model filters by user_id and super; the notification model by the own user_id on every action.

Known limitations

job.testquery runs with a fixed company ID and a fixed period, for diagnostics only.