Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET /events/query 的 locationId 改為 type Array #10

Open
amliu opened this issue Oct 10, 2018 · 2 comments
Open

GET /events/query 的 locationId 改為 type Array #10

amliu opened this issue Oct 10, 2018 · 2 comments

Comments

@amliu
Copy link

amliu commented Oct 10, 2018

目前 queryEvents() 的 locationId 是一個 string,
未來月曆應該是一次顯示多個地點的物資,
也可能在特殊頁面 (ex. admin page ) 有 filter 功能,
所以將 locationId 改為 Array 會是比較彈性的作法。
若沒給 locationId (null or []),
則是返回所有地點的事件

@SuJiaKuan
Copy link
Member

目前的作法如下:

  1. locationIdFalsy時,返回所有地點的事件
  2. locationIdString時,返回特定地點的事件

locationId改成Array增加彈性是個不錯的想法,或許有幾點可以討論:

  1. 欄位名稱是否要改成locationIds,更符合語議? (會有break change)
  2. 當值為[]時,應該是返回空陣列(雖然這樣做沒什麼意義...)還是所有地點的事件 ([]在JS是Truthy,語議上跟null, undefined會有區別)

還有另一種作法,是保持locationIdString,並且另開locationIdsArray,只是功能有點重複,變得有點多餘,不太建議。

@dreamcwli
Copy link
Collaborator

我覺得保留 locationId 另開 locationIds 可以作為過度期的解決方案,
如果只有無家者小幫手的前端會用到這個參數,
等到前端更新再把 locationId 拿掉就好了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants