Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change address handling in database #165

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Format and remove unused variable
nilspenzel committed Oct 24, 2024
commit c662c9fabf1a9b71825010f708706770f5cac4ae
4 changes: 3 additions & 1 deletion src/routes/(user)/company/+page.server.ts
Original file line number Diff line number Diff line change
@@ -78,7 +78,9 @@ export const actions = {

let bestAddressGuess: AddressGuess | undefined = undefined;
try {
bestAddressGuess = await geoCode(street+' '+house_number+' '+postal_code+' '+city);
bestAddressGuess = await geoCode(
street + ' ' + house_number + ' ' + postal_code + ' ' + city
);
} catch {
return fail(400, { error: 'Die Addresse konnte nicht gefunden werden.' });
}
4 changes: 3 additions & 1 deletion src/routes/(user)/company/+page.svelte
Original file line number Diff line number Diff line change
@@ -10,7 +10,9 @@
import ExclamationTriangle from 'svelte-radix/ExclamationTriangle.svelte';
import * as Alert from '$lib/components/ui/alert/index.js';

let { name, zone, street, house_number, postal_code, city, community_area } = $state(data.company!);
let { name, zone, street, house_number, postal_code, city, community_area } = $state(
data.company!
);
</script>

<div class="w-full h-full">
18 changes: 0 additions & 18 deletions src/routes/api/booking/+server.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ import { error, json, type RequestEvent } from '@sveltejs/kit';
import { hoursToMs, minutesToMs, secondsToMs } from '$lib/time_utils.js';
import { MAX_TRAVEL_DURATION, MIN_PREP_MINUTES } from '$lib/constants.js';
import { sql } from 'kysely';
import { getFareEstimation } from './fare-estimation/fare_estimation.js';
import { covers } from '$lib/sqlHelpers.js';

const startAndTargetShareZone = async (from: Coordinates, to: Coordinates) => {
@@ -399,23 +398,6 @@ export const POST = async (event: RequestEvent) => {
.execute();
});
if (tourId) {
try {
const fare_route = await getFareEstimation(
{
longitude: fromCoordinates.lng,
latitude: fromCoordinates.lat,
scheduled_time: startTime
},
{
longitude: toCoordinates.lng,
latitude: toCoordinates.lat,
scheduled_time: null
},
bestVehicle!.vehicleId
);
} catch (e) {
console.log(e);
}
return json({
status: 0,
companyId: bestVehicle!.companyId!,