themsaid/ergodnc

Returning `hidden` in the api response

aarbi opened this issue · 3 comments

aarbi commented

We are already excluding hidden offices in the response here, so all the offices in the api response would have hidden = false.

aarbi commented

I guess only the owner of the Office should be able to see its hidden value to manage them later
@themsaid what about adding to the OfficeResource this line after the $this->merge() call
'hidden' => $this->when($this->user_id == optional(auth()->user())->id , $this->hidden),

is it too early to talk about this in first place? may be in the future we will hide/show fields based on roles and in this case this issue should be closed

I've added a todo item:

[] Show hidden and unapproved offices when filtering by `user_id` so hosts can see all their listings

What you say makes sense. Thank you :)

As for the hidden field, I think it's ok to have it visible to every API client.

aarbi commented

Thank you sir!