グループ管理

概要説明

グループ管理機能は、管理者にシステム内の組織グループを監視および管理するためのツールを提供します。管理者はグループの表示、作成、編集、削除、およびステータスの変更を行うことができます。各グループには、名前、作成者、パッケージサブスクリプション、ステータスなどの関連属性があります。この機能はロールベースのアクセス制御を実装しており、特定の操作は管理者のロールレベルやグループとの関係に基づいて制限される場合があります。

アクティビティ図

---
config:
  theme: base
  layout: dagre
  flowchart:
    curve: linear
    htmlLabels: true
  themeVariables:
    edgeLabelBackground: "transparent"
---
flowchart TD
    %% Main components
    AdminUser[管理者ユーザー]
    AdminInterface[グループ管理インターフェース]
    ActionSelect{アクション選択}
    
    %% Flow connections with numbered steps
    AdminUser --- Step1[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1</span>
            <p style='margin-top: 8px'>インターフェースにアクセス</p>
        </div>
    ]
    Step1 --> AdminInterface
    
    AdminInterface --- Step2[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2</span>
            <p style='margin-top: 8px'>アクション選択</p>
        </div>
    ]
    Step2 --> ActionSelect
    
    ActionSelect --- Step3A[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3A</span>
            <p style='margin-top: 8px'>グループ表示</p>
        </div>
    ]
    Step3A --> ViewGroups[グループリスト]
    
    ActionSelect --- Step3B[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3B</span>
            <p style='margin-top: 8px'>詳細表示</p>
        </div>
    ]
    Step3B --> GroupDetails[グループ詳細]
    
    ActionSelect --- Step3C[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3C</span>
            <p style='margin-top: 8px'>グループ作成</p>
        </div>
    ]
    Step3C --> CreateForm[グループ作成フォーム]
    
    ActionSelect --- Step3D[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc9966 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3D</span>
            <p style='margin-top: 8px'>グループ更新</p>
        </div>
    ]
    Step3D --> EditForm[グループ編集フォーム]
    
    ActionSelect --- Step3E[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3E</span>
            <p style='margin-top: 8px'>ステータス変更</p>
        </div>
    ]
    Step3E --> ToggleStatus[グループステータス切替]
    
    ActionSelect --- Step3F[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc6666 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3F</span>
            <p style='margin-top: 8px'>グループ削除</p>
        </div>
    ]
    Step3F --> DeleteConfirm{削除確認}
    
    ViewGroups --- Step4A[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4A</span>
            <p style='margin-top: 8px'>フィルター/並べ替え</p>
        </div>
    ]
    Step4A --> FilterSort[フィルター/並べ替え適用]
    
    CreateForm --- Step4C[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4C</span>
            <p style='margin-top: 8px'>検証</p>
        </div>
    ]
    Step4C --> ValidateCreate{入力検証}
    
    EditForm --- Step4D[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc9966 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4D</span>
            <p style='margin-top: 8px'>検証</p>
        </div>
    ]
    Step4D --> ValidateEdit{入力検証}
    
    ToggleStatus --- Step4E[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4E</span>
            <p style='margin-top: 8px'>ステータス更新</p>
        </div>
    ]
    Step4E --> UpdateStatusDB[データベースでステータス更新]
    
    DeleteConfirm --- Step4F[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc6666 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4F</span>
            <p style='margin-top: 8px'>レコード削除</p>
        </div>
    ]
    Step4F --> DeleteGroupDB[データベースからグループ削除]
    
    ValidateCreate --- Step5C[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>5C</span>
            <p style='margin-top: 8px'>レコード作成</p>
        </div>
    ]
    Step5C --> CreateGroupDB[データベースにグループ作成]
    
    ValidateEdit --- Step5D[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc9966 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>5D</span>
            <p style='margin-top: 8px'>レコード更新</p>
        </div>
    ]
    Step5D --> UpdateGroupDB[データベースでグループ更新]
    
    FilterSort --- Step5A[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>5A</span>
            <p style='margin-top: 8px'>インターフェースに戻る</p>
        </div>
    ]
    Step5A --> AdminInterface
    
    CreateGroupDB --- Step6C[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>6C</span>
            <p style='margin-top: 8px'>インターフェースに戻る</p>
        </div>
    ]
    Step6C --> AdminInterface
    
    UpdateGroupDB --- Step6D[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc9966 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>6D</span>
            <p style='margin-top: 8px'>インターフェースに戻る</p>
        </div>
    ]
    Step6D --> AdminInterface
    
    UpdateStatusDB --- Step5E[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>5E</span>
            <p style='margin-top: 8px'>インターフェースに戻る</p>
        </div>
    ]
    Step5E --> AdminInterface
    
    DeleteGroupDB --- Step5F[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc6666 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>5F</span>
            <p style='margin-top: 8px'>インターフェースに戻る</p>
        </div>
    ]
    Step5F --> AdminInterface
    
    ValidateCreate -.->|無効| CreateForm
    ValidateEdit -.->|無効| EditForm
    DeleteConfirm -.->|キャンセル| AdminInterface
    
    %% Styling
    style AdminUser fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style AdminInterface fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style ActionSelect fill:#f5f0ff,stroke:#9966cc,stroke-width:2px
    style ViewGroups fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style GroupDetails fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style CreateForm fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style EditForm fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style ToggleStatus fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style DeleteConfirm fill:#f5f0ff,stroke:#9966cc,stroke-width:2px
    style FilterSort fill:#fff0f5,stroke:#cc6699,stroke-width:2px
    style ValidateCreate fill:#f5f0ff,stroke:#9966cc,stroke-width:2px
    style ValidateEdit fill:#f5f0ff,stroke:#9966cc,stroke-width:2px
    style UpdateStatusDB fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style DeleteGroupDB fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style CreateGroupDB fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style UpdateGroupDB fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    
    style Step1 fill:transparent,stroke:transparent,stroke-width:1px
    style Step2 fill:transparent,stroke:transparent,stroke-width:1px
    style Step3A fill:transparent,stroke:transparent,stroke-width:1px
    style Step3B fill:transparent,stroke:transparent,stroke-width:1px
    style Step3C fill:transparent,stroke:transparent,stroke-width:1px
    style Step3D fill:transparent,stroke:transparent,stroke-width:1px
    style Step3E fill:transparent,stroke:transparent,stroke-width:1px
    style Step3F fill:transparent,stroke:transparent,stroke-width:1px
    style Step4A fill:transparent,stroke:transparent,stroke-width:1px
    style Step4C fill:transparent,stroke:transparent,stroke-width:1px
    style Step4D fill:transparent,stroke:transparent,stroke-width:1px
    style Step4E fill:transparent,stroke:transparent,stroke-width:1px
    style Step4F fill:transparent,stroke:transparent,stroke-width:1px
    style Step5A fill:transparent,stroke:transparent,stroke-width:1px
    style Step5C fill:transparent,stroke:transparent,stroke-width:1px
    style Step5D fill:transparent,stroke:transparent,stroke-width:1px
    style Step5E fill:transparent,stroke:transparent,stroke-width:1px
    style Step5F fill:transparent,stroke:transparent,stroke-width:1px
    style Step6C fill:transparent,stroke:transparent,stroke-width:1px
    style Step6D fill:transparent,stroke:transparent,stroke-width:1px

