Some refactor
This commit is contained in:
@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user