Closed footnote closed 9 years ago
@footnote can you double check that you are running into the user thumbnails not being returned for the normal /posts route. Spent a couple hours looking and it seems like it is being returned.
@ShadiFares
It works now, but we noticed that there are null values which may result to crash the app, please return an empty array instead
We need the example. We added test cases to confirm this isn't occurring anymore but we can't confirm it using old data. Can you give us the route that you experienced this on so we can replicate.
That being said, a null value is a reasonable case when talking about values returned in a property. A missing property is not a reasonable case.
Anyways, share the example and we will do our best to stop that from happening, that being said you should also expect null values in the situation there is an issue with an upload.
In addition to the above you suggested we return an empty array. I didn't think we were even returning an array of images for the user. As far as I know we only have image for each user.
userImage: { type: String, ref: 'Image' },
I have confirmed here we only have one image for the user so we would not return an array but a single value. That means when we don't have a value we shouldn't be returning a null array (as requested above) but simply a null value. Let's discuss. We definitely don't want to remove a property but a null value seems to be reasonable when the value has not been set. An alternative would be to force the user to attach a userImage as that would ensure there were no null values.
GET /v1/users/{userId}/posts
GET /v1/posts