Skip to content

Commit a87429e

Browse files
committed
Changed in Product Model
1 parent 85cd2dc commit a87429e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

app/controllers/ProductsControllers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exports.createProduct = async (req, res) => {
1414
try {
1515
const newProduct = Product({
1616
name: req.body.name,
17-
description: req.body.description,
17+
color: req.body.color,
1818
price: req.body.price,
1919
image: req.body.image,
2020
});
@@ -33,7 +33,7 @@ exports.updateProduct = async (req, res) => {
3333
try {
3434
const targetProduct = await Product.findByIdAndUpdate(req.params.id, {
3535
name: req.body.name,
36-
description: req.body.description,
36+
color: req.body.color,
3737
price: req.body.price,
3838
image: req.body.image,
3939
});

app/models/ProductModel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const ProductSchema = mongoose.Schema({
44
name: {type: String},
55
price:{type:Number},
66
image: {type: String},
7-
description: {type: String},
7+
color: {type: String},
88
});
99

1010
const Product = mongoose.model("Product", ProductSchema);

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const githubRepoUrl =
99
"https://github.com/ScientificClubofESI/FlutterWorkshop_API";
1010

1111
app.use(cors());
12-
app.use(bodyParser.urlencoded({ extended: false }));
12+
1313
app.use(bodyParser.json());
1414
app.get("/", (req, res) => {
1515
res.send(

0 commit comments

Comments
 (0)