Developer Assessment Test: Product Filtering, Admin Reporting, and Prisma Model Extension#9
Developer Assessment Test: Product Filtering, Admin Reporting, and Prisma Model Extension#9subyster wants to merge 9 commits into
Conversation
|
@subyster is attempting to deploy a commit to the Sesto Team on Vercel. A member of the Team first needs to authorize it. |
removed test dotevn dependency
|
It was okay for your assignment to use my repo as the base? |
|
My bad, you can close here if you want to. I realized it was pointing to your repository right after the pull request was created. Then I created another one using my fork as the base. |
|
That's quite alright. I was just curious whether the people who assigned your task instructed you to use and edit my repo or whether you decided to do it on your own. |
|
They've sent me your repo as a base for my accessment test. |
(This PR description is the same as added at the beggining of
README.mdfile)This project implements all three parts of the technical challenge using Next.js, Prisma, Tailwind CSS, shadcn/ui, and React best practices.
🚧 Setting things up
To make sure project runs as expected a few steps first:
Create your own .env files in both admin and storefront projects. (Some variables won't be used here)
Install dependencies in both admin and storefront projects.
Setup a project in Supabase (recommended) or PostgreSQL database of your choice
After setting up your DATABASE_URL in .env file run this command to create tables in database.
Note: I took some time trying to make SMTP and JWT variables to work, but then realized they weren't necessary to this accessment. As for part 2 in admin report page, tested whole page without permission control, then added it to
middleware.tsmatcher list.1️⃣ Rebuild product filters on the storefront page
cmdkand shadcn'sCommandItemstyle.category.title IN [...]).next/navigationhooks (useSearchParams,useRouter,usePathname) to synchronize filters with the URL query string.AvailableTogglejust because I thought it was a nice filter.2️⃣ Build an admin reports page with charts or tables
ReportsPageunder the admin app.orderItems.productanduser.createdAt DESC.Calendarfor that.date-fnsto ensure the end date (to) includes the full day (i.e.,endOfDay(to)).3️⃣ Extend the Product model for cross-sell recommendations
Productmodel.seed.tsso after running migration and database commands products are randomly given crossSell relations. Tested field in Supabase pannel.toastnotification usingshadcn/ui. Chose that one because it was already installed in project and I'm used to work with it.try/catcherror when adding/removing items from cart.🚀 Final Touches
DateRange).fromdate selected).