feat: eigene Bilder pro Charge
Docker Image bauen und veroeffentlichen / build-and-push (push) Successful in 2m21s
Docker Image bauen und veroeffentlichen / build-and-push (push) Successful in 2m21s
Chargen hatten bisher kein eigenes Bild-Feld (nur Ernten und Produkte) — neue Migration ergaenzt Batch.images (Json-Array, gleiches Muster wie Harvest.images/Product.images). Admin kann Chargenfotos jetzt unter /admin/chargen/[id] hochladen (AdminImageListField, identisch zum Ernten-Formular). Die oeffentliche Chargen-Seite (/charge/[code]) zeigt diese Fotos jetzt bevorzugt, faellt ohne eigene Chargenbilder weiterhin auf die Erntebilder zurueck. Hinweis fuer den naechsten Live-Deploy: die generierte Migration hat nebenbei eine bereits laenger bestehende Schema-Abweichung mitkorrigiert (harvests.images und products.images/tasteTags werden jetzt als NOT NULL erzwungen, wie im Schema schon laenger deklariert) - "prisma migrate deploy" schlaegt fehl, falls dort noch echte NULL-Werte stehen sollten. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
1 parent
6742152626
commit
7d5c172487
9 files changed
+49
-6
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { asStringArray } from "@/lib/json-array";
|
||||
import { BackLink } from "@/components/back-link";
|
||||
import { AdminImageListField } from "@/components/admin-image-list-field";
|
||||
import { updateBatchAction } from "../../actions";
|
||||
import { getLocale } from "@/i18n/locale";
|
||||
import { getDictionary } from "@/i18n/get-dictionary";
|
||||
@@ -8,8 +10,9 @@ import { getDictionary } from "@/i18n/get-dictionary";
|
||||
export default async function AdminBatchEditPage(props: PageProps<"/admin/chargen/[id]">) {
|
||||
const t = getDictionary(await getLocale());
|
||||
const { id } = await props.params;
|
||||
const batch = await prisma.batch.findUnique({ where: { id }, include: { harvest: true } });
|
||||
if (!batch) notFound();
|
||||
const rawBatch = await prisma.batch.findUnique({ where: { id }, include: { harvest: true } });
|
||||
if (!rawBatch) notFound();
|
||||
const batch = { ...rawBatch, images: asStringArray(rawBatch.images) };
|
||||
|
||||
return (
|
||||
<div className="max-w-xl">
|
||||
@@ -64,6 +67,11 @@ export default async function AdminBatchEditPage(props: PageProps<"/admin/charge
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<AdminImageListField
|
||||
name="images"
|
||||
label={t.adminBatchEditPage.imagesLabel}
|
||||
initialValues={batch.images}
|
||||
/>
|
||||
<button type="submit" className="bg-forest text-cream px-6 py-2 text-sm">
|
||||
{t.adminBatchEditPage.save}
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user