Snapshot of uncommitted work: landing, bots, prod infra, partner cabinet, backoffice stage 1
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
45d7512d2b
commit
d452824c62
314 files changed
+44394
-121
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { crmFetch } from '../../../../../../lib/flats';
|
||||
|
||||
/** Фото квартиры из CRM (обрезанное там же); кешируется браузером на сутки */
|
||||
export async function GET(_req: Request, { params }: { params: Promise<{ id: string; index: string }> }) {
|
||||
const { id, index } = await params;
|
||||
if (!/^\d{1,9}$/.test(id) || !/^\d{1,2}$/.test(index)) return new Response(null, { status: 404 });
|
||||
try {
|
||||
const res = await crmFetch(`/api/barev/objects/${id}/photos/${index}`, {
|
||||
next: { revalidate: 86_400 },
|
||||
});
|
||||
if (!res.ok) return new Response(null, { status: 404 });
|
||||
return new Response(res.body, {
|
||||
headers: {
|
||||
'content-type': 'image/jpeg',
|
||||
'cache-control': 'public, max-age=86400, stale-while-revalidate=604800',
|
||||
},
|
||||
});
|
||||
} catch {
|
||||
return new Response(null, { status: 502 });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user