Skip to content

feat: 火気使用申請のユーザー画面制御を追加#2040

Open
YosukeIida wants to merge 1 commit intogm3/developfrom
feat/i2/2036-fire-equipment-page-control
Open

feat: 火気使用申請のユーザー画面制御を追加#2040
YosukeIida wants to merge 1 commit intogm3/developfrom
feat/i2/2036-fire-equipment-page-control

Conversation

@YosukeIida
Copy link
Copy Markdown
Collaborator

@YosukeIida YosukeIida commented May 1, 2026

対応Issue

resolve #2036

概要

  • admin のユーザー画面制御から,GM3 user 側の火気使用申請の受付可否を制御できるようにしました
  • user 側では admin の設定に応じて,火気使用申請を 受付中 / 受付終了 として表示します

実装詳細

  • user_page_settingsis_edit_fire_equipment_order を追加
  • UserPageSettingsControlleris_edit_fire_equipment_order を更新可能に変更
  • admin 側の ユーザー画面制御火気使用申請 の行とスイッチを追加
  • user 側の FireEquipmentisDeadline={!userPageSettings?.isEditFireEquipmentOrder} を渡すように変更
  • develop / production fixture に is_edit_fire_equipment_order: true を追加
  • admin_view の未使用依存 inject を削除
    • npm install 時に Invalid Version: 1.0.0beta2 で失敗していたため

画面スクリーンショット等

  • ローカル環境で admin / user を起動し,ブラウザで動作確認済み

テスト項目

  • make build-gm3-mac
  • docker compose run --rm user pnpm run type-check
  • docker compose run --rm user pnpm run lint
  • admin 側 ユーザー画面制御火気使用申請 を OFF にすると,user 側で 受付終了 になり,申請フォームが開かないこと
  • admin 側 ユーザー画面制御火気使用申請 を ON に戻すと,user 側で 受付中 になり,申請内容と 修正 ボタンが表示されること
  • docker compose run --rm api rails test

備考

  • docker compose run --rm api rails test は既存 fixture の schema 不整合で失敗しました
    • api/test/fixtures/assign_rental_items.yml が現在の schema と一致していないため
    • 今回変更した user_page_settings / 火気使用申請制御とは別件です

Summary by CodeRabbit

  • New Features

    • Added fire equipment order permission control to user page settings, displaying recruitment status with gated access to toggle editing permissions.
  • Chores

    • Removed unused package dependency.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

📝 Walkthrough

Walkthrough

A new user-page-settings control flag (is_edit_fire_equipment_order) is introduced across the stack to gate fire equipment order form availability. Changes include database schema migration, Rails API parameter whitelisting, admin Nuxt UI toggle, and frontend TypeScript type definitions/usage.

Changes

Cohort / File(s) Summary
Database Migration & Schema
api/db/migrate/20260501000001_add_is_edit_fire_equipment_order_to_user_page_settings.rb, api/db/schema.rb
Adds is_edit_fire_equipment_order boolean column (defaulting to true) to user_page_settings table; schema version updated to 2026_05_01_000001.
Database Fixtures
api/db/fixtures/develop/user_page_setting.rb, api/db/fixtures/production/user_page_setting.rb
Seeds is_edit_fire_equipment_order: true in both develop and production fixture data.
Rails API Controller
api/app/controllers/user_page_settings_controller.rb
Whitelists :is_edit_fire_equipment_order in strong parameters for create/update persistence.
Admin UI Control
admin_view/nuxt-project/pages/user_page_setting/index.vue
Adds status-dependent UI toggle ("募集中"/"募集締め切り") bound to new state variable; removes unused inject package dependency.
Frontend Type Definitions
user/src/api/userPageSettingAPI.ts
Adds isEditFireEquipmentOrder: boolean property to exported UserPageSettings type.
Frontend Usage
user/src/pages/home/index.tsx
Passes isDeadline={!userPageSettings?.isEditFireEquipmentOrder} to FireEquipment components across FOOD_SALES, GOODS_SALES, RESEARCH_LAB, and EXHIBITION category groups.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #1950: Implements the admin-side fire equipment order management pages and API endpoints that this control flag gates access to.

Suggested reviewers

  • harata-t

Poem

