forked from aditya-mitra/code-rush
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9676179
commit f9aeef0
Showing
16 changed files
with
150 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var express = require("express"); | ||
var router = express.Router(); | ||
var db = require("../../models"); | ||
|
||
|
||
router.get('/:cname', function (req, res, next) { | ||
var filteredQuestions = []; | ||
db.Question.find() | ||
.populate('category') | ||
.lean() | ||
.then(questions => { | ||
questions.forEach(question => { | ||
question.category.forEach(c => { | ||
if (c.name === req.params.cname.toString()) | ||
filteredQuestions.push(question); | ||
}) | ||
}) | ||
}) | ||
.then(() => { | ||
res.json({ questions: filteredQuestions }); | ||
}) | ||
.catch(e => next(e)); | ||
}) | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var express = require("express"); | ||
var router = express.Router(); | ||
var db = require("../../models"); | ||
var getQuestionsByCategory = require('./get'); | ||
|
||
router.use('/get', getQuestionsByCategory); | ||
|
||
router.get("/", function (req, res, next) { | ||
db.Category.find() | ||
.lean() | ||
.then((category) => res.json(category)) | ||
.catch((err) => next(err)); | ||
}); | ||
|
||
//POST ROUTE | ||
router.post("/:questionId/category", function (req, res, next) { | ||
db.Question.findById(req.params.questionId, function (err, questions) { | ||
if (err) { | ||
next(err); | ||
} else { | ||
db.Category.create(req.body, function (err1, newCategory) { | ||
if (err1) { | ||
next(err1); | ||
} else { | ||
res.json(newCategory); | ||
questions.category.push(newCategory._id); | ||
questions.save(); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import PageLink from 'next/link'; | ||
import { CardMedia, Card, CardActions, CardContent, Typography, Button } from "@material-ui/core"; | ||
|
||
const CCard = props => { | ||
const { title, subtitle, description, imageUrl } = props; | ||
return ( | ||
<Card style={{marginTop:"50px" , marginBottom:"30px"}}> | ||
const { link, description, imageUrl } = props; | ||
return ( | ||
<Card style={{ marginTop: "50px", marginBottom: "30px" }}> | ||
|
||
<CardMedia style={{ height: "150px" ,marginTop:"50px"}} image={imageUrl} /> | ||
<CardContent> | ||
<Typography variant="body2" component="p"> | ||
{description} | ||
</Typography> | ||
</CardContent> | ||
<CardActions> | ||
<Button size="small" color="primary"> | ||
Start | ||
</Button> | ||
</CardActions> | ||
</Card> | ||
); | ||
<CardMedia style={{ height: "150px", marginTop: "50px" }} image={imageUrl} /> | ||
<CardContent> | ||
<Typography variant="body2" component="p"> | ||
{description} | ||
</Typography> | ||
</CardContent> | ||
<CardActions> | ||
<Button size="small" color="primary"> | ||
<PageLink href={link}> Start</PageLink> | ||
</Button> | ||
</CardActions> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default CCard; | ||
export default CCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,48 @@ | ||
export default [ | ||
{ | ||
|
||
|
||
description: | ||
"Start Programming with C", | ||
imageUrl: | ||
"http://www.faadooengineers.com/online-study/assets/images/icon/BasicofCProgramming.png" | ||
"http://www.faadooengineers.com/online-study/assets/images/icon/BasicofCProgramming.png", | ||
link: "/questions?cname=c", | ||
}, | ||
{ | ||
description: | ||
"Start Programming with Java", | ||
|
||
imageUrl: | ||
"https://th.bing.com/th/id/OIP.KacZ5bUqrOnHMwyYXYUl4gHaEL?pid=Api&rs=1" | ||
"https://th.bing.com/th/id/OIP.KacZ5bUqrOnHMwyYXYUl4gHaEL?pid=Api&rs=1", | ||
link: "/questions?cname=java", | ||
|
||
}, | ||
{ | ||
|
||
|
||
description: | ||
"Start Programming with C++", | ||
imageUrl: | ||
"https://ih1.redbubble.net/image.416406976.0438/flat,550x550,075,f.jpg" | ||
"https://ih1.redbubble.net/image.416406976.0438/flat,550x550,075,f.jpg", | ||
link: "/questions?cname=cpp", | ||
}, | ||
{ | ||
description: | ||
"Start Programming With C++", | ||
"Start Programming With Python", | ||
imageUrl: | ||
"http://genderapi.io/assets/img/3rd-party-logos/python.png" | ||
"http://genderapi.io/assets/img/3rd-party-logos/python.png", | ||
link: "/questions?cname=python", | ||
}, | ||
{ | ||
|
||
description: | ||
"Start Programming with Ruby", | ||
imageUrl: | ||
"https://keyua.org/media/blog_images/ruby-logo_optimized.png" | ||
"https://keyua.org/media/blog_images/ruby-logo_optimized.png", | ||
link: "/questions?cname=ruby" | ||
}, | ||
{ | ||
|
||
description: | ||
'Start Programming with JavaScript.', | ||
imageUrl: | ||
"http://test.codersera.com/blog/wp-content/uploads/2020/06/JavaScript1-1024x576.jpeg" | ||
"http://test.codersera.com/blog/wp-content/uploads/2020/06/JavaScript1-1024x576.jpeg", | ||
link: "/questions?cname=java", | ||
} | ||
]; |
Oops, something went wrong.