-
Notifications
You must be signed in to change notification settings - Fork 8
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
#167164986 Users should be able to create novels #25
Conversation
85da93d
to
5c3fbdc
Compare
5c3fbdc
to
b8cc1ad
Compare
b8cc1ad
to
5bdeec6
Compare
5bdeec6
to
5caef49
Compare
#167164979 add user login feature
5caef49
to
37e8071
Compare
37e8071
to
f2267c7
Compare
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.
LGTM
f2267c7
to
0ab8965
Compare
0ab8965
to
e6f08ac
Compare
80afc92
to
e550e81
Compare
added verifyToken middleware [Starts #167164986]
e6f08ac
to
cab80b7
Compare
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.
LGTM
* @returns {object} json | ||
*/ | ||
const createNovel = async (req, res) => { | ||
const newNovel = req.body; |
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.
what happens if a column that's not in the database is sent in the request body?
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.
It's handled in the createNovel service. That's where I destructure the fields from the body
body | ||
} = novel; | ||
const getGenre = await Genre.findOne({ where: { name: genre } }); | ||
const slug = `${title.toLowerCase().split(' ').join('-')}-${author.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.
why are we appending the author id to the slug? the slug should be unique
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.
It is unique, the reason for the author id is to allow for different users to create novels with the same name but to limit the user from uploading a novel twice or with the same name. I used medium article links as a reference https://medium.com/@nerocodes/a-new-tool-i-found-5c634618c2bf
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.
ok
.isEmpty() | ||
.exists() | ||
.withMessage(`${field} is a required field`) | ||
.isIn(['action', 'thriller', 'romance', 'fiction', 'motivational']) |
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.
I don't think hardcoding this here is the best way to go considering you only covered a few genres
Pivotal tracker story
#167164986
What does this PR do?
Summary of Task
How can this be tested?
Screenshots (if appropriate)