🔥 A toggle for the flames so bright,
Admin controls the form's green light—
When "募集中" shines with pride,
Fire equipment orders open wide,
But when recruiting doors must close,
The deadline flag delivers blows! 🚫

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding user screen control for fire equipment order acceptance in the system.
Description check ✅ Passed The PR description includes all essential sections (linked issue, overview, implementation details, screenshots, test items, and notes) with comprehensive information about the changes and testing requirements.
Linked Issues check ✅ Passed All code requirements from issue #2036 are met: database column added, controller params updated, fixtures seeded, admin UI control added, user API and home page updated with correct deadline logic.
Out of Scope Changes check ✅ Passed The removal of the unused 'inject' dependency from package.json addresses an npm install failure and is reasonably scoped to the PR, though it is tangentially related to the main feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/i2/2036-fire-equipment-page-control

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@YosukeIida YosukeIida marked this pull request as ready for review May 1, 2026 17:47
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
user/src/pages/home/index.tsx (1)

4-4: ⚡ Quick win

Avoid duplicating UserPageSettings type in this page.

The local type can drift from user/src/api/userPageSettingAPI.ts. Reusing the shared type will reduce contract mismatch risk.

♻️ Suggested simplification
-import { useGetUserPageSettings } from '@/api/userPageSettingAPI';
+import {
+  useGetUserPageSettings,
+  type UserPageSettings,
+} from '@/api/userPageSettingAPI';
@@
-type UserPageSettings = {
-  isEditPlace?: boolean;
-  isEditRentalOrder?: boolean;
-  isEditPowerOrder?: boolean;
-  isEditPublicRelation?: boolean;
-  isEditEmployee?: boolean;
-  isEditVenueMap?: boolean;
-  isEditFoodProduct?: boolean;
-  isEditPurchaseList?: boolean;
-  isEditCookingProcess?: boolean;
-  isEditFireEquipmentOrder?: boolean;
-  isEditStageOrder?: boolean;
-  isEditStageCommonOption?: boolean;
-  isRegistGroup?: boolean;
-  isEditSubRep?: boolean;
-};

Also applies to: 24-39

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@user/src/pages/home/index.tsx` at line 4, This file defines a local
UserPageSettings type that duplicates the one in
user/src/api/userPageSettingAPI.ts; remove the local type declarations and
instead import the shared UserPageSettings type from the API module and use it
everywhere the page currently references the local type (e.g., in state, props,
and function signatures around the useGetUserPageSettings usage and related
variables on lines ~24-39); update any type annotations to refer to the imported
UserPageSettings and ensure there are no leftover local declarations or
conflicting names.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@user/src/pages/home/index.tsx`:
- Line 4: This file defines a local UserPageSettings type that duplicates the
one in user/src/api/userPageSettingAPI.ts; remove the local type declarations
and instead import the shared UserPageSettings type from the API module and use
it everywhere the page currently references the local type (e.g., in state,
props, and function signatures around the useGetUserPageSettings usage and
related variables on lines ~24-39); update any type annotations to refer to the
imported UserPageSettings and ensure there are no leftover local declarations or
conflicting names.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 71513448-029b-448f-8396-fe4a8dd481b6

📥 Commits

Reviewing files that changed from the base of the PR and between 35ebba1 and a62bdb8.

⛔ Files ignored due to path filters (1)
  • admin_view/nuxt-project/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • admin_view/nuxt-project/package.json
  • admin_view/nuxt-project/pages/user_page_setting/index.vue
  • api/app/controllers/user_page_settings_controller.rb
  • api/db/fixtures/develop/user_page_setting.rb
  • api/db/fixtures/production/user_page_setting.rb
  • api/db/migrate/20260501000001_add_is_edit_fire_equipment_order_to_user_page_settings.rb
  • api/db/schema.rb
  • user/src/api/userPageSettingAPI.ts
  • user/src/pages/home/index.tsx
💤 Files with no reviewable changes (1)
  • admin_view/nuxt-project/package.json

@hikahana
Copy link
Copy Markdown
Contributor

hikahana commented May 2, 2026

@YosukeIida
ユーザー画面制御ってaddとeditの二つで管理してたと思うけど、isEditだけでいいの?
登録できるかと編集できるかは別管理になってたような

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 火気使用申請のユーザー画面制御追加

2 participants