|
|
|
|
@ -226,18 +226,14 @@ func New(services Services) *fiber.App {
|
|
|
|
|
var params struct {
|
|
|
|
|
LocationID int `query:"location_id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
locationIDText := strings.TrimSpace(ctx.Query("location_id"))
|
|
|
|
|
if locationIDText == "" {
|
|
|
|
|
return fmt.Errorf("missing query parameter location_id: %w", fiber.ErrBadRequest)
|
|
|
|
|
if err := ctx.Bind().Query(¶ms); err != nil {
|
|
|
|
|
return fmt.Errorf("failed to bind legacy prayer times query parameters: %w", errors.Join(fiber.ErrBadRequest, err))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
locationID, err := strconv.Atoi(locationIDText)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("failed to parse location_id query parameter: %w", errors.Join(fiber.ErrBadRequest, err))
|
|
|
|
|
if params.LocationID <= 0 {
|
|
|
|
|
return fmt.Errorf("missing query parameter location_id: %w", fiber.ErrBadRequest)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
legacyLocation, err := services.LegacyLocationProvider.GetLocationByID(ctx.Context(), locationID)
|
|
|
|
|
legacyLocation, err := services.LegacyLocationProvider.GetLocationByID(ctx.Context(), params.LocationID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("failed to resolve location by location_id: %w", errors.Join(fiber.ErrNotFound, err))
|
|
|
|
|
}
|
|
|
|
|
|