Commit ae019bde by Rocky Duan

api for search threads by tags

parent d97e87ff
...@@ -45,6 +45,8 @@ get '/api/v1/threads/tags' do ...@@ -45,6 +45,8 @@ get '/api/v1/threads/tags' do
CommentThread.tags.to_json CommentThread.tags.to_json
end end
get '/api/v1/threads/:thread_id' do |thread_id| get '/api/v1/threads/:thread_id' do |thread_id|
thread.to_hash(recursive: params["recursive"]).to_json thread.to_hash(recursive: params["recursive"]).to_json
end end
...@@ -145,6 +147,10 @@ get '/api/v1/search' do ...@@ -145,6 +147,10 @@ get '/api/v1/search' do
end end
end end
post '/api/v1/search/tags' do
CommentThread.tagged_with_all(params["tags"]).map(&:to_hash).to_json
end
if environment.to_s == "development" if environment.to_s == "development"
get '/api/v1/clean' do get '/api/v1/clean' do
Comment.delete_all Comment.delete_all
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment