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>
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { NextResponse } from "next/server";
|
|
import { getRoomInfo } from "@/src/lib/beds24";
|
|
import { allApartments } from "@/src/config/apartments";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
try {
|
|
const rooms = await Promise.all(
|
|
allApartments.map(async (apartment) => {
|
|
const info = await getRoomInfo(
|
|
apartment.houseId,
|
|
apartment.beds24PropertyId,
|
|
apartment.beds24RoomId
|
|
);
|
|
return {
|
|
slug: apartment.slug,
|
|
beds24RoomId: apartment.beds24RoomId,
|
|
beds24PropertyId: apartment.beds24PropertyId,
|
|
name: apartment.name,
|
|
nameEn: apartment.nameEn,
|
|
beds24Name: info.name,
|
|
maxGuests: info.maxGuests,
|
|
minStay: info.minStay,
|
|
currency: info.currency,
|
|
};
|
|
})
|
|
);
|
|
|
|
return NextResponse.json({ rooms });
|
|
} catch (error) {
|
|
console.error("Rooms API error:", error);
|
|
return NextResponse.json(
|
|
{ error: "Failed to fetch rooms" },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|