From 3b172e44d84940c60781069063a709c587a215a9 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sun, 18 May 2025 02:22:37 +0900 Subject: [PATCH] =?UTF-8?q?#7=20=E3=82=B3=E3=83=B3=E3=83=88=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=83=A9=E7=AD=89=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/Gemfile | 2 +- backend/Gemfile.lock | 6 +- .../controllers/ip_addresses_controller.rb | 20 +++++ .../nico_tag_relation_controller.rb | 16 ++++ .../app/controllers/post_tags_controller.rb | 16 ++++ .../app/controllers/settings_controller.rb | 16 ++++ .../app/controllers/tag_aliases_controller.rb | 16 ++++ backend/app/controllers/tags_controller.rb | 16 ++++ .../app/controllers/user_ips_controller.rb | 16 ++++ .../controllers/user_post_views_controller.rb | 16 ++++ backend/app/controllers/users_controller.rb | 16 ++++ .../app/controllers/wiki_pages_controller.rb | 16 ++++ backend/config/routes.rb | 85 ++++++++++++++++--- .../ip_addresses_controller_test.rb | 28 ++++++ .../nico_tag_relation_controller_test.rb | 28 ++++++ .../controllers/post_tags_controller_test.rb | 28 ++++++ .../controllers/settings_controller_test.rb | 28 ++++++ .../tag_aliases_controller_test.rb | 28 ++++++ .../test/controllers/tags_controller_test.rb | 28 ++++++ .../controllers/user_ips_controller_test.rb | 28 ++++++ .../user_post_views_controller_test.rb | 28 ++++++ .../test/controllers/users_controller_test.rb | 28 ++++++ .../controllers/wiki_pages_controller_test.rb | 28 ++++++ 23 files changed, 518 insertions(+), 19 deletions(-) create mode 100644 backend/app/controllers/ip_addresses_controller.rb create mode 100644 backend/app/controllers/nico_tag_relation_controller.rb create mode 100644 backend/app/controllers/post_tags_controller.rb create mode 100644 backend/app/controllers/settings_controller.rb create mode 100644 backend/app/controllers/tag_aliases_controller.rb create mode 100644 backend/app/controllers/tags_controller.rb create mode 100644 backend/app/controllers/user_ips_controller.rb create mode 100644 backend/app/controllers/user_post_views_controller.rb create mode 100644 backend/app/controllers/users_controller.rb create mode 100644 backend/app/controllers/wiki_pages_controller.rb create mode 100644 backend/test/controllers/ip_addresses_controller_test.rb create mode 100644 backend/test/controllers/nico_tag_relation_controller_test.rb create mode 100644 backend/test/controllers/post_tags_controller_test.rb create mode 100644 backend/test/controllers/settings_controller_test.rb create mode 100644 backend/test/controllers/tag_aliases_controller_test.rb create mode 100644 backend/test/controllers/tags_controller_test.rb create mode 100644 backend/test/controllers/user_ips_controller_test.rb create mode 100644 backend/test/controllers/user_post_views_controller_test.rb create mode 100644 backend/test/controllers/users_controller_test.rb create mode 100644 backend/test/controllers/wiki_pages_controller_test.rb diff --git a/backend/Gemfile b/backend/Gemfile index a469a24..eb980d6 100644 --- a/backend/Gemfile +++ b/backend/Gemfile @@ -39,7 +39,7 @@ gem 'sprockets-rails' group :development, :test do # 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/] gem "brakeman", require: false diff --git a/backend/Gemfile.lock b/backend/Gemfile.lock index 06366a7..f95a83a 100644 --- a/backend/Gemfile.lock +++ b/backend/Gemfile.lock @@ -88,9 +88,6 @@ GEM connection_pool (2.5.3) crass (1.0.6) date (3.4.1) - debug (1.10.0) - irb (~> 1.10) - reline (>= 0.3.8) dotenv (3.1.8) drb (2.2.1) ed25519 (1.4.0) @@ -107,7 +104,7 @@ GEM json (2.12.0) jwt (2.10.1) base64 - kamal (2.6.0) + kamal (2.6.1) activesupport (>= 7.0) base64 (~> 0.2) bcrypt_pbkdf (~> 1.0) @@ -315,7 +312,6 @@ PLATFORMS DEPENDENCIES bootsnap brakeman - debug jwt kamal mysql2 (~> 0.5.6) diff --git a/backend/app/controllers/ip_addresses_controller.rb b/backend/app/controllers/ip_addresses_controller.rb new file mode 100644 index 0000000..5ede22a --- /dev/null +++ b/backend/app/controllers/ip_addresses_controller.rb @@ -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 diff --git a/backend/app/controllers/nico_tag_relation_controller.rb b/backend/app/controllers/nico_tag_relation_controller.rb new file mode 100644 index 0000000..974f20e --- /dev/null +++ b/backend/app/controllers/nico_tag_relation_controller.rb @@ -0,0 +1,16 @@ +class NicoTagRelationController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/post_tags_controller.rb b/backend/app/controllers/post_tags_controller.rb new file mode 100644 index 0000000..467074e --- /dev/null +++ b/backend/app/controllers/post_tags_controller.rb @@ -0,0 +1,16 @@ +class PostTagsController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/settings_controller.rb b/backend/app/controllers/settings_controller.rb new file mode 100644 index 0000000..379ca82 --- /dev/null +++ b/backend/app/controllers/settings_controller.rb @@ -0,0 +1,16 @@ +class SettingsController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/tag_aliases_controller.rb b/backend/app/controllers/tag_aliases_controller.rb new file mode 100644 index 0000000..cbfd36f --- /dev/null +++ b/backend/app/controllers/tag_aliases_controller.rb @@ -0,0 +1,16 @@ +class TagAliasesController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/tags_controller.rb b/backend/app/controllers/tags_controller.rb new file mode 100644 index 0000000..a3456b0 --- /dev/null +++ b/backend/app/controllers/tags_controller.rb @@ -0,0 +1,16 @@ +class TagsController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/user_ips_controller.rb b/backend/app/controllers/user_ips_controller.rb new file mode 100644 index 0000000..c02396b --- /dev/null +++ b/backend/app/controllers/user_ips_controller.rb @@ -0,0 +1,16 @@ +class UserIpsController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/user_post_views_controller.rb b/backend/app/controllers/user_post_views_controller.rb new file mode 100644 index 0000000..2bcefcd --- /dev/null +++ b/backend/app/controllers/user_post_views_controller.rb @@ -0,0 +1,16 @@ +class UserPostViewsController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/users_controller.rb b/backend/app/controllers/users_controller.rb new file mode 100644 index 0000000..69c5332 --- /dev/null +++ b/backend/app/controllers/users_controller.rb @@ -0,0 +1,16 @@ +class UsersController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/app/controllers/wiki_pages_controller.rb b/backend/app/controllers/wiki_pages_controller.rb new file mode 100644 index 0000000..b8bba76 --- /dev/null +++ b/backend/app/controllers/wiki_pages_controller.rb @@ -0,0 +1,16 @@ +class WikiPagesController < ApplicationController + def index + end + + def show + end + + def create + end + + def update + end + + def destroy + end +end diff --git a/backend/config/routes.rb b/backend/config/routes.rb index 168175c..2c339eb 100644 --- a/backend/config/routes.rb +++ b/backend/config/routes.rb @@ -1,15 +1,74 @@ 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 diff --git a/backend/test/controllers/ip_addresses_controller_test.rb b/backend/test/controllers/ip_addresses_controller_test.rb new file mode 100644 index 0000000..6621af6 --- /dev/null +++ b/backend/test/controllers/ip_addresses_controller_test.rb @@ -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 diff --git a/backend/test/controllers/nico_tag_relation_controller_test.rb b/backend/test/controllers/nico_tag_relation_controller_test.rb new file mode 100644 index 0000000..67d756d --- /dev/null +++ b/backend/test/controllers/nico_tag_relation_controller_test.rb @@ -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 diff --git a/backend/test/controllers/post_tags_controller_test.rb b/backend/test/controllers/post_tags_controller_test.rb new file mode 100644 index 0000000..e66d270 --- /dev/null +++ b/backend/test/controllers/post_tags_controller_test.rb @@ -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 diff --git a/backend/test/controllers/settings_controller_test.rb b/backend/test/controllers/settings_controller_test.rb new file mode 100644 index 0000000..96d644e --- /dev/null +++ b/backend/test/controllers/settings_controller_test.rb @@ -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 diff --git a/backend/test/controllers/tag_aliases_controller_test.rb b/backend/test/controllers/tag_aliases_controller_test.rb new file mode 100644 index 0000000..7f123a8 --- /dev/null +++ b/backend/test/controllers/tag_aliases_controller_test.rb @@ -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 diff --git a/backend/test/controllers/tags_controller_test.rb b/backend/test/controllers/tags_controller_test.rb new file mode 100644 index 0000000..e3e70ca --- /dev/null +++ b/backend/test/controllers/tags_controller_test.rb @@ -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 diff --git a/backend/test/controllers/user_ips_controller_test.rb b/backend/test/controllers/user_ips_controller_test.rb new file mode 100644 index 0000000..829e304 --- /dev/null +++ b/backend/test/controllers/user_ips_controller_test.rb @@ -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 diff --git a/backend/test/controllers/user_post_views_controller_test.rb b/backend/test/controllers/user_post_views_controller_test.rb new file mode 100644 index 0000000..e801175 --- /dev/null +++ b/backend/test/controllers/user_post_views_controller_test.rb @@ -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 diff --git a/backend/test/controllers/users_controller_test.rb b/backend/test/controllers/users_controller_test.rb new file mode 100644 index 0000000..8a960ac --- /dev/null +++ b/backend/test/controllers/users_controller_test.rb @@ -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 diff --git a/backend/test/controllers/wiki_pages_controller_test.rb b/backend/test/controllers/wiki_pages_controller_test.rb new file mode 100644 index 0000000..f32a54b --- /dev/null +++ b/backend/test/controllers/wiki_pages_controller_test.rb @@ -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