Google Maps Bug

This commit is contained in:
Eric Gullickson
2025-11-08 12:17:29 -06:00
parent efbe9ba3c0
commit bb4a356b9e
39 changed files with 1175 additions and 449 deletions

View File

@@ -8,7 +8,12 @@ import { StationsService } from '../domain/stations.service';
import { StationsRepository } from '../data/stations.repository';
import { pool } from '../../../core/config/database';
import { logger } from '../../../core/logging/logger';
import { StationSearchBody, SaveStationBody, StationParams } from '../domain/stations.types';
import {
StationSearchBody,
SaveStationBody,
StationParams,
UpdateSavedStationBody
} from '../domain/stations.types';
export class StationsController {
private stationsService: StationsService;
@@ -50,7 +55,14 @@ export class StationsController {
async saveStation(request: FastifyRequest<{ Body: SaveStationBody }>, reply: FastifyReply) {
try {
const userId = (request as any).user.sub;
const { placeId, nickname, notes, isFavorite } = request.body;
const {
placeId,
nickname,
notes,
isFavorite,
has93Octane,
has93OctaneEthanolFree
} = request.body;
if (!placeId) {
return reply.code(400).send({
@@ -62,7 +74,9 @@ export class StationsController {
const result = await this.stationsService.saveStation(placeId, userId, {
nickname,
notes,
isFavorite
isFavorite,
has93Octane,
has93OctaneEthanolFree
});
return reply.code(201).send(result);
@@ -82,6 +96,38 @@ export class StationsController {
});
}
}
async updateSavedStation(
request: FastifyRequest<{ Params: StationParams; Body: UpdateSavedStationBody }>,
reply: FastifyReply
) {
try {
const userId = (request as any).user.sub;
const { placeId } = request.params;
const result = await this.stationsService.updateSavedStation(placeId, userId, request.body);
return reply.code(200).send(result);
} catch (error: any) {
logger.error('Error updating saved station', {
error,
placeId: request.params.placeId,
userId: (request as any).user?.sub
});
if (error.message.includes('not found')) {
return reply.code(404).send({
error: 'Not Found',
message: error.message
});
}
return reply.code(500).send({
error: 'Internal server error',
message: 'Failed to update saved station'
});
}
}
async getSavedStations(request: FastifyRequest, reply: FastifyReply) {
try {
@@ -122,4 +168,4 @@ export class StationsController {
});
}
}
}
}