API: グループ管理API

ケースドキュメント

ケース1: グループ一覧の取得

説明

管理者はオプションのフィルタリングとソートを使用して、ページ分けされたグループリストを取得します。

シーケンス図

sequenceDiagram
    participant Admin as 管理者
    participant API as グループコントローラー
    participant Service as グループサービス
    participant DB as データベース

    Note over Admin,DB: ステップ1: グループリストのリクエスト
    Admin->>API: GET /api/admin/groups (クエリパラメータ付き)
    
    Note over API,Service: ステップ2: グループデータの取得
    API->>Service: list(params)
    Service->>DB: フィルタ付きグループクエリ
    DB-->>Service: 該当グループを返す
    Service-->>API: ページ分けされた結果を返す
    
    Note over API,Admin: ステップ3: グループリストの返却
    API-->>Admin: 200 OK (グループコレクション)

ステップ

ステップ1: グループリストのリクエスト

  • 説明: 管理者はオプションのフィルタを使用してグループのリストをリクエスト
  • リクエスト: GET /api/admin/groups
  • クエリパラメータ:
    • perpage: ページあたりのアイテム数
    • page: ページ番号
    • name: 名前でグループをフィルタリング
    • orderBy: 並べ替えのフィールド
    • sortBy: 並べ替えの方向(ascまたはdesc)
    • status: ステータスでグループをフィルタリング

