Skip to main content

update_events_status

Scans all Firestore events and marks any event with a date_end in the past as Finalizado. Run this on a schedule (e.g., via Cloud Scheduler) to keep event statuses current.

Endpoint

POST https://{region}-{project}.cloudfunctions.net/update_events_status

How it works

  1. Queries events collection for documents where date_end < now(), ordered by date_end ascending
  2. For each document with status == "Activo", updates status to "Finalizado" and sets date.updated to the current timestamp
  3. Returns a count of processed events

Request

{
  "data": {}
}
No parameters required.

Response

Events updated:
{
  "message": "Eventos Actualizados",
  "status": 200
}
No expired events found:
{
  "message": "Eventos no finalizados",
  "status": 400,
  "data": { "valido": false }
}
Schedule this function to run daily via Cloud Scheduler to ensure events are automatically marked as finished. Only events with status == "Activo" are updated — already-finalized events are skipped.

Build docs developers (and LLMs) love