web / app/api/v1/events/route
app/api/v1/events/route
This file defines the API route for fetching a list of events.
It provides a flexible endpoint that allows clients to retrieve events based on a variety of filters, including catalog, datasets, geographic bounds, and date ranges. The handler uses the canonical filter pipeline to build a Payload CMS Where clause, with access control enforced both through the filter model and Payload’s built-in access control.
Variables
GET
constGET: (req,context) =>Promise<Response>
Parameters
req
NextRequest
context
params
Promise<Record<string, string>>
Returns
Promise<Response>
Functions
transformEvent()
transformEvent(
event):object
Parameters
event
Event
Returns
object
id
id:
number
dataset
dataset:
object
dataset.id
id:
number
dataset.name?
optionalname?:string
dataset.catalog?
optionalcatalog?:string
data
data:
Record<string,unknown>
location
location:
{ longitude: number; latitude: number; }|null
eventTimestamp
eventTimestamp:
string
isValid
isValid:
boolean