ステップ2: グループデータの取得

  • 説明: システムはフィルタに基づいてデータベースからグループを取得
  • アクション:
    • クエリパラメータからフィルタを適用
    • 関連データ(作成者、パッケージ)を含める
    • 結果をページ分け

ステップ3: グループリストの返却

  • 説明: ページ分けされたグループリストを返す
  • レスポンス:
    • 成功: 200 OKとグループコレクションおよびページネーションメタデータ
    • エラー: 適切なエラーメッセージ

エラー処理

  • ログ
    • グループリスト取得失敗はアプリケーションログに記録
  • エラー詳細:
    ステータスコード エラーメッセージ 説明
    400 "グループリストの取得に失敗しました。" 取得中にエラーが発生した場合
    400 "このリソースにアクセスする権限がありません。" ユーザーに管理者権限がない場合
    400 "問題が発生しました。申し訳ございませんが、もう一度お試しください。" 予期しないエラーが発生した場合

ケース2: グループ詳細の表示

説明

管理者が特定のグループに関する詳細情報を表示します。

シーケンス図

sequenceDiagram
    participant Admin as 管理者
    participant API as グループコントローラー
    participant Service as グループサービス
    participant DB as データベース

    Note over Admin,DB: ステップ1: グループ詳細のリクエスト
    Admin->>API: GET /api/admin/groups/{id}
    
    Note over API,API: ステップ2: アクセス権限の確認
    API->>API: checkId(id)
    
    Note over API,Service: ステップ3: グループデータの取得
    API->>Service: getById(id)
    Service->>DB: 関連データ付きでグループを取得
    DB-->>Service: グループデータを返す
    Service-->>API: サブスクリプション付きグループを返す
    
    Note over API,Admin: ステップ4: グループ詳細の返却
    API-->>Admin: 200 OK (グループリソース)

ステップ

ステップ1: グループ詳細のリクエスト

  • 説明: 管理者が特定のグループの詳細をリクエスト
  • リクエスト: GET /api/admin/groups/{id}

ステップ2: アクセス権限の確認

  • 説明: システムは管理者がこのグループにアクセスする権限を持っているか確認
  • アクション:
    • 管理者がスーパー管理者かどうか確認
    • スーパー管理者でない場合、管理者が要求されたグループに属しているか確認
  • 発生しうるエラー: 権限不足

ステップ3: グループデータの取得

  • 説明: システムは関連データと共にグループを取得
  • アクション:
    • IDでグループを取得
    • 関連するサブスクリプションデータをロード

ステップ4: グループ詳細の返却

  • 説明: グループの詳細を返す
  • レスポンス:
    • 成功: 200 OKと関連データを含むグループリソース
    • エラー: 適切なエラーメッセージ

エラー処理

  • ログ
    • グループ詳細取得失敗はアプリケーションログに記録
  • エラー詳細:
    ステータスコード エラーメッセージ 説明
    403 "グループデータの取得に失敗しました。" アクセスが拒否されたかグループが見つからない場合

ケース3: 新しいグループの作成

説明

管理者は関連する管理者ユーザーとパッケージプランを持つ新しいグループを作成します。

シーケンス図

