diff options
| author | realtradam <[email protected]> | 2024-05-23 16:55:33 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2024-05-23 16:55:33 -0400 |
| commit | fd4edcfac9041cadfc4c88257555c02736bc4ba4 (patch) | |
| tree | 934d02f213f3cd07b19cf77a6868ab05e3bf271b | |
| parent | 6cf41b4a5c55c91974e31ac032d969c7481b3e80 (diff) | |
| download | gameHolster-fd4edcfac9041cadfc4c88257555c02736bc4ba4.tar.gz gameHolster-fd4edcfac9041cadfc4c88257555c02736bc4ba4.zip | |
update routes and params for games
| -rw-r--r-- | app/controllers/api/v1/games_controller.rb | 9 | ||||
| -rw-r--r-- | config/routes.rb | 39 | ||||
| -rw-r--r-- | db/migrate/20240521205000_create_games.rb | 3 | ||||
| -rw-r--r-- | db/schema.rb | 2 |
4 files changed, 32 insertions, 21 deletions
diff --git a/app/controllers/api/v1/games_controller.rb b/app/controllers/api/v1/games_controller.rb index 4338b2d..5a4fca0 100644 --- a/app/controllers/api/v1/games_controller.rb +++ b/app/controllers/api/v1/games_controller.rb @@ -106,7 +106,14 @@ class Api::V1::GamesController < ApplicationController private def game_params - params.require(:game).permit(:title, :card_img, :char_img, :title_img, game_files: []) + params.require(:game).permit( + :title, + :description, + :img_rendering, + :card_img, + :char_img, + :title_img, + game_files: []) end def allow_iframe diff --git a/config/routes.rb b/config/routes.rb index e738250..adbfb07 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,29 +1,30 @@ Rails.application.routes.draw do + # + # isolated domain, do not allow auth here + #constraints host: 'localhost' do + # GAMES + get 'game/:user/:game/*path/:file', to: 'api/v1/games#play' + get 'game/:user/:game/:file', to: 'api/v1/games#play' + #end + namespace :api do namespace :v1 do - # isolated domain, do not allow auth here - #constraints host: 'localhost' do - # GAMES - get 'game/:user/:game/*path/:file', to: 'games#play' - get 'game/:user/:game/:file', to: 'games#play' - #end - #constraints host: "localhost" do - # USERS - get 'users/index', to: 'users#index' + # USERS + get 'users/index', to: 'users#index' - # GAMES - post 'games', to: 'games#create' - get 'games', to: 'games#index' - #get 'games/:user/', to: 'games#show' - #get 'games/:user/:game', to: 'games#show' - get 'games_img/:user/:game', to: 'games#show_img' - #resources :games + # GAMES + post 'games', to: 'games#create' + get 'games', to: 'games#index' + #get 'games/:user/', to: 'games#show' + #get 'games/:user/:game', to: 'games#show' + get 'games_img/:user/:game', to: 'games#show_img' + #resources :games - # AUTH - get 'auth/callback', to: 'auth#callback' - get 'auth/data', to: 'auth#data' + # AUTH + get 'auth/callback', to: 'auth#callback' + get 'auth/data', to: 'auth#data' #end end diff --git a/db/migrate/20240521205000_create_games.rb b/db/migrate/20240521205000_create_games.rb index 61f5bab..236c070 100644 --- a/db/migrate/20240521205000_create_games.rb +++ b/db/migrate/20240521205000_create_games.rb @@ -3,7 +3,8 @@ class CreateGames < ActiveRecord::Migration[7.1] create_table :games do |t| t.string :title t.string :titleSlug - #t.text :body + t.string :description + t.string :img_rendering #t.integer :status, default: 0 #t.integer :order, default: 0 diff --git a/db/schema.rb b/db/schema.rb index a9b05b0..cee805e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -45,6 +45,8 @@ ActiveRecord::Schema[7.1].define(version: 2024_05_21_205000) do create_table "games", force: :cascade do |t| t.string "title" t.string "titleSlug" + t.string "description" + t.string "img_rendering" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "user_id", null: false |
