MerryFairyTalesAD440 / API

1 stars 2 forks source link

Mikal sprint 4 bugs #108

Closed mviencek closed 5 years ago

mviencek commented 5 years ago

fixing bug when book isnt created with a page object set to null. more than half of the books in the db dont have a page object. for example -

{ "id": "6ce5dcb2-7b9d-4017-96dc-e9f75735697b", "description": "The second book in the series about the battle for Middle Earth.", "author": "JRR Tolkien", "title": "The Two Towers", "_rid": "QO9LAPsfmOM1AAAAAAAAAA==", "_self": "dbs/QO9LAA==/colls/QO9LAPsfmOM=/docs/QO9LAPsfmOM1AAAAAAAAAA==/", "_etag": "\"390021f5-0000-0000-0000-5c7e0f710000\"", "_attachments": "attachments/", "_ts": 1551765361 }

this was causing a 500 error when trying to post a page. a book should be instantiated with a page object set to null like this one

{ "id": "f7603c88-278c-4211-bfc8-549644172954", "description": "This thought-provoking French children's book teaches lessons about life and human nature.", "author": " Antoine de Saint-Exupery", "cover_image": null, "title": "The Little Prince", "pages": null, "_rid": "QO9LAPsfmOM-AAAAAAAAAA==", "_self": "dbs/QO9LAA==/colls/QO9LAPsfmOM=/docs/QO9LAPsfmOM-AAAAAAAAAA==/", "_etag": "\"00004897-0000-0000-0000-5c8410c40000\"", "_attachments": "attachments/", "_ts": 1552158916 }

but this should fix it in case this continues to happen.

Tested an deployed to my one box.