diff --git a/apps/web/prisma/schema.prisma b/apps/web/prisma/schema.prisma index 087331c..b2fa3d6 100644 --- a/apps/web/prisma/schema.prisma +++ b/apps/web/prisma/schema.prisma @@ -39,6 +39,7 @@ model Product { name String price Float nftMetadata Json + hidden Boolean? @default(false) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt shoppingCartItems ShoppingCartItem[] diff --git a/apps/web/src/app/_components/features/ProductList.tsx b/apps/web/src/app/_components/features/ProductList.tsx index d1ee2a7..abef35b 100644 --- a/apps/web/src/app/_components/features/ProductList.tsx +++ b/apps/web/src/app/_components/features/ProductList.tsx @@ -46,6 +46,7 @@ export default function ProductList({ products }: ProductListProps) { tokenId: product.tokenId, name: product.name, price: product.price, + hidden: false, nftMetadata: JSON.stringify({ imageUrl: "/default-image.webp", description: product.description, diff --git a/apps/web/src/app/_components/features/types.ts b/apps/web/src/app/_components/features/types.ts index ef447ed..6e19d69 100644 --- a/apps/web/src/app/_components/features/types.ts +++ b/apps/web/src/app/_components/features/types.ts @@ -15,6 +15,7 @@ export type Product = { name: string; price: number; nftMetadata: Prisma.JsonValue | NftMetadata; + hidden?: boolean | null; process?: string; createdAt: Date; updatedAt: Date; diff --git a/apps/web/src/server/api/routers/product.ts b/apps/web/src/server/api/routers/product.ts index 88ea3e0..2db496b 100755 --- a/apps/web/src/server/api/routers/product.ts +++ b/apps/web/src/server/api/routers/product.ts @@ -23,16 +23,24 @@ export const productRouter = createTRPCRouter({ z.object({ limit: z.number().min(1), cursor: z.number().optional(), + includeHidden: z.boolean().optional().default(false), }), ) .query(async ({ input }) => { - const { limit, cursor } = input; + const { limit, cursor, includeHidden } = input; const products = await db.product.findMany({ take: limit, skip: cursor ? 1 : 0, cursor: cursor ? { id: cursor } : undefined, orderBy: { id: "asc" }, + where: includeHidden + ? undefined + : { + NOT: { + hidden: true, + }, + }, }); const nextCursor =