mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 22:25:30 +08:00
22 lines
535 B
Ruby
22 lines
535 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
module V1
|
|
class TeamsController < BaseController
|
|
before_action only: :show do
|
|
load_team(:id)
|
|
end
|
|
|
|
def index
|
|
teams = current_user.teams
|
|
.page(params.dig(:page, :number))
|
|
.per(params.dig(:page, :size))
|
|
render jsonapi: teams, each_serializer: TeamSerializer
|
|
end
|
|
|
|
def show
|
|
render jsonapi: @team, serializer: TeamSerializer, include: :created_by
|
|
end
|
|
end
|
|
end
|
|
end
|