sequenceDiagram
    participant Admin as 管理者
    participant API as グループコントローラー
    participant Service as グループサービス
    participant DB as データベース

    Note over Admin,DB: ステップ1: グループ作成の送信
    Admin->>API: POST /api/admin/groups (group_data)
    
    Note over API,API: ステップ2: 管理者権限の確認
    API->>API: 管理者ロールを確認
    
    Note over API,API: ステップ3: 入力検証
    API->>API: リクエストデータを検証
    
    Note over API,Service: ステップ4: グループ作成
    API->>Service: create(validated_data)
    Service->>DB: グループ、管理者、サブスクリプションを作成
    DB-->>Service: 作成されたグループを返す
    
    Note over API,Admin: ステップ5: レスポンス返却
    Service-->>API: グループデータを返す
    API-->>Admin: 200 OK (グループリソース)

ステップ

ステップ1: グループ作成の送信

  • 説明: 管理者が新しいグループを作成するフォームを送信
  • リクエスト: POST /api/admin/groups
  • 必須フィールド:
    • name: グループ名
    • email: グループ管理者用のメール
    • adminName: グループ管理者の名前
    • plan: パッケージプランID
    • status: グループステータス

ステップ2: 管理者権限の確認

  • 説明: システムは管理者が適切な権限を持っているか確認
  • アクション: 管理者ロールがAdminStaffでないことを確認
  • 発生しうるエラー: 権限不足(400)

ステップ3: 入力検証

  • 説明: システムがすべての入力データを検証
  • アクション: StoreGroupRequestから検証ルールを実行
  • 発生しうるエラー: 検証失敗

ステップ4: グループ作成

  • 説明: システムがグループと関連データを作成
  • アクション:
    • グループレコードを作成
    • 管理者ユーザーを作成または割り当て
    • 選択されたパッケージでサブスクリプションを作成

ステップ5: レスポンス返却

  • 説明: 作成されたグループデータを返す
  • レスポンス:
    • 成功: 200 OKとグループデータ
    • エラー: 適切なエラーメッセージ

エラー処理

  • ログ
    • グループ作成失敗はアプリケーションログに記録
  • エラー詳細:
    ステータスコード エラーメッセージ 説明
    400 "このリソースにアクセスする権限がありません。" 管理者がAdminStaffロールの場合
    400 "グループの作成に失敗しました。" グループ作成が失敗した場合
    400 "メールアドレスはすでに使用されています。" メールアドレスが既に存在する場合
    400 "問題が発生しました。申し訳ございませんが、もう一度お試しください。" 予期しないエラーが発生した場合

ケース4: グループの更新

説明

管理者が既存のグループ情報を更新します。

シーケンス図

sequenceDiagram
    participant Admin as 管理者
    participant API as グループコントローラー
    participant Service as グループサービス
    participant DB as データベース

    Note over Admin,DB: ステップ1: グループ更新の送信
    Admin->>API: PUT /api/admin/groups/{id} (updated_data)
    
    Note over API,API: ステップ2: アクセス権限の確認
    API->>API: checkId(id)
    
    Note over API,API: ステップ3: 入力検証
    API->>API: リクエストデータを検証
    
    Note over API,Service: ステップ4: グループ更新
    API->>Service: update(id, validated_data)
    Service->>DB: グループレコードを更新
    DB-->>Service: 更新されたグループを返す
    
    Note over API,Admin: ステップ5: レスポンス返却
    Service-->>API: グループデータを返す
    API-->>Admin: 200 OK (グループリソース)

ステップ

ステップ1: グループ更新の送信

  • 説明: 管理者がグループ情報を更新するフォームを送信
  • リクエスト: PUT /api/admin/groups/{id}
  • 更新可能フィールド:
    • name: グループ名
    • adminName: グループ管理者の名前
    • plan: パッケージプランID
    • status: グループステータス

ステップ2: アクセス権限の確認

  • 説明: システムは管理者がこのグループを更新する権限を持っているか確認
  • アクション:
    • 管理者がスーパー管理者かどうか確認
    • スーパー管理者でない場合、管理者が要求されたグループに属しているか確認
  • 発生しうるエラー: 権限不足

