avaliabrasil/avalia-brasil

api.avaliabrasil.org/survey/ shouldn't require category id

Closed this issue · 1 comments

api.avaliabrasil.org/survey/ shouldn't require category id.
Currently, If we dont include the category property on this url:

http://api.avaliabrasil.org/survey/some_google_place_id

The server crashes. Instead of asking a category Id, the server should query the placetype table with the placeTypeId, get corresponding category id, and then inserting the new place.

{"userId":"1","newPlace":true,"category":2,"placeTypeId":"106","address":"blablala","name":"Sao leopoldo","cityName":"Sao leopoldo","stateLetter":"RS","answers":[{"questionId":"1","questionType":"likert","answer":"4"},{"questionId":"2","questionType":"likert","answer":"5"},{"questionId":"3","questionType":"likert","answer":"4"},{"questionId":"4","questionType":"likert","answer":"5"},{"questionId":"5","questionType":"likert","answer":"3"},{"questionId":"6","questionType":"likert","answer":"4"},{"questionId":"7","questionType":"likert","answer":"5"},{"questionId":"8","questionType":"likert","answer":"4"},{"questionId":"9","questionType":"likert","answer":"4"},{"questionId":"10","questionType":"likert","answer":"3"},{"questionId":"11","questionType":"likert","answer":"4"},{"questionId":"12","questionType":"likert","answer":"5"},{"questionId":"13","questionType":"likert","answer":"4"},{"questionId":"14","questionType":"likert","answer":"5"},{"questionId":"15","questionType":"likert","answer":"4"},{"questionId":"16","questionType":"likert","answer":"3"},{"questionId":"17","questionType":"likert","answer":"3"},{"questionId":"18","questionType":"likert","answer":"3"},{"questionId":"19","questionType":"likert","answer":"4"},{"questionId":"20","questionType":"likert","answer":"3"},{"questionId":"21","questionType":"likert","answer":"4"},{"questionId":"22","questionType":"likert","answer":"5"},{"questionId":"23","questionType":"comment","answer":"fooi bom"}]}

Done. Passed QA.