Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1209e91
Add initial files and packages
etiry Sep 13, 2023
67518c0
Fix faker
etiry Sep 13, 2023
daea59e
Add boilerplate
etiry Sep 13, 2023
59d011d
Add GET /products route with pagination
etiry Sep 14, 2023
50efa1d
Add eslint
etiry Sep 14, 2023
4b20269
eslint/prettier cleanup
etiry Sep 14, 2023
b72ed7e
Add GET /products/:productId route
etiry Sep 14, 2023
a21296d
Add review schema
etiry Sep 14, 2023
a468938
Randomly generate reviews for products
etiry Sep 14, 2023
749aee6
Fix typos
etiry Sep 14, 2023
c4dea85
Add GET /products/:productId/reviews route
etiry Sep 14, 2023
a844e10
Add POST routes
etiry Sep 14, 2023
23d31ef
Add sorting, filtering, and searching options
etiry Sep 14, 2023
777cc83
Initial React setup
etiry Sep 14, 2023
c8df428
Add dependencies
etiry Sep 14, 2023
6471dc2
Add product card component
etiry Sep 14, 2023
5140430
Show sample products in results component
etiry Sep 14, 2023
f4a83e3
Add search bar component
etiry Sep 14, 2023
1be6625
Import bootstrap and adjust layout
etiry Sep 14, 2023
f90acf0
Add another sample product
etiry Sep 14, 2023
1ce77b2
Add CORS package and RTK
etiry Sep 15, 2023
4ea23d2
Move RTK to UI folder
etiry Sep 15, 2023
ac7bfd8
Add results slice & call to API on page load
etiry Sep 15, 2023
cd77951
Add page navigation
etiry Sep 15, 2023
7f838d5
Remove sample data
etiry Sep 15, 2023
a1bb949
Render based on search parameters
etiry Sep 15, 2023
8215fbc
Make search parameters persist when paginating
etiry Sep 15, 2023
585ce2d
Fix styling
etiry Sep 15, 2023
4c88aaf
Add route to query all existing categories
etiry Sep 15, 2023
a4056d7
Update results on dropdown change
etiry Sep 16, 2023
a822e2c
Display content based on request status
etiry Sep 16, 2023
ca7b155
Refactor
etiry Sep 16, 2023
4f2935c
Reset results if filter or sort is removed
etiry Sep 16, 2023
3ab435f
Add comments
etiry Sep 16, 2023
ecaf59b
Leave search query after submit
etiry Sep 16, 2023
b12f887
Display no results found
etiry Sep 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
16 changes: 16 additions & 0 deletions models/product.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @module product */
/** Create model for product data */

const mongoose = require('mongoose');

const { Schema } = mongoose;

const ProductSchema = new Schema({
category: String,
name: String,
price: Number,
image: String,
reviews: [{ type: Schema.Types.ObjectId, ref: 'review' }]
});

module.exports = mongoose.model('product', ProductSchema);
14 changes: 14 additions & 0 deletions models/review.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @module review */
/** Create model for review data */

const mongoose = require('mongoose');

const { Schema } = mongoose;

const ReviewSchema = new Schema({
username: String,
text: String,
product: { type: Schema.Types.ObjectId, ref: 'product' }
});

module.exports = mongoose.model('review', ReviewSchema);
Loading