Реализация Page и DataCardWidget

This commit is contained in:
Даниил Музыченко
2026-06-08 22:55:30 +04:00
commit 68da4d2031
117 changed files with 9685 additions and 0 deletions
@@ -0,0 +1,11 @@
module Api
module V1
module Channels
class ApplicationController < ApplicationController
def resource_channel
@resource_channel ||= Channel.find(params[:channel_id])
end
end
end
end
end
@@ -0,0 +1,15 @@
module Api
module V1
module Channels
class HistoriesController < ApplicationController
before_action :resource_channel
def index
@history = @resource_channel.histories.last(100)
render json: @history
end
end
end
end
end
@@ -0,0 +1,27 @@
module Api
module V1
class ChannelsController < ApplicationController
def index
@channels = Channel.all
render json: @channels
end
def show
@channel = Channel.find(params[:id])
render json: @channel
end
def selected_index
ids = params[:ids]
if ids.present? && ids.is_a?(Array)
@channels = Channel.where(id: ids)
@channels = @channels.sort_by(&:id)
render json: @channels
else
render json: { error: "Invalid or missing ids" }, status: :unprocessable_entity
end
end
end
end
end
@@ -0,0 +1,5 @@
class ApplicationController < ActionController::API
# TODO: auth. users before exec request
# TODO: implement middleware for IP trottling
# TODO: implement request rate limit
end
View File