ステップ3: 入力検証

  • 説明: システムがすべての入力データを検証
  • アクション: UpdateGroupRequestから検証ルールを実行
  • 発生しうるエラー: 検証失敗

ステップ4: グループ更新

  • 説明: システムがグループ情報を更新
  • アクション: 新しいデータでグループレコードを更新

ステップ5: レスポンス返却

  • 説明: 更新されたグループデータを返す
  • レスポンス:
    • 成功: 200 OKと更新されたグループデータ
    • エラー: 適切なエラーメッセージ

エラー処理

  • ログ
    • グループ更新失敗はアプリケーションログに記録
  • エラー詳細:
    ステータスコード エラーメッセージ 説明
    400 "グループデータの更新に失敗しました。" グループ更新が失敗した場合
    400 "このリソースにアクセスする権限がありません。" ユーザーに管理者権限がない場合
    400 "問題が発生しました。申し訳ございませんが、もう一度お試しください。" 予期しないエラーが発生した場合

ケース5: グループステータスの変更

説明

管理者がグループをアクティブ化または非アクティブ化します。

シーケンス図

sequenceDiagram
    participant Admin as 管理者
    participant API as グループコントローラー
    participant Service as グループサービス
    participant DB as データベース

    Note over Admin,DB: ステップ1: ステータス変更リクエスト
    Admin->>API: POST /api/admin/groups/{id}/change-status
    
    Note over API,API: ステップ2: アクセス権限の確認
    API->>API: checkId(id)
    
    Note over API,Service: ステップ3: グループステータス切替
    API->>Service: updateStatusById(id)
    Service->>DB: ステータスを更新
    DB-->>Service: 更新されたグループを返す
    
    Note over API,Admin: ステップ4: レスポンス返却
    Service-->>API: グループデータを返す
    API-->>Admin: 200 OK (グループリソース)

ステップ

ステップ1: ステータス変更リクエスト

  • 説明: 管理者がグループのアクティブステータスを変更するリクエスト
  • リクエスト: POST /api/admin/groups/{id}/change-status

ステップ2: アクセス権限の確認

  • 説明: システムは管理者がこのグループを変更する権限を持っているか確認
  • アクション:
    • 管理者がスーパー管理者かどうか確認
    • スーパー管理者でない場合、管理者が要求されたグループに属しているか確認
  • 発生しうるエラー: 権限不足

ステップ3: グループステータス切替

  • 説明: システムがグループのアクティブステータスを切り替え
  • アクション:
    • ステータスを反対の値に更新(アクティブから非アクティブ、またはその逆)

ステップ4: レスポンス返却

  • 説明: 更新されたグループデータを返す
  • レスポンス:
    • 成功: 200 OKと新しいステータスを含む更新されたグループデータ
    • エラー: 適切なエラーメッセージ

エラー処理

  • ログ
    • ステータス変更失敗はアプリケーションログに記録
  • エラー詳細:
    ステータスコード エラーメッセージ 説明
    400 "グループデータの更新に失敗しました。" ステータス更新が失敗した場合
    400 "このリソースにアクセスする権限がありません。" ユーザーに管理者権限がない場合
    400 "問題が発生しました。申し訳ございませんが、もう一度お試しください。" 予期しないエラーが発生した場合

ケース6: グループの削除

説明

管理者がシステムからグループを削除します。

シーケンス図

sequenceDiagram
    participant Admin as 管理者
    participant API as グループコントローラー
    participant Service as グループサービス
    participant DB as データベース

    Note over Admin,DB: ステップ1: グループ削除リクエスト
    Admin->>API: DELETE /api/admin/groups/{id}
    
    Note over API,API: ステップ2: アクセス権限の確認
    API->>API: checkId(id)
    
    Note over API,Service: ステップ3: グループ削除
    API->>Service: delete(id)
    Service->>DB: グループレコードを削除
    DB-->>Service: 削除を確認
    
    Note over API,Admin: ステップ4: レスポンス返却
    Service-->>API: 削除を確認
    API-->>Admin: 200 OK (削除確認)

