-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: add more metadata in POST to /api/v1/books #34
Conversation
- added ability to include the metadata property in the books POST endpoint to set things like coverPath - add .nvmrc for node v13.14.0
Hey @wrobbins - thanks for the contribution! This is a neat idea. Some questions:
Curious your thoughts. Also - I'm in the middle of migrating things to a new host and updating the deploy pipeline. Hoping to get that work wrapped up soon and then pushing out these changes should be a breeze 😎 |
Howdy!
Happy to continue discussions if warranted. Cool project ! |
Oh boy! That's awesome! TIL You're right about the host permissions - I feel paranoid though and would rather not trust the environment configuration to protect against that type of stuff 😅 . I think it's also from a user experience standpoint - if the user passes some weird file path we aren't leaving it to chance what they get back. Ooo - didn't realize I already had validation for this. Seems like a good spot. Would also be reasonable to add the other Thanks for the being so thorough with this! |
- new: documentation for the shape of the JSON that .fromJSON takes - new: 400 error invalid metadata key in ctor of book - new: fields now supported in POST /api/v1/books: - genre - language - series - sequence - tags - publisher - genre
@haroldtreen changed to a Draft to facilitate a little less noisy collaboration, perhaps ? I think I covered the immediate things we talked about but Code Climate may grow the scope of this change ...
-- or --
-- or -- Book does have a lot of responsibilities which could be extracted out into more SRP files and classes
To extract a handful of them it could look like:
|
Hey @wrobbins ! Thanks for all these updates. I have done most of the code with very little input, so really nice getting your perspective. Code climate wise - I haven't been following it strictly. I mainly added it to see what it would suggest and put things on my radar. So could see a case for adding this feature and refactoring after. That being said - I also see the case for breaking up the book class and like your proposed changes (although maybe instead of an Suppose it's up to you. If getting this feature in will solve a use case for you and you're ready to move on - happy to just get it merged. Also going to want to update |
@haroldtreen I'm good merging it now and following up with a bit of clean up of Book, Let me know how I can help getting docs updated - just not sure how you are doing things now. Since these capabilities are additive and option it should work with the clients. I have a couple other ideas to modify this server if you're up for hearing them. |
Sounds good! A lot of this code was written in 2016 with 0 external reviews - so appreciate getting your insight! I've recently tried to revisit all this and improve things - just spent the last couple of weeks setting up continuous deployment and making things more observable. Would like to make the iteration quicker for this and simplify all the development / deployment. Perhaps improvement/direction ideas would be best fleshed out in a With all the follow-up steps written out - LGTM 🎉 . (I think this will be one of the first features to go out via CD - fingers crossed 🤞 !) |
Discovered some issues with this feature! Womp womp :(.
I've created a ticket to track this work: #38 Always more work to be done 😅 |
I added the first requirement to #38 For the second; it works when you give it a JPG .. I'm not sure how far down the rabbit you want to go on validation. How about we test for valid file extensions in the url (png, jpg, gif) ? How do you feel about adding some labels to this project ala https://help.github.com/en/github/managing-your-work-on-github/applying-labels-to-issues-and-pull-requests ? |
@haroldtreen looks like c3e3b32 broke custom cover paths. It appears that I was wrong about custom cover paths being downloaded from nodepub I don't think a rollback of either commit is needed, but I'm going to make another PR to fix this issue if you're good with that. |
Ah - interesting... when I went to run the example I was seeing the default cover image coming through. I poked around and it seemed like the custom cover code was potentially setting it to something else... maybe I'll have to check again. Agreed it doesn't seem to be broken so I didn't bother with rolling back. Not sure the best fix for this... perhaps the Open to other fix ideas though. The publishing pipeline is already pretty intense :P. |
Added more optional fields that nodepub supports to the create book endpoint:
coverPath
image used for the book (can only be http or https)publisher
default EpubPressgenre
default Unknownseries
default emptysequence
default emptytags
default emptyadd .nvmrc for node v13.14.0; although github actions say node 14, they are using 13. I had problems running tests when using 14.
Now you can do this: