feat(rental): Sprint F — photos & vidéos items rental
All checks were successful
CI / test (pull_request) Successful in 2m18s
All checks were successful
CI / test (pull_request) Successful in 2m18s
Nouveau modèle `RentalItemMedia` parallèle de `Media` (carbet) :
- s3Key / s3Url / sortOrder / type (PHOTO|VIDEO), cascade sur RentalItem
- Migration `20260603100000_rental_item_media` appliquée
Endpoints upload dédiés (mêmes conventions que carbet) :
- POST /api/uploads/rental-presign + POST /api/uploads/rental-finalize
→ auth par canManageRentalProvider (admin OR provider manager)
→ s3Key préfixé `rental-items/<itemId>/`
→ finalize hydrate `RentalItem.imageUrl` avec la première PHOTO
→ générateur de variantes (320/800/1600 via sharp) en best-effort
- DELETE /api/rental-media/[id] + POST /api/rental-media/reorder
→ reorder rafraîchit imageUrl (cover = sortOrder 0)
`MediaUploader` rendu générique :
- Nouveau prop `scope: {kind: "carbet" | "rental-item", id}` ; conserve
rétro-compat `carbetId` (deprecated)
- Endpoints + payload key (`carbetId` ↔ `itemId`) calculés via
`endpointsFor()`. Aucun changement de comportement côté carbet.
UI branchée :
- /admin/rental-items/[id] : section « Photos & vidéos » au-dessus du
form, alimentée par `item.media` chargé par `getRentalItemForAdmin`
- /espace-prestataire/items/[itemId] : idem, charge via `getHostItem`
- /materiel/[itemId] : nouveau `<ItemGallery />` (thumbs cliquables +
support vidéo). Fallback : ancien `item.imageUrl` si pas de média
dédié (compat seed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d42584cc4c
commit
9da58288dc
15 changed files with 521 additions and 25 deletions
|
|
@ -2,6 +2,7 @@ import { notFound } from "next/navigation";
|
|||
import Link from "next/link";
|
||||
|
||||
import { StatusBadge } from "@/components/admin/StatusBadge";
|
||||
import { MediaUploader } from "@/components/MediaUploader";
|
||||
import { getRentalItemForAdmin, listProvidersForSelect, RENTAL_CATEGORY_LABEL } from "@/lib/admin/rental-items";
|
||||
|
||||
import { ItemForm } from "../_components/ItemForm";
|
||||
|
|
@ -56,6 +57,14 @@ export default async function EditRentalItemPage({ params }: PageProps) {
|
|||
/>
|
||||
</header>
|
||||
|
||||
<section className="rounded-lg border border-zinc-200 bg-white p-5 shadow-sm">
|
||||
<h2 className="mb-3 text-base font-semibold text-zinc-900">Photos & vidéos</h2>
|
||||
<MediaUploader
|
||||
scope={{ kind: "rental-item", itemId: item.id }}
|
||||
initialMedia={item.media}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section className="rounded-lg border border-zinc-200 bg-white p-5 shadow-sm">
|
||||
<ItemForm
|
||||
providers={providers}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue