fix: enum stop_type required uppercase values in supabase

This commit is contained in:
2026-02-25 23:48:33 -05:00
parent 6303aa4b35
commit 1368e21af1
5 changed files with 53 additions and 8 deletions

View File

@ -12,9 +12,9 @@
<div class="form-group">
<label>Tipo</label>
<select v-model="formData.stop_type">
<option value="regular">Regular</option>
<option value="terminal">Terminal</option>
<option value="express_only">Solo Expreso</option>
<option value="REGULAR">Regular</option>
<option value="TERMINAL">Terminal</option>
<option value="EXPRESS_ONLY">Solo Expreso</option>
</select>
</div>
@ -79,7 +79,7 @@ const formData = ref({
name: '',
latitude: 8.4284, // Default (David)
longitude: -82.4309,
stop_type: 'regular',
stop_type: 'REGULAR' as import('@/types').StopType,
has_shelter: false,
has_seating: false,
is_accessible: false,

View File

@ -1,7 +1,7 @@
/** Type definitions for the SIBU transportation app */
export type RouteStatus = 'ACTIVE' | 'INACTIVE' | 'MAINTENANCE'
export type StopType = 'terminal' | 'regular' | 'express_only'
export type StopType = 'TERMINAL' | 'REGULAR' | 'EXPRESS_ONLY'
export type ScheduleType = 'weekday' | 'weekend' | 'holiday'
export interface Route {

View File

@ -75,6 +75,9 @@ async function loadStops() {
function translateType(type: string) {
const types: Record<string, string> = {
'REGULAR': 'Regular',
'TERMINAL': 'Terminal',
'EXPRESS_ONLY': 'Solo Expreso',
'regular': 'Regular',
'terminal': 'Terminal',
'express_only': 'Solo Expreso'

View File

@ -264,7 +264,7 @@ async function initRouteMap() {
name,
latitude: lat,
longitude: lng,
stop_type: 'regular',
stop_type: 'REGULAR',
has_shelter: false,
has_seating: false,
is_accessible: true,
@ -274,8 +274,9 @@ async function initRouteMap() {
allStops.value = await busStopsService.getAllBusStops()
// Add to current route
await addExistingStop(newStop.id)
} catch (err) {
alert('Error creando parada')
} catch (err: any) {
console.error("Error creating map stop:", err)
alert('Error creando parada: ' + (err.message || 'Error desconocido'))
}
}
})