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

Restrict /v1/rooms/-1/... #29

Open
arsley opened this issue Nov 26, 2018 · 1 comment
Open

Restrict /v1/rooms/-1/... #29

arsley opened this issue Nov 26, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@arsley
Copy link
Member

arsley commented Nov 26, 2018

-1を指定された時の対処を考えていなかった。
Bad requestを返す形にする。

@arsley arsley added the bug Something isn't working label Nov 26, 2018
@arsley
Copy link
Member Author

arsley commented Nov 27, 2018

この問題は #30 と競合していた。
status: 1 && room_id: -1を満たすExamは 正しく機能していれば 存在しないため、Couldn't find...メッセージを返すようになっているはず。

$ curl https://smat-api-dev.herokuapp.com/v1/rooms/-1/questions | jq

{
  "message": "Couldn't find Exam with [WHERE \"exams\".\"status\" = $1 AND \"exams\".\"room_id\" = $2]"
}

ただ、ActiveRecord::RecordNotFoundが返るまでには全探索に近いことをするため、やはり制限は設けるべき。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant