Skip to content

Data Model

Core tables

departments

Maps the routing taxonomy to operational teams.

ColumnNotes
idUUID primary key
name / name_arEnglish and Arabic display names
l1_labelsL1 taxonomy labels that route to this department
l2_labelsExtra label mapping support

profiles

Application profile layer on top of auth.users.

ColumnNotes
idFK to auth.users(id)
full_nameDisplay name
roleend_user, agent, or admin
department_idOptional owning department
email, avatar_urlAdded in later migrations

tickets

The main service desk entity.

ColumnNotes
ticket_numberHuman-friendly identity column
title_ar / description_arArabic ticket content
submitter_idEnd user who opened the ticket
assigned_agent_idAgent currently responsible
department_idRouted department
statusnew, pending_review, open, in_progress, resolved, closed
priorityAdded by later migration
classificationJSONB classifier payload
routing_modeauto, review, or manual
routing_confidenceStored as numeric score
routing_reasonHuman-readable explanation
routing_overriddenTracks agent correction for analytics

ticket_comments

Threaded human discussion on a ticket.

ColumnNotes
ticket_idParent ticket
author_idOptional profile FK
bodyComment text
created_atTimestamp

notifications

Per-user activity feed.

ColumnNotes
user_idTarget profile
kindNotification type
title / bodyStored message payload
is_readRead state
ticket_id / ticket_numberAdded later for deep-linking
metaStructured JSON payload for UI localization and rendering

quick_actions

Admin-managed operational guidance tied to taxonomy nodes.

ColumnNotes
l1_label, l2_label, l3_labelMatching criteria
action_typechecklist, template, or link
action_payloadAction-specific JSON data
sort_orderUI ordering

ticket_audit_log

Tracks changes such as status updates, assignment, and routing overrides.

This table is introduced after the initial schema and is used by the ticket detail view for historical traceability.

Important schema evolution

Migration areaWhy it matters
RLS policiesDetermines who can read and mutate tenant-like data
realtime publicationsEnables queue and notification live updates
priorityAdds triage depth beyond status alone
invitationsSupports admin-driven user onboarding
audit logMakes operational changes explainable
quick actionsGives agents reusable response content
notification ticket refsAllows accurate deep links from alerts

Current shared application types

The shared package intentionally stays small:

  • ClassificationResult
  • Ticket
  • RoutingMode
  • routing thresholds
  • top-level L1 taxonomy labels

The richer API response types currently live in the web app rather than in @arabic-itsm/shared.

Built from the current monorepo implementation.