mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-12 23:09:03 +01:00
23 lines
478 B
Ruby
23 lines
478 B
Ruby
# frozen_string_literal: true
|
|
|
|
# API Controller for resources of type StatisticProfilePrepaidPack
|
|
class API::UserPacksController < API::ApiController
|
|
before_action :authenticate_user!
|
|
|
|
def index
|
|
@user_packs = PrepaidPackService.user_packs(user, item)
|
|
end
|
|
|
|
private
|
|
|
|
def user
|
|
return User.find(params[:user_id]) if current_user.privileged?
|
|
|
|
current_user
|
|
end
|
|
|
|
def item
|
|
params[:priceable_type].classify.constantize.find(params[:priceable_id])
|
|
end
|
|
end
|