-
Notifications
You must be signed in to change notification settings - Fork 2
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
#165174100 Edit-Delete article #28
Conversation
21ecb89
to
98e12f8
Compare
routes/api/article.js
Outdated
router.put('/:articleId', auth, checkingArticle,multer, Article.updateArticle); | ||
// @Method Delete | ||
// @desc deleting articles | ||
router.delete('/:articleId', auth, checkingArticle,Article.deleteArticle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after ',' comma-spacing
routes/api/article.js
Outdated
@@ -11,5 +12,11 @@ router.post('/', auth, multer, Article.create); | |||
// @Method GET | |||
// @Desc get all created article | |||
router.get('/', Article.getArticle); | |||
// @Method PUT | |||
// @Desc update articles | |||
router.put('/:articleId', auth, checkingArticle,multer, Article.updateArticle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after ',' comma-spacing
98e12f8
to
cdd337a
Compare
cdd337a
to
f3b294b
Compare
f3b294b
to
7590b3c
Compare
controllers/user.js
Outdated
@@ -58,6 +58,7 @@ class UserController { | |||
}; | |||
return User.findOne({ where: { email: user.email } }) | |||
.then((foundUser) => { | |||
console.log('found user',foundUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after ',' comma-spacing
7590b3c
to
59cb933
Compare
|
||
chai.use(chaiHttp); | ||
chai.should(); | ||
const Article = models.article; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Article' is assigned a value but never used no-unused-vars
59cb933
to
42028be
Compare
test/3-artilcle.js
Outdated
res.should.have.status(403); | ||
done(); | ||
}) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 0 indent
test/3-artilcle.js
Outdated
} | ||
res.should.have.status(403); | ||
done(); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 2 indent
Missing semicolon semi
test/3-artilcle.js
Outdated
done(error); | ||
} | ||
res.should.have.status(403); | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 indent
test/3-artilcle.js
Outdated
if(error){ | ||
done(error); | ||
} | ||
res.should.have.status(403); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 indent
test/3-artilcle.js
Outdated
.end((error,res)=>{ | ||
if(error){ | ||
done(error); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 4 indent
test/3-artilcle.js
Outdated
}); | ||
//@delete article | ||
it("should return status code of 403 on deleting article",(done)=>{ | ||
chai.request(app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
test/3-artilcle.js
Outdated
}) | ||
}); | ||
//@delete article | ||
it("should return status code of 403 on deleting article",(done)=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after ',' comma-spacing
Expected indentation of 2 spaces but found 1 indent
Missing space after => arrow-spacing
Missing space before => arrow-spacing
Strings must use singlequote quotes
test/3-artilcle.js
Outdated
done(); | ||
}) | ||
}); | ||
//@delete article |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected exception block, space or tab after '//' in comment spaced-comment
Expected indentation of 2 spaces but found 1 indent
test/3-artilcle.js
Outdated
res.should.have.status(404); | ||
done(); | ||
}) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 1 indent
test/3-artilcle.js
Outdated
} | ||
res.should.have.status(404); | ||
done(); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 4 indent
Missing semicolon semi
42028be
to
5d94268
Compare
5d94268
to
2119436
Compare
e57abef
to
8b4843d
Compare
routes/api/article.js
Outdated
@@ -11,5 +12,14 @@ router.post('/', auth, multer, Article.create); | |||
// @Method GET | |||
// @Desc get all created article | |||
router.get('/', Article.getArticle); | |||
//@Method GET | |||
//@desc get single article | |||
router.get('/:articleId',Article.singleArticle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after ',' comma-spacing
routes/api/article.js
Outdated
@@ -11,5 +12,14 @@ router.post('/', auth, multer, Article.create); | |||
// @Method GET | |||
// @Desc get all created article | |||
router.get('/', Article.getArticle); | |||
//@Method GET | |||
//@desc get single article |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected exception block, space or tab after '//' in comment spaced-comment
routes/api/article.js
Outdated
@@ -11,5 +12,14 @@ router.post('/', auth, multer, Article.create); | |||
// @Method GET | |||
// @Desc get all created article | |||
router.get('/', Article.getArticle); | |||
//@Method GET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected exception block, space or tab after '//' in comment spaced-comment
8b4843d
to
9a230fa
Compare
9a230fa
to
0b09b12
Compare
@itsgracian your commit message is not following the conventions |
@itsgracian, I like the way you handled your tasks. But it would be better if you change your commit message because it does not follow our convention. |
cool, let me change it |
0b09b12
to
c0b1b85
Compare
- it has PUT method (/api/articles/:articleId) - GET Method viewing single article (/api/articles/:articleId) - DELETE Method delete article (/api/articles/:articleId) [Delivers #165174100]
c0b1b85
to
655c849
Compare
What does this PR do?
update and delete articles
Description of Task to be completed?
this PR allows a user to edit/update his article and delete an article. user who is allowed to update or delete article is the one who created an article and must be authenticated.
This PR also has the following endpoints:
How should this be manually tested?
{'title':'article1', 'body':'this article body' , 'tag':'programming,nodejs', 'image':'image.jpg'}
Screenshoots
What are the relevant pivotal tracker stories?
165174100