Browse Source

#7 コントローラ等追加

#23
みてるぞ 2 months ago
parent
commit
3b172e44d8
23 changed files with 518 additions and 19 deletions
  1. +1
    -1
      backend/Gemfile
  2. +1
    -5
      backend/Gemfile.lock
  3. +20
    -0
      backend/app/controllers/ip_addresses_controller.rb
  4. +16
    -0
      backend/app/controllers/nico_tag_relation_controller.rb
  5. +16
    -0
      backend/app/controllers/post_tags_controller.rb
  6. +16
    -0
      backend/app/controllers/settings_controller.rb
  7. +16
    -0
      backend/app/controllers/tag_aliases_controller.rb
  8. +16
    -0
      backend/app/controllers/tags_controller.rb
  9. +16
    -0
      backend/app/controllers/user_ips_controller.rb
  10. +16
    -0
      backend/app/controllers/user_post_views_controller.rb
  11. +16
    -0
      backend/app/controllers/users_controller.rb
  12. +16
    -0
      backend/app/controllers/wiki_pages_controller.rb
  13. +72
    -13
      backend/config/routes.rb
  14. +28
    -0
      backend/test/controllers/ip_addresses_controller_test.rb
  15. +28
    -0
      backend/test/controllers/nico_tag_relation_controller_test.rb
  16. +28
    -0
      backend/test/controllers/post_tags_controller_test.rb
  17. +28
    -0
      backend/test/controllers/settings_controller_test.rb
  18. +28
    -0
      backend/test/controllers/tag_aliases_controller_test.rb
  19. +28
    -0
      backend/test/controllers/tags_controller_test.rb
  20. +28
    -0
      backend/test/controllers/user_ips_controller_test.rb
  21. +28
    -0
      backend/test/controllers/user_post_views_controller_test.rb
  22. +28
    -0
      backend/test/controllers/users_controller_test.rb
  23. +28
    -0
      backend/test/controllers/wiki_pages_controller_test.rb

+ 1
- 1
backend/Gemfile View File

@@ -39,7 +39,7 @@ gem 'sprockets-rails'


group :development, :test do group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
# gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"


# Static analysis for security vulnerabilities [https://brakemanscanner.org/] # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem "brakeman", require: false gem "brakeman", require: false


+ 1
- 5
backend/Gemfile.lock View File

@@ -88,9 +88,6 @@ GEM
connection_pool (2.5.3) connection_pool (2.5.3)
crass (1.0.6) crass (1.0.6)
date (3.4.1) date (3.4.1)
debug (1.10.0)
irb (~> 1.10)
reline (>= 0.3.8)
dotenv (3.1.8) dotenv (3.1.8)
drb (2.2.1) drb (2.2.1)
ed25519 (1.4.0) ed25519 (1.4.0)
@@ -107,7 +104,7 @@ GEM
json (2.12.0) json (2.12.0)
jwt (2.10.1) jwt (2.10.1)
base64 base64
kamal (2.6.0)
kamal (2.6.1)
activesupport (>= 7.0) activesupport (>= 7.0)
base64 (~> 0.2) base64 (~> 0.2)
bcrypt_pbkdf (~> 1.0) bcrypt_pbkdf (~> 1.0)
@@ -315,7 +312,6 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
bootsnap bootsnap
brakeman brakeman
debug
jwt jwt
kamal kamal
mysql2 (~> 0.5.6) mysql2 (~> 0.5.6)


+ 20
- 0
backend/app/controllers/ip_addresses_controller.rb View File

@@ -0,0 +1,20 @@
class IpAddressesController < ApplicationController
def index
@ip_addresses = IpAddress.all

render json: @ip_addresses
end

def show
render json: @ip_address
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/nico_tag_relation_controller.rb View File

@@ -0,0 +1,16 @@
class NicoTagRelationController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/post_tags_controller.rb View File

@@ -0,0 +1,16 @@
class PostTagsController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/settings_controller.rb View File

@@ -0,0 +1,16 @@
class SettingsController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/tag_aliases_controller.rb View File

@@ -0,0 +1,16 @@
class TagAliasesController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/tags_controller.rb View File

@@ -0,0 +1,16 @@
class TagsController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/user_ips_controller.rb View File

@@ -0,0 +1,16 @@
class UserIpsController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/user_post_views_controller.rb View File

@@ -0,0 +1,16 @@
class UserPostViewsController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/users_controller.rb View File

@@ -0,0 +1,16 @@
class UsersController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 16
- 0
backend/app/controllers/wiki_pages_controller.rb View File

@@ -0,0 +1,16 @@
class WikiPagesController < ApplicationController
def index
end

def show
end

def create
end

def update
end

def destroy
end
end

+ 72
- 13
backend/config/routes.rb View File

@@ -1,15 +1,74 @@
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :posts
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", as: :rails_health_check

