From 8b0f026edb11e56c928ab25931b0c7395acfd2b6 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Sun, 8 Dec 2024 23:18:11 -0500 Subject: [PATCH] fixed activate listing bugs, fixed bugs related to clothing type, still want to add clothing type to listing display --- app/actions/listing/create-listing.ts | 13 ++++++++++--- app/create/components/CreateListingForm.tsx | 1 + app/create/components/ListingCategoryForm.tsx | 4 ++-- components/DeactivateListingButton.tsx | 2 +- dtos/listing/create-listing.ts | 4 ++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/actions/listing/create-listing.ts b/app/actions/listing/create-listing.ts index 2e74463..8f568ab 100644 --- a/app/actions/listing/create-listing.ts +++ b/app/actions/listing/create-listing.ts @@ -26,6 +26,10 @@ const presenceCheckBaseFields = (formData: FormData) => { "firmonprice", //firmonprice should be required ]; + // const clothingRequiredFields = [ + + // ] + for (const field of baseRequiredFields) { if (!formData.has(field)) { console.error(`Missing required field: ${field}`); @@ -70,6 +74,7 @@ export async function createListing(userId: number, formData: FormData) { description: formData.get("description"), type: formData.get("type"), category: formData.get("category"), + // condition: formData.get("condition"), firmonprice: formData.get("firmonprice"), //added this to fix bug brand: formData.get("brand"), @@ -89,7 +94,7 @@ export async function createListing(userId: number, formData: FormData) { apparelGender: formData.get("apparelGender"), }; } - + console.log("Listing Data: \n", listingData) const validatedListingFormData = createListingFormDataSchema.parse(listingData); @@ -117,12 +122,14 @@ export async function createListing(userId: number, formData: FormData) { category: validatedListingFormData.category, condition: validatedListingFormData.condition, acceptedPaymentTypes: validatedListingFormData.acceptedPaymentTypes, - // apparel: validatedListingFormData.apparelGender, - // size: validatedListingFormData.apparelSize, + // apparel: validatedListingFormData.apparelGender, //new + // size: validatedListingFormData.apparelSize, //new brand: validatedListingFormData.brand, //brand is another optional thing, so is also commented out ?? (the commenting out is something theron had originally done for some reason...) //apparel and size commented out? price: validatedListingFormData.price, + + }, }); revalidatePath("/"); diff --git a/app/create/components/CreateListingForm.tsx b/app/create/components/CreateListingForm.tsx index 0a862dd..76f2e84 100644 --- a/app/create/components/CreateListingForm.tsx +++ b/app/create/components/CreateListingForm.tsx @@ -50,6 +50,7 @@ const CreateListingForm = ({ userId }: CreateListingFormProps) => { ); const onFormSubmitError = useCallback((error: any) => { + console.log("failed to submit error") console.log(error); }, []); diff --git a/app/create/components/ListingCategoryForm.tsx b/app/create/components/ListingCategoryForm.tsx index a96c492..0efc3f4 100644 --- a/app/create/components/ListingCategoryForm.tsx +++ b/app/create/components/ListingCategoryForm.tsx @@ -51,7 +51,7 @@ export const ListingCategoryForm = () => { <>

Choose a size

(