Description
The CreateGiveawayModal form contains a category/type selector with values like "electronics", "clothing", etc. The validation.ts file has a validateCategory function. However, the Post model in schema.prisma has no category field. The API POST /api/posts does not accept or store a category. Category information entered by users is silently discarded.
More info
- Add
category String? @db.VarChar(100) to the Post model.
- Generate and apply a migration.
- Update
POST /api/posts to accept and store category.
- Update
GET /api/posts to support ?category=electronics filtering.
- Predefined categories should be stored as an enum or a
Category lookup table to ensure consistency.
Description
The
CreateGiveawayModalform contains a category/type selector with values like"electronics","clothing", etc. Thevalidation.tsfile has avalidateCategoryfunction. However, thePostmodel inschema.prismahas nocategoryfield. The APIPOST /api/postsdoes not accept or store a category. Category information entered by users is silently discarded.More info
category String? @db.VarChar(100)to thePostmodel.POST /api/poststo accept and storecategory.GET /api/poststo support?category=electronicsfiltering.Categorylookup table to ensure consistency.