Initial upload of BB-Apartment 2026 website.
Adds the complete Next.js website including i18n routing, house and apartment pages, Beds24 v2 integration for live availability/pricing, Stripe checkout, contact forms, Docker setup and deployment docs. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
232770afe7
commit
2b24334bfa
@@ -0,0 +1,44 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { getEffectiveMinStay } from "@/src/lib/beds24";
|
||||
import { getApartmentBySlug, bookingConfig } from "@/src/config/apartments";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const apartmentSlug = searchParams.get("apartmentSlug");
|
||||
const arrival = searchParams.get("arrival");
|
||||
|
||||
if (!apartmentSlug || !arrival) {
|
||||
return NextResponse.json(
|
||||
{ error: "Missing required parameters: apartmentSlug, arrival" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const apartment = getApartmentBySlug(apartmentSlug);
|
||||
if (!apartment) {
|
||||
return NextResponse.json(
|
||||
{ error: "Apartment not found" },
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
const minStayNights = await getEffectiveMinStay(
|
||||
apartment.houseId,
|
||||
apartment.beds24PropertyId,
|
||||
apartment.beds24RoomId,
|
||||
arrival,
|
||||
bookingConfig.minStayNights
|
||||
);
|
||||
|
||||
return NextResponse.json({ apartmentSlug, arrival, minStayNights });
|
||||
} catch (error) {
|
||||
console.error("Min-stay API error:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to determine minimum stay" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user