Passengers call this endpoint to place a tricimoto ride request. The server accepts decimal coordinates for both the pickup and drop-off points, converts them to PostGISDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DavidCevallos15/Crucidrive---APP/llms.txt
Use this file to discover all available pages before exploring further.
GEOGRAPHY(POINT) format using WKT notation, and persists a new row in public.viajes with a status of "solicitado" and a fixed tariff of $1.50. Available conductors can then see the request and accept it.
Access: requires the pasajero role. The route is protected by authMiddleware followed by roleMiddleware(['pasajero']), which reads the caller’s role from public.perfiles and rejects conductors or unauthenticated users.
Request
Bearer JWT from Supabase Auth. The authenticated user must have
rol = "pasajero" in public.perfiles.Pickup coordinates as a JSON object with
lat (latitude) and lng (longitude) expressed as decimal numbers. Both lat and lng are validated server-side.Drop-off coordinates as a JSON object with
lat and lng expressed as decimal numbers. Only destino.lat is validated server-side; destino.lng is accepted without an explicit null-check in the current implementation.Example request body
Response 201
Auto-generated UUID for the new ride record.
UUID of the passenger who requested the ride — sourced from
req.user.id.Pickup point stored as a WKT string, e.g.
"POINT(-80.5432 -1.0448)". Longitude is listed first per the WKT standard.Drop-off point stored as a WKT string, e.g.
"POINT(-80.5485 -1.0470)".Always
"solicitado" on creation. Transitions to "aceptado" when a conductor claims the ride.Fixed ride fare in USD. Always
1.50 at this time.ISO 8601 timestamp set by the database at insert time.
Error cases
| HTTP status | Cause |
|---|---|
400 | origen or destino is missing, or origen.lat, origen.lng, or destino.lat is missing (note: the current validation checks origen.lng twice and does not separately validate destino.lng) |
400 | Database insert error — e.g. a foreign-key violation on pasajero_id |
Full curl example
The tariff is currently hardcoded at
$1.50 for all rides in Crucita. A future release will replace this with a dynamic, sector-based tariff grid that accounts for distance zones within the town.Coordinates are stored as
POINT(lng lat) — longitude first, then latitude — which is the WKT standard and what PostGIS GEOGRAPHY columns expect. This is the reverse of the { lat, lng } order used in the request body. The conversion is handled automatically by the toWKT(lng, lat) utility before the DB insert.