Code4HR / open-health-inspection-app

The frontend for Code for Hampton Roads' Open Health Inspection Data.
http://ohi.code4hr.org
GNU General Public License v3.0
13 stars 21 forks source link

JSON files from database break Angular #23

Closed wbprice closed 10 years ago

wbprice commented 10 years ago

The first couple of lines in the JSON for a given restuarant include something like:

"_id" : ObjectId("530907537d95393b690c216d"),

Looks like this is a function in a JSON, which doesn't validate. Deleting this line causes everything to work again. Not an ideal solution because this line serves as a good unique ID. Find some way to sanitize this input in API or in front-end?

BretFisher commented 10 years ago

that's mongodb standard document ID that gets added on insert. It should stay there for proper db function.

wbprice commented 10 years ago

Is this something that should be filtered out by the API when it serves JSON to the front-end?

ttavenner commented 10 years ago

These will be the ids you will reference for requesting specific documents. They shouldn't be served to the end user though.

ttavenner commented 10 years ago

For the API, the frontend should pass these as strings which will be converted by the API to objectids for the purposes of interfacing with Mongo.

ttavenner commented 10 years ago

At least that's what I think right now while the API is purely a pipe dream.

wbprice commented 10 years ago

Sounds good. I want to keep what I'm doing right now somewhat grounded in reality, so I'll just assume that I'm working with strings for the time being.

bschoenfeld commented 10 years ago

Is this something that should be filtered out by the API when it serves JSON to the front-end?

Yes. The server will convert the GUID to a string before sending it through the API.

wbprice commented 10 years ago

Yup, this is what's happening now that my local copy is pulling from the API.