mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 06:06:56 +08:00
32 lines
821 B
Ruby
32 lines
821 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
module V1
|
|
class ReportsController < BaseController
|
|
before_action :load_team
|
|
before_action :load_project
|
|
before_action :load_report, only: :show
|
|
|
|
def index
|
|
reports = timestamps_filter(@project.reports).page(params.dig(:page, :number))
|
|
.per(params.dig(:page, :size))
|
|
render jsonapi: reports,
|
|
each_serializer: ReportSerializer,
|
|
hide_project: true
|
|
end
|
|
|
|
def show
|
|
render jsonapi: @report,
|
|
serializer: ReportSerializer,
|
|
hide_project: true,
|
|
include: :user
|
|
end
|
|
|
|
private
|
|
|
|
def load_report
|
|
@report = @project.reports.find(params.require(:id))
|
|
end
|
|
end
|
|
end
|
|
end
|