Some refactor

This commit is contained in:
2025-12-28 18:41:31 +01:00
parent ce658849e9
commit eaf822d73a
11 changed files with 202 additions and 36 deletions

View File

@ -1,31 +1,18 @@
import { getSingleArtwork } from "@/actions/artworks/getArtworks";
import { getCategoriesWithTags } from "@/actions/categories/getCategories";
import { getTags } from "@/actions/tags/getTags";
import ArtworkColors from "@/components/artworks/single/ArtworkColors";
import ArtworkVariants from "@/components/artworks/single/ArtworkVariants";
import DeleteArtworkButton from "@/components/artworks/single/DeleteArtworkButton";
import EditArtworkForm from "@/components/artworks/single/EditArtworkForm";
import { prisma } from "@/lib/prisma";
export default async function ArtworkSinglePage({ params }: { params: { id: string } }) {
export default async function ArtworkSinglePage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const item = await prisma.artwork.findUnique({
where: { id },
include: {
// album: true,
// type: true,
file: true,
gallery: true,
metadata: true,
albums: true,
categories: true,
colors: { include: { color: true } },
// sortContexts: true,
tags: true,
variants: true
}
})
const item = await getSingleArtwork(id);
const categories = await prisma.artCategory.findMany({ include: { tags: true }, orderBy: { sortIndex: "asc" } });
const tags = await prisma.artTag.findMany({ orderBy: { sortIndex: "asc" } });
const categories = await getCategoriesWithTags();
const tags = await getTags();
if (!item) return <div>Artwork with this id not found</div>