Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LMendoza70/SSA/llms.txt

Use this file to discover all available pages before exploring further.

The Timeline module preserves the institutional memory of the Jurisdicción Sanitaria de Huejutla de Reyes by maintaining a structured, administrable chronological record of significant public-health events. Rather than hard-coding historical milestones into static pages, every entry is a first-class database entity that administrators can create, enrich, categorise, and retire through the same CMS workflow used for all other content. This design ensures the record stays accurate, grows over time, and can be searched and filtered programmatically — both by the public portal and by the AI chatbot.

What Is a Timeline Event?

A Timeline Event is a dated institutional fact — a disease outbreak, a vaccination campaign launch, a programme milestone, or any other moment worth preserving in the public record. Each event is an independent entity with its own lifecycle and the following fields:
  • date — exact date or approximate period expressed as a DateTime
  • period — human-readable label shown to users (e.g. "2020–2022")
  • title — short, descriptive event name
  • description — rich-text body (authored in the Tiptap editor)
  • category — classification tag (e.g. epidemic, campaign, infrastructure, legislation)
  • mediaIds — references to assets managed by the Multimedia Module
  • relatedContent — links to CMS content items that expand on the event
  • Standard audit fields: createdAt, updatedAt, deletedAt, createdBy, updatedBy
Timeline Events follow the platform-wide soft-delete convention. Setting deletedAt hides an event from public views without permanently destroying the historical record.

Timeline Event Schema

Every timeline event maps to the following Prisma model. Audit columns are shared across all entities in the system.
model TimelineEvent {
  id          String    @id @default(uuid())
  date        DateTime
  period      String?
  title       String
  description String?   // Rich text (Tiptap HTML/JSON)
  category    String?
  mediaIds    String[]
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
  deletedAt   DateTime?
  createdBy   String?
  updatedBy   String?
}
mediaIds stores UUIDs of MediaAsset records managed by the Multimedia Module. The Timeline module never owns or duplicates media files — it only holds references.

API Reference

All endpoints follow the platform’s REST conventions. Requests to mutating endpoints (POST, PATCH, DELETE) require a valid JWT bearer token.
GET    /timeline
GET    /timeline/:id
POST   /timeline
PATCH  /timeline/:id
DELETE /timeline/:id

Query Parameters (GET /timeline)

ParameterTypeDescription
categorystringFilter by event category (e.g. epidemic)
yearnumberFilter events whose date falls within the year
fromstringISO 8601 start date for a date-range filter
tostringISO 8601 end date for a date-range filter
pagenumberPage number (default 1)
limitnumberResults per page (default 20, max 100)
orderstringasc (oldest first) or desc (newest first)

Create a Timeline Event

POST /timeline
Content-Type: application/json
Authorization: Bearer <token>
{
  "date": "2020-03-20",
  "period": "2020",
  "title": "Primeros casos COVID-19 en la Jurisdicción",
  "description": "Se confirman los primeros tres casos de COVID-19 en el municipio de Huejutla de Reyes, Hidalgo, iniciando el protocolo de respuesta epidemiológica de la Jurisdicción Sanitaria.",
  "category": "epidemic",
  "mediaIds": []
}
A successful creation returns 201 Created with the full event object, including the generated id.

Update a Timeline Event

PATCH /timeline/:id
Content-Type: application/json
Authorization: Bearer <token>
All fields are optional in a PATCH body; only the fields provided are updated. The updatedAt and updatedBy columns are set automatically by the service layer.

Delete a Timeline Event

DELETE /timeline/:id
Authorization: Bearer <token>
Returns 204 No Content. The event is soft-deleted by setting deletedAt to the current timestamp. It no longer appears in public API responses but remains in the database for audit purposes.

Filtering and Views

The timeline API is designed for flexible querying without returning unbounded lists.

Filter by Category

Pass ?category=epidemic to retrieve only events classified under that category. Categories are free-form strings; no enumeration is enforced at the API level.

Filter by Year or Date Range

Use ?year=2020 for a single year, or combine ?from=2019-01-01&to=2022-12-31 for a custom range. Both parameters are optional and composable.

Pagination

All list endpoints return paginated results with page and limit. The response envelope includes total, page, limit, and data.

Sorting

Use ?order=asc to present events oldest-first (ideal for a reading experience) or ?order=desc for newest-first (ideal for a news-feed style view).

Example Paginated Response

{
  "total": 47,
  "page": 1,
  "limit": 20,
  "data": [
    {
      "id": "a1b2c3d4-...",
      "date": "2020-03-20T00:00:00.000Z",
      "period": "2020",
      "title": "Primeros casos COVID-19 en la Jurisdicción",
      "category": "epidemic",
      "mediaIds": [],
      "createdAt": "2024-01-15T10:00:00.000Z",
      "updatedAt": "2024-01-15T10:00:00.000Z",
      "deletedAt": null
    }
  ]
}

Frontend Display

The React frontend renders the timeline as a vertical chronological list sorted oldest-to-newest by default. Events are grouped by year, with the year displayed as a prominent section header. Each event card shows:
  • Title — as the primary heading
  • Date / Period — formatted for the es-MX locale
  • Category badge — colour-coded by category
  • Thumbnail — the first attached media asset, if any
  • Excerpt — the first 160 characters of description
  • Related content links — inline chips linking to associated CMS articles
Administrators see an additional toolbar on each card with quick-access Edit and Delete actions, gated behind the timeline:write permission scope.
Because timeline events are proper database entities, the AI chatbot can retrieve and cite them in the same semantic search pipeline used for CMS content. Publishing a well-described timeline event automatically enriches the chatbot’s knowledge base.

Multimedia

Manage the images, videos, and documents attached to timeline events.

CMS Overview

Understand how timeline events relate to the broader content model.

Chatbot

See how timeline data is indexed and surfaced via semantic search.

Build docs developers (and LLMs) love