2018-08-24 17:26:49 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-31 19:40:27 +08:00
|
|
|
module Api
|
|
|
|
module V1
|
|
|
|
class TeamsController < BaseController
|
2018-11-07 22:43:44 +08:00
|
|
|
before_action only: :show do
|
|
|
|
load_team(:id)
|
|
|
|
end
|
2018-07-31 19:40:27 +08:00
|
|
|
|
|
|
|
def index
|
2023-07-31 18:21:40 +08:00
|
|
|
teams = timestamps_filter(current_user.teams).page(params.dig(:page, :number))
|
|
|
|
.per(params.dig(:page, :size))
|
2018-08-23 22:48:27 +08:00
|
|
|
render jsonapi: teams, each_serializer: TeamSerializer
|
2018-07-31 19:40:27 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2018-10-23 23:52:48 +08:00
|
|
|
render jsonapi: @team, serializer: TeamSerializer, include: :created_by
|
2018-07-31 19:40:27 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|