Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes made For the library managment for AWS S3 #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/config/db.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
url: "mongodb://localhost:27017/bezkoder_db"
url: "mongodb://localhost:27017/Books"
};
25 changes: 21 additions & 4 deletions app/controllers/tutorial.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,35 @@ const Tutorial = db.tutorials;
// Create and Save a new Tutorial
exports.create = (req, res) => {
// Validate request
if (!req.body.title) {
if (!req.body.bookid) {
res.status(400).send({ message: "Content can not be empty!" });
return;
}

// Create a Tutorial
const tutorial = new Tutorial({
title: req.body.title,
description: req.body.description,
published: req.body.published ? req.body.published : false
name: req.body.name,
desc: req.body.desc,
page: req.body.page,
tag: req.body.tag,
author: req.body.author,
bucketid: req.body.bucketid,
thumb: req.body.thumb,
bookid: req.body.bookid
});

// {
// title: String,
// desc: String,
// page : String,
// tag: String,
// author: String,
// bucketid: String,
// thumb: String,
// bookid: String
// }


// Save Tutorial in the database
tutorial
.save(tutorial)
Expand Down
11 changes: 8 additions & 3 deletions app/models/tutorial.model.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
module.exports = mongoose => {
var schema = mongoose.Schema(
{
title: String,
description: String,
published: Boolean
name: String,
desc: String,
page : String,
tag: String,
author: String,
bucketid: String,
thumb: String,
bookid: String
},
{ timestamps: true }
);
Expand Down