# Defines the root path route ("/")
# root "posts#index"
end
end
get "wiki_pages/index"
get "wiki_pages/show"
get "wiki_pages/create"
get "wiki_pages/update"
get "wiki_pages/destroy"
get "users/index"
get "users/show"
get "users/create"
get "users/update"
get "users/destroy"
get "user_post_views/index"
get "user_post_views/show"
get "user_post_views/create"
get "user_post_views/update"
get "user_post_views/destroy"
get "user_ips/index"
get "user_ips/show"
get "user_ips/create"
get "user_ips/update"
get "user_ips/destroy"
get "tags/index"
get "tags/show"
get "tags/create"
get "tags/update"
get "tags/destroy"
get "tag_aliases/index"
get "tag_aliases/show"
get "tag_aliases/create"
get "tag_aliases/update"
get "tag_aliases/destroy"
get "settings/index"
get "settings/show"
get "settings/create"
get "settings/update"
get "settings/destroy"
get "post_tags/index"
get "post_tags/show"
get "post_tags/create"
get "post_tags/update"
get "post_tags/destroy"
get "nico_tag_relation/index"
get "nico_tag_relation/show"
get "nico_tag_relation/create"
get "nico_tag_relation/update"
get "nico_tag_relation/destroy"
get "ip_addresses/index"
get "ip_addresses/show"
get "ip_addresses/create"
get "ip_addresses/update"
get "ip_addresses/destroy"
root 'home#index'

resources :posts
resources :ip_addresses
resources :nico_tag_relations
resources :post_tags
resources :settings
resources :tag_aliases
resources :tags
resources :user_ips
resources :user_post_views
resources :users
resources :wiki_pages

# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
# get "up" => "rails/health#show", as: :rails_health_check

# Defines the root path route ("/")
# root "posts#index"
end end

+ 28
- 0
backend/test/controllers/ip_addresses_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class IpAddressesControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get ip_addresses_index_url
assert_response :success
end

test "should get show" do
get ip_addresses_show_url
assert_response :success
end

test "should get create" do
get ip_addresses_create_url
assert_response :success
end

test "should get update" do
get ip_addresses_update_url
assert_response :success
end

test "should get destroy" do
get ip_addresses_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/nico_tag_relation_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class NicoTagRelationControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get nico_tag_relation_index_url
assert_response :success
end

test "should get show" do
get nico_tag_relation_show_url
assert_response :success
end

test "should get create" do
get nico_tag_relation_create_url
assert_response :success
end

test "should get update" do
get nico_tag_relation_update_url
assert_response :success
end

test "should get destroy" do
get nico_tag_relation_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/post_tags_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class PostTagsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get post_tags_index_url
assert_response :success
end

test "should get show" do
get post_tags_show_url
assert_response :success
end

test "should get create" do
get post_tags_create_url
assert_response :success
end

test "should get update" do
get post_tags_update_url
assert_response :success
end

test "should get destroy" do
get post_tags_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/settings_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class SettingsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get settings_index_url
assert_response :success
end

test "should get show" do
get settings_show_url
assert_response :success
end

test "should get create" do
get settings_create_url
assert_response :success
end

test "should get update" do
get settings_update_url
assert_response :success
end

test "should get destroy" do
get settings_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/tag_aliases_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class TagAliasesControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get tag_aliases_index_url
assert_response :success
end

test "should get show" do
get tag_aliases_show_url
assert_response :success
end

test "should get create" do
get tag_aliases_create_url
assert_response :success
end

test "should get update" do
get tag_aliases_update_url
assert_response :success
end

test "should get destroy" do
get tag_aliases_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/tags_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class TagsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get tags_index_url
assert_response :success
end

test "should get show" do
get tags_show_url
assert_response :success
end

test "should get create" do
get tags_create_url
assert_response :success
end

test "should get update" do
get tags_update_url
assert_response :success
end

test "should get destroy" do
get tags_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/user_ips_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class UserIpsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get user_ips_index_url
assert_response :success
end

test "should get show" do
get user_ips_show_url
assert_response :success
end

test "should get create" do
get user_ips_create_url
assert_response :success
end

test "should get update" do
get user_ips_update_url
assert_response :success
end

test "should get destroy" do
get user_ips_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/user_post_views_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class UserPostViewsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get user_post_views_index_url
assert_response :success
end

test "should get show" do
get user_post_views_show_url
assert_response :success
end

test "should get create" do
get user_post_views_create_url
assert_response :success
end

test "should get update" do
get user_post_views_update_url
assert_response :success
end

test "should get destroy" do
get user_post_views_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/users_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class UsersControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get users_index_url
assert_response :success
end

test "should get show" do
get users_show_url
assert_response :success
end

test "should get create" do
get users_create_url
assert_response :success
end

test "should get update" do
get users_update_url
assert_response :success
end

test "should get destroy" do
get users_destroy_url
assert_response :success
end
end

+ 28
- 0
backend/test/controllers/wiki_pages_controller_test.rb View File

@@ -0,0 +1,28 @@
require "test_helper"

class WikiPagesControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get wiki_pages_index_url
assert_response :success
end

test "should get show" do
get wiki_pages_show_url
assert_response :success
end

test "should get create" do
get wiki_pages_create_url
assert_response :success
end

test "should get update" do
get wiki_pages_update_url
assert_response :success
end

test "should get destroy" do
get wiki_pages_destroy_url
assert_response :success
end
end

Loading…
Cancel
Save