|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +class Api::V1::ConstantsController < ApplicationController |
| 4 | + # GET /api/v1/constants |
| 5 | + # Public endpoint - no authentication required |
| 6 | + def index |
| 7 | + render json: { |
| 8 | + data: { |
| 9 | + regions: regions_data, |
| 10 | + organization: organization_data, |
| 11 | + user: user_data, |
| 12 | + player: player_data, |
| 13 | + match: match_data, |
| 14 | + scrim: scrim_data, |
| 15 | + competitive_match: competitive_match_data, |
| 16 | + opponent_team: opponent_team_data, |
| 17 | + schedule: schedule_data, |
| 18 | + team_goal: team_goal_data, |
| 19 | + vod_review: vod_review_data, |
| 20 | + vod_timestamp: vod_timestamp_data, |
| 21 | + scouting_target: scouting_target_data, |
| 22 | + champion_pool: champion_pool_data |
| 23 | + } |
| 24 | + } |
| 25 | + end |
| 26 | + |
| 27 | + private |
| 28 | + |
| 29 | + def regions_data |
| 30 | + { |
| 31 | + values: Constants::REGIONS, |
| 32 | + names: Constants::REGION_NAMES |
| 33 | + } |
| 34 | + end |
| 35 | + |
| 36 | + def organization_data |
| 37 | + { |
| 38 | + tiers: { |
| 39 | + values: Constants::Organization::TIERS, |
| 40 | + names: Constants::Organization::TIER_NAMES |
| 41 | + }, |
| 42 | + subscription_plans: { |
| 43 | + values: Constants::Organization::SUBSCRIPTION_PLANS, |
| 44 | + names: Constants::Organization::SUBSCRIPTION_PLAN_NAMES |
| 45 | + }, |
| 46 | + subscription_statuses: Constants::Organization::SUBSCRIPTION_STATUSES |
| 47 | + } |
| 48 | + end |
| 49 | + |
| 50 | + def user_data |
| 51 | + { |
| 52 | + roles: { |
| 53 | + values: Constants::User::ROLES, |
| 54 | + names: Constants::User::ROLE_NAMES |
| 55 | + } |
| 56 | + } |
| 57 | + end |
| 58 | + |
| 59 | + def player_data |
| 60 | + { |
| 61 | + roles: { |
| 62 | + values: Constants::Player::ROLES, |
| 63 | + names: Constants::Player::ROLE_NAMES |
| 64 | + }, |
| 65 | + statuses: { |
| 66 | + values: Constants::Player::STATUSES, |
| 67 | + names: Constants::Player::STATUS_NAMES |
| 68 | + }, |
| 69 | + queue_ranks: Constants::Player::QUEUE_RANKS, |
| 70 | + queue_tiers: Constants::Player::QUEUE_TIERS |
| 71 | + } |
| 72 | + end |
| 73 | + |
| 74 | + def match_data |
| 75 | + { |
| 76 | + types: { |
| 77 | + values: Constants::Match::TYPES, |
| 78 | + names: Constants::Match::TYPE_NAMES |
| 79 | + }, |
| 80 | + sides: { |
| 81 | + values: Constants::Match::SIDES, |
| 82 | + names: Constants::Match::SIDE_NAMES |
| 83 | + } |
| 84 | + } |
| 85 | + end |
| 86 | + |
| 87 | + def scrim_data |
| 88 | + { |
| 89 | + types: { |
| 90 | + values: Constants::Scrim::TYPES, |
| 91 | + names: Constants::Scrim::TYPE_NAMES |
| 92 | + }, |
| 93 | + focus_areas: { |
| 94 | + values: Constants::Scrim::FOCUS_AREAS, |
| 95 | + names: Constants::Scrim::FOCUS_AREA_NAMES |
| 96 | + }, |
| 97 | + visibility_levels: { |
| 98 | + values: Constants::Scrim::VISIBILITY_LEVELS, |
| 99 | + names: Constants::Scrim::VISIBILITY_NAMES |
| 100 | + } |
| 101 | + } |
| 102 | + end |
| 103 | + |
| 104 | + def competitive_match_data |
| 105 | + { |
| 106 | + formats: { |
| 107 | + values: Constants::CompetitiveMatch::FORMATS, |
| 108 | + names: Constants::CompetitiveMatch::FORMAT_NAMES |
| 109 | + }, |
| 110 | + sides: { |
| 111 | + values: Constants::CompetitiveMatch::SIDES, |
| 112 | + names: Constants::Match::SIDE_NAMES |
| 113 | + } |
| 114 | + } |
| 115 | + end |
| 116 | + |
| 117 | + def opponent_team_data |
| 118 | + { |
| 119 | + tiers: { |
| 120 | + values: Constants::OpponentTeam::TIERS, |
| 121 | + names: Constants::OpponentTeam::TIER_NAMES |
| 122 | + } |
| 123 | + } |
| 124 | + end |
| 125 | + |
| 126 | + def schedule_data |
| 127 | + { |
| 128 | + event_types: { |
| 129 | + values: Constants::Schedule::EVENT_TYPES, |
| 130 | + names: Constants::Schedule::EVENT_TYPE_NAMES |
| 131 | + }, |
| 132 | + statuses: { |
| 133 | + values: Constants::Schedule::STATUSES, |
| 134 | + names: Constants::Schedule::STATUS_NAMES |
| 135 | + } |
| 136 | + } |
| 137 | + end |
| 138 | + |
| 139 | + def team_goal_data |
| 140 | + { |
| 141 | + categories: { |
| 142 | + values: Constants::TeamGoal::CATEGORIES, |
| 143 | + names: Constants::TeamGoal::CATEGORY_NAMES |
| 144 | + }, |
| 145 | + metric_types: { |
| 146 | + values: Constants::TeamGoal::METRIC_TYPES, |
| 147 | + names: Constants::TeamGoal::METRIC_TYPE_NAMES |
| 148 | + }, |
| 149 | + statuses: { |
| 150 | + values: Constants::TeamGoal::STATUSES, |
| 151 | + names: Constants::TeamGoal::STATUS_NAMES |
| 152 | + } |
| 153 | + } |
| 154 | + end |
| 155 | + |
| 156 | + def vod_review_data |
| 157 | + { |
| 158 | + types: { |
| 159 | + values: Constants::VodReview::TYPES, |
| 160 | + names: Constants::VodReview::TYPE_NAMES |
| 161 | + }, |
| 162 | + statuses: { |
| 163 | + values: Constants::VodReview::STATUSES, |
| 164 | + names: Constants::VodReview::STATUS_NAMES |
| 165 | + } |
| 166 | + } |
| 167 | + end |
| 168 | + |
| 169 | + def vod_timestamp_data |
| 170 | + { |
| 171 | + categories: { |
| 172 | + values: Constants::VodTimestamp::CATEGORIES, |
| 173 | + names: Constants::VodTimestamp::CATEGORY_NAMES |
| 174 | + }, |
| 175 | + importance_levels: { |
| 176 | + values: Constants::VodTimestamp::IMPORTANCE_LEVELS, |
| 177 | + names: Constants::VodTimestamp::IMPORTANCE_NAMES |
| 178 | + }, |
| 179 | + target_types: { |
| 180 | + values: Constants::VodTimestamp::TARGET_TYPES, |
| 181 | + names: Constants::VodTimestamp::TARGET_TYPE_NAMES |
| 182 | + } |
| 183 | + } |
| 184 | + end |
| 185 | + |
| 186 | + def scouting_target_data |
| 187 | + { |
| 188 | + statuses: { |
| 189 | + values: Constants::ScoutingTarget::STATUSES, |
| 190 | + names: Constants::ScoutingTarget::STATUS_NAMES |
| 191 | + }, |
| 192 | + priorities: { |
| 193 | + values: Constants::ScoutingTarget::PRIORITIES, |
| 194 | + names: Constants::ScoutingTarget::PRIORITY_NAMES |
| 195 | + } |
| 196 | + } |
| 197 | + end |
| 198 | + |
| 199 | + def champion_pool_data |
| 200 | + { |
| 201 | + mastery_levels: { |
| 202 | + values: Constants::ChampionPool::MASTERY_LEVELS.to_a, |
| 203 | + names: Constants::ChampionPool::MASTERY_LEVEL_NAMES |
| 204 | + }, |
| 205 | + priority_levels: Constants::ChampionPool::PRIORITY_LEVELS.to_a |
| 206 | + } |
| 207 | + end |
| 208 | +end |
0 commit comments