feat(portfolio): add artwork refinement and price visibility fields
This commit is contained in:
@@ -65,6 +65,25 @@ export const createArtworkInputSchema = z.object({
|
||||
year: z.number().int().min(1000).max(9999).optional(),
|
||||
framing: z.string().max(180).optional(),
|
||||
availability: z.string().max(180).optional(),
|
||||
priceAmountCents: z.number().int().min(0).optional(),
|
||||
priceCurrency: z.string().min(3).max(3).optional(),
|
||||
isPriceVisible: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export const updateArtworkInputSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
title: z.string().min(1).max(180).optional(),
|
||||
slug: z.string().min(1).max(180).optional(),
|
||||
description: z.string().max(5000).nullable().optional(),
|
||||
medium: z.string().max(180).nullable().optional(),
|
||||
dimensions: z.string().max(180).nullable().optional(),
|
||||
year: z.number().int().min(1000).max(9999).nullable().optional(),
|
||||
framing: z.string().max(180).nullable().optional(),
|
||||
availability: z.string().max(180).nullable().optional(),
|
||||
priceAmountCents: z.number().int().min(0).nullable().optional(),
|
||||
priceCurrency: z.string().min(3).max(3).nullable().optional(),
|
||||
isPriceVisible: z.boolean().optional(),
|
||||
isPublished: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export const createGroupingInputSchema = z.object({
|
||||
@@ -110,6 +129,7 @@ export type ArtworkRenditionSlot = z.infer<typeof artworkRenditionSlotSchema>
|
||||
export type CreateMediaAssetInput = z.infer<typeof createMediaAssetInputSchema>
|
||||
export type UpdateMediaAssetInput = z.infer<typeof updateMediaAssetInputSchema>
|
||||
export type CreateArtworkInput = z.infer<typeof createArtworkInputSchema>
|
||||
export type UpdateArtworkInput = z.infer<typeof updateArtworkInputSchema>
|
||||
export type CreateGroupingInput = z.infer<typeof createGroupingInputSchema>
|
||||
export type UpdateGroupingInput = z.infer<typeof updateGroupingInputSchema>
|
||||
export type DeleteGroupingInput = z.infer<typeof deleteGroupingInputSchema>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE "Artwork"
|
||||
ADD COLUMN "priceAmountCents" INTEGER,
|
||||
ADD COLUMN "priceCurrency" TEXT,
|
||||
ADD COLUMN "isPriceVisible" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -153,6 +153,9 @@ model Artwork {
|
||||
year Int?
|
||||
framing String?
|
||||
availability String?
|
||||
priceAmountCents Int?
|
||||
priceCurrency String?
|
||||
isPriceVisible Boolean @default(false)
|
||||
isPublished Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@ -35,6 +35,7 @@ export {
|
||||
listMediaFoundationGroups,
|
||||
listPublishedArtworks,
|
||||
listPublishedPortfolioGroups,
|
||||
updateArtwork,
|
||||
updateGrouping,
|
||||
updateMediaAsset,
|
||||
} from "./media-foundation"
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
createMediaAssetInputSchema,
|
||||
deleteGroupingInputSchema,
|
||||
linkArtworkGroupingInputSchema,
|
||||
updateArtworkInputSchema,
|
||||
updateGroupingInputSchema,
|
||||
updateMediaAssetInputSchema,
|
||||
} from "@cms/content"
|
||||
@@ -148,6 +149,16 @@ export async function createArtwork(input: unknown) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateArtwork(input: unknown) {
|
||||
const payload = updateArtworkInputSchema.parse(input)
|
||||
const { id, ...data } = payload
|
||||
|
||||
return db.artwork.update({
|
||||
where: { id },
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export async function createGallery(input: unknown) {
|
||||
const payload = createGroupingInputSchema.parse(input)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user