Events – data model, scope and endpoints

Storage of events, per-language descriptions, user roles and labels, the save and delete process, the scopes and the additional endpoints.

Overview

Events for a company and optionally a topic: date, title and content per language, responsible person, assignees, watchers, labels and a completed flag. Besides the admin screens, a token-link front portal reads them.

Data model

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

TableRole
eventevent (company, topic, date, responsible, completed, creator)
event_descriptiontitle and content per language
event_userassignees and watchers
company_objectlink of the event to the company
label_linklabels

Process

  1. Save: the company is required and in scope; a title in at least one language. New: addEvent(post, creator, 'admin'); existing: editEvent(). A super admin can set another creator (setCreatedBy).
  2. Label creation (labelcreate): an active label with the same name is returned; otherwise the label model's addLabel() creates one in group event.
  3. Completion (complete): toggleCompleted(), logged.
  4. Delete: events outside the scope are skipped; the event, its descriptions, user rows, company and label links are deleted.

Permissions

  • list with the company scope, plus scope rules topic/topic_id, event/event_id, user/user_id (own events are always visible).
  • edit (form), canSave() + companyInScope() (save), complete (+ the event's company in scope), delete (+ per-row scope), debug.
  • companysearch returns only client companies within the scope.

Additional endpoints

  • event.exporttxt: text export of the filtered events by company → topic → open/completed; super admin only.
  • event.portallink: the front portal link with the user's API key; generates a key if there is none (user/user::setApiKey); permission list.
  • event.groupcompanies: shared company picker, permission list.

Known limitations

  • The add key is not classified in the seeds; saving is decided by canSave().
Related topics: event management permissions