-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feature/endpoint for removing image #66
base: master
Are you sure you want to change the base?
Conversation
ed3ed40
to
e2bd976
Compare
return knex.raw(` | ||
SELECT * | ||
FROM images | ||
WHERE id = ${req.params.id} |
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.
Prone to SQL injection. Should be...
knex.raw(`... WHERE id = ?`, req.params.id).then(...);
return Promise.all(rows.map(r => { | ||
return knex.raw(` | ||
DELETE FROM votes | ||
WHERE id = ${r.id} |
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.
Same here.
*/ | ||
function delImg(id) { | ||
return knex.raw(` | ||
DELETE FROM images WHERE id = ${id} |
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.
And here.
Adds an endpoint which user can use to remove images he/she has uploaded