ステップ

ステップ1: グループ削除リクエスト

  • 説明: 管理者がグループを削除するリクエスト
  • リクエスト: DELETE /api/admin/groups/{id}

ステップ2: アクセス権限の確認

  • 説明: システムは管理者がこのグループを削除する権限を持っているか確認
  • アクション:
    • 管理者がスーパー管理者かどうか確認
    • スーパー管理者でない場合、管理者が要求されたグループに属しているか確認
  • 発生しうるエラー: 権限不足

ステップ3: グループ削除

  • 説明: システムがグループを削除
  • アクション:
    • IDでグループを削除

ステップ4: レスポンス返却

  • 説明: 削除を確認
  • レスポンス:
    • 成功: 200 OKと削除を確認
    • エラー: 適切なエラーメッセージ

エラー処理

  • ログ
    • グループ削除失敗はアプリケーションログに記録
  • エラー詳細:
    ステータスコード エラーメッセージ 説明
    400 "グループデータの削除に失敗しました。" 削除が失敗した場合
    400 "このリソースにアクセスする権限がありません。" ユーザーに管理者権限がない場合
    400 "問題が発生しました。申し訳ございませんが、もう一度お試しください。" 予期しないエラーが発生した場合

追加メモ

  • グループ管理モジュールは階層的アクセス制御システムを実装しています:
    • スーパー管理者はすべてのグループにアクセスして変更できます
    • グループ管理者は自分のグループにのみアクセスして変更できます
    • 管理スタッフはグループ操作に制限された権限を持ちます
  • 各グループはリソース制限を決定するパッケージサブスクリプションに関連付けられています
  • グループステータスの変更はグループメンバーのシステムリソースへのアクセス能力に影響します
  • グループの削除は実装によっては、データを物理的にすぐに削除せず、削除済みとしてマークする(ソフト削除)場合があります

関連データベーステーブルとフィールド

erDiagram
    groups {
        id bigint "主キー"
        name string "グループ名"
        created_by bigint "usersテーブルへの参照"
        status int "グループステータス(0: 非アクティブ, 1: アクティブ)"
        created_at timestamp "レコード作成タイムスタンプ"
        updated_at timestamp "最終更新タイムスタンプ"
    }
    users {
        id bigint "主キー"
        name string "ユーザーのフルネーム"
        email string "ユーザーのメールアドレス(一意)"
        uid string "Firebase UID(一意)"
        payment_provider_customer_id string "決済プロバイダーの顧客ID(nullable)"
        status int "アカウントステータス(0: 非アクティブ, 1: アクティブ)"
        is_first_login int "初回ログインフラグ(0: まだ, 1: ログイン済み)"
        remember_token string "リメンバートークン"
        created_at timestamp "レコード作成タイムスタンプ"
        updated_at timestamp "最終更新タイムスタンプ"
        deleted_at timestamp "ソフト削除タイムスタンプ"
    }
    group_members {
        id bigint "主キー"
        group_id bigint "groupsテーブルへの参照"
        user_id bigint "usersテーブルへの参照"
        group_role_id bigint "group_rolesテーブルへの参照"
        is_creator boolean "ユーザーがグループ作成者かどうか"
        joined_at timestamp "ユーザーがグループに参加した時期"
        created_at timestamp "レコード作成タイムスタンプ"
        updated_at timestamp "最終更新タイムスタンプ"
    }
    group_roles {
        id bigint "主キー"
        name string "ロール名(50文字)"
        slug string "ロールスラッグ(50文字、一意)"
        created_at timestamp "レコード作成タイムスタンプ"
        updated_at timestamp "最終更新タイムスタンプ"
    }

    groups }|--|| users : created_by
    groups ||--o{ group_members : has
    users ||--o{ group_members : has
    group_roles ||--o{ group_members : has