mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-10 17:39:38 +08:00
23 lines
548 B
Ruby
23 lines
548 B
Ruby
module Api
|
|
module V1
|
|
class TeamsController < BaseController
|
|
before_action :load_team, only: :show
|
|
|
|
def index
|
|
teams = current_user.teams.page(params[:page]).per(params[:page_size])
|
|
render json: teams, each_serializer: TeamSerializer
|
|
end
|
|
|
|
def show
|
|
render json: @team, serializer: TeamSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def load_team
|
|
@team = Team.find(params.require(:id))
|
|
return render json: {}, status: :forbidden unless can_read_team?(@team)
|
|
end
|
|
end
|
|
end
|
|
end
|