Adjust to the in-house style

- Use jbuilder instead of hashes
- Use resource instead of direct HTTP verbs
    Verbs only make sense if you have one or two routes, if there are
    multiple that emulate what resource does then it's better to use resource.
- Paginate using link headers
- Cache responses
This commit is contained in:
Stanko K.R.
2026-08-11 13:15:34 +02:00
parent 20ab5b1bc6
commit 80c9e7fbfe
11 changed files with 205 additions and 140 deletions
+7 -4
View File
@@ -62,10 +62,13 @@ Rails.application.routes.draw do
resources :rooms do
resources :messages
# Bot API endpoints - authenticated via bot_key in URL
get ":bot_key/messages", to: "messages/by_bots#index", as: :bot_messages_index
post ":bot_key/messages", to: "messages/by_bots#create", as: :bot_messages
post ":bot_key/messages/:message_id/boosts", to: "messages/boosts/by_bots#create", as: :bot_message_boosts
nested do
scope path: ":bot_key", as: :bot, defaults: { format: :json } do
resources :messages, controller: "messages/by_bots", only: %i[ index create ] do
resources :boosts, controller: "messages/boosts/by_bots", only: :create
end
end
end
scope module: "rooms" do
resource :refresh, only: :show