ビューポイント分析

説明

ビューポイント分析機能は、公式ウィッシュリストコンテキスト内での包括的なビューポイント分析機能を提供し、ユーザーがカテゴリビューポイントと特定ビューポイント詳細を表示・管理できるようにします。このシステムはウィッシュリストカテゴリビューポイント構造と統合して、分析と意思決定のための整理されたビューポイントデータを提供します。

この機能は以下を備えた本番対応のビューポイント分析に焦点を当てています:

  • ウィッシュリストコンテキスト検証付きカテゴリビューポイント取得
  • 特定ビューポイント関係付き詳細ビューポイント分解
  • 適切なアクセス制御のためのウィッシュリストグループとの統合
  • リアルタイムビューポイントデータアクセスと管理
  • 階層ビューポイント構造(カテゴリ → 詳細 → 特定)

システムは適切な関係管理を通じてデータ整合性を確保し、包括的な分析と戦略的インサイトのためのビューポイントデータへの効率的なアクセスを提供します。

アクティビティ図

---
config:
  theme: base
  layout: dagre
  flowchart:
    curve: linear
    htmlLabels: true
  themeVariables:
    edgeLabelBackground: "transparent"
---
flowchart TB
    %% Main components
    UserRequest[ユーザーリクエスト]
    Database[(Database)]
    
    subgraph Controllers
        ViewpointController[WishlistViewpointController]
    end
    
    subgraph Repositories
        ViewpointRepo[[WishlistCategoryViewpointRepository]]
        WishlistRepo[[WishlistToGroupRepository]]
    end
    
    subgraph Middleware
        AuthMiddleware{AuthMiddleware}
    end
    
    UserRequest --- 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 --> AuthMiddleware
    AuthMiddleware --> ViewpointController

    ViewpointController --- 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 --> WishlistRepo
    WishlistRepo --> ViewpointRepo

    ViewpointRepo --- Step3[
        <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'>3</span>
            <p style='margin-top: 8px'>関係読み込み・データ処理</p>
        </div>
    ]
    Step3 --> Database

    Database --- Step4[
        <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'>4</span>
            <p style='margin-top: 8px'>レスポンスフォーマット・リソース生成</p>
        </div>
    ]
    Step4 --> ViewpointController

    %% Styling
    style UserRequest fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style Database fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style Controllers fill:#e6f3ff
    style Repositories fill:#fff0f5
    style Middleware fill:#f5f0ff
    style Step1 fill:transparent,stroke:transparent,stroke-width:1px
    style Step2 fill:transparent,stroke:transparent,stroke-width:1px
    style Step3 fill:transparent,stroke:transparent,stroke-width:1px
    style Step4 fill:transparent,stroke:transparent,stroke-width:1px

詳細データフロー依存関係

ステップバイステッププロセス

ステップ1: 認証・ウィッシュリスト検証

  • 説明: ビューポイント操作のためのユーザー認証とウィッシュリストアクセスを検証
  • アクション: ユーザーセッション認証、ウィッシュリストスラッグ検証、ウィッシュリスト存在チェック
  • 入力: ユーザー認証情報、ウィッシュリストスラッグ
  • 出力: ウィッシュリストアクセス確認付きの検証されたユーザーコンテキスト
  • 依存関係: ユーザー認証サービス、ウィッシュリストリポジトリ
  • 外部サービス: 認証プロバイダー

ステップ2: ビューポイントデータ取得・処理

  • 説明: ウィッシュリスト情報と関連カテゴリビューポイントデータを取得
  • アクション: スラッグでウィッシュリスト検索、ウィッシュリストIDでカテゴリビューポイント読み込み、データ存在検証
  • 入力: ウィッシュリストスラッグ、ウィッシュリストID
  • 出力: 関連カテゴリビューポイント情報付きウィッシュリストデータ
  • 依存関係: ウィッシュリストリポジトリ、ビューポイントリポジトリ
  • 外部サービス: データベースクラスター

ステップ3: 関係読み込み・データ処理

  • 説明: 適切な関係で関連ビューポイント詳細と特定ビューポイントを読み込み
  • アクション: ビューポイント詳細読み込み、特定ビューポイント読み込み、階層関係処理
  • 入力: カテゴリビューポイントデータ、関係パラメータ
  • 出力: 詳細と特定ビューポイント付きの完全なビューポイント階層
  • 依存関係: Eloquent関係読み込み、データ処理
  • 外部サービス: データベース関係クエリ

ステップ4: レスポンスフォーマット・リソース生成

  • 説明: 適切なリソース変換でAPIレスポンス用にビューポイントデータをフォーマット
  • アクション: データをAPIリソース形式に変換、適切な構造適用、レスポンス生成
  • 入力: 完全なビューポイントデータ、リソース変換要件
  • 出力: ビューポイントリソース付きフォーマットされたAPIレスポンス
  • 依存関係: リソース変換、レスポンスフォーマット
  • 外部サービス: APIレスポンスサービス

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

データベース: gb_console

erDiagram
    wl_cat_vps {
        bigint id PK
        bigint wishlist_to_group_id FK
        string category_id "モール内のカテゴリID"
        bigint mall_id FK "モールのID"
        integer status "0: 非アクティブ, 1: アクティブ"
    }
    
    wl_cat_vp_details {
        bigint id PK
        bigint wl_cat_vp_id FK
        string viewpoint "カテゴリのビューポイント"
        text content "ビューポイントの内容"
        integer status "0: 非アクティブ, 1: アクティブ"
    }
    
    wl_spec_vps {
        bigint id PK
        bigint wishlist_to_group_id FK
        string name "特定ビューポイントの名前"
        text description "特定ビューポイントの説明"
        integer status "0: 非アクティブ, 1: アクティブ"
    }
    
    wishlist_to_groups {
        bigint id PK
        string name "ウィッシュリストの名前"
        string slug "ウィッシュリストのスラッグ"
        integer status "0: 非アクティブ, 1: アクティブ, 3: キャンセル"
    }
    
    malls {
        bigint id PK
        string name
    }
    
    wl_cat_vps }|--|| wishlist_to_groups : "所属"
    wl_cat_vps }|--|| malls : "所属"
    wl_cat_vp_details }|--|| wl_cat_vps : "所属"
    wl_spec_vps }|--|| wishlist_to_groups : "所属"

ケースドキュメント

ケース1: カテゴリビューポイント分析

API: カテゴリビューポイント

シーケンス図

sequenceDiagram
    participant Client
    participant Controller as WishlistViewpointController
    participant WishlistRepo as WishlistToGroupRepository
    participant ViewpointRepo as WishlistCategoryViewpointRepository
    participant Database
    
    Note over Client,Database: カテゴリビューポイント分析フロー
    
    rect rgb(255, 255, 200)
    Note right of Client: 認証フェーズ
    Client->>Controller: GET /api/v1/wishlist-to-group/{slug}/category-viewpoint
    Controller->>Controller: ユーザー認証
    end
    
    rect rgb(200, 230, 255)
    Note right of Controller: ウィッシュリスト検証
    Controller->>WishlistRepo: findBySlug(slug)
    WishlistRepo->>Database: wishlist_to_groupsからSELECT
    Database-->>WishlistRepo: ウィッシュリストレコード
    WishlistRepo-->>Controller: ウィッシュリストまたはnull
    end
    
    rect rgb(200, 255, 255)
    Note right of Controller: ビューポイント取得
    alt ウィッシュリスト見つかった
        Controller->>ViewpointRepo: getByWishlistToGroupId(wishlistId)
        ViewpointRepo->>Database: wl_cat_vpsからSELECT
        Database-->>ViewpointRepo: カテゴリビューポイント
        ViewpointRepo-->>Controller: ビューポイントデータ
    else ウィッシュリスト見つからない
        Controller-->>Client: エラーレスポンス
    end
    end
    
    rect rgb(200, 255, 200)
    Note right of Controller: 成功レスポンス
    alt ビューポイント見つかった
        Controller->>Controller: リソースに変換
        Controller-->>Client: ビューポイント付きJSONレスポンス
    else ビューポイント見つからない
        Controller-->>Client: メッセージ付き成功レスポンス
    end
    end

ステップ

  1. 認証: ユーザーセッションを検証
  2. ウィッシュリスト検証: スラッグでウィッシュリストを検索し存在を検証
  3. ビューポイント取得: ウィッシュリストのカテゴリビューポイントデータを読み込み
  4. レスポンス生成: リソースに変換しフォーマットされたレスポンスを返却

エラーハンドリング

  • 401 Unauthorized: 無効な認証
  • 404 Not Found: ウィッシュリストが見つからない
  • 500 Internal Server Error: データベースまたはシステムエラー

ケース2: 詳細ビューポイント分析

API: カテゴリビューポイント詳細・特定ビューポイント

シーケンス図

sequenceDiagram
    participant Client
    participant Controller as WishlistViewpointController
    participant WishlistRepo as WishlistToGroupRepository
    participant ViewpointRepo as WishlistCategoryViewpointRepository
    participant Database
    
    Note over Client,Database: 詳細ビューポイント分析フロー
    
    rect rgb(255, 255, 200)
    Note right of Client: 認証フェーズ
    Client->>Controller: GET /api/v1/wishlist-to-group/{slug}/category-viewpoint-detail
    Controller->>Controller: ユーザー認証
    end
    
    rect rgb(200, 230, 255)
    Note right of Controller: ウィッシュリスト検証
    Controller->>WishlistRepo: findBySlug(slug)
    WishlistRepo->>Database: wishlist_to_groupsからSELECT
    Database-->>WishlistRepo: ウィッシュリストレコード
    WishlistRepo-->>Controller: ウィッシュリストまたはnull
    end
    
    rect rgb(200, 255, 255)
    Note right of Controller: ビューポイント取得
    alt ウィッシュリスト見つかった
        Controller->>ViewpointRepo: getByWishlistToGroupId(wishlistId)
        ViewpointRepo->>Database: wl_cat_vpsからSELECT
        Database-->>ViewpointRepo: カテゴリビューポイント
        ViewpointRepo-->>Controller: ビューポイントデータ
    else ウィッシュリスト見つからない
        Controller-->>Client: エラーレスポンス
    end
    end
    
    rect rgb(230, 200, 255)
    Note right of Controller: 関係読み込み
    alt ビューポイント見つかった
        Controller->>Controller: 関係読み込み
        Controller->>Database: wl_cat_vp_details読み込み
        Controller->>Database: wl_spec_vps読み込み
        Database-->>Controller: 完全なビューポイント階層
    else ビューポイント見つからない
        Controller-->>Client: メッセージ付き成功レスポンス
    end
    end
    
    rect rgb(200, 255, 200)
    Note right of Controller: 成功レスポンス
    Controller->>Controller: 詳細リソースに変換
    Controller-->>Client: 完全な詳細付きJSONレスポンス
    end

ステップ

  1. 認証: ユーザーセッションを検証
  2. ウィッシュリスト検証: スラッグでウィッシュリストを検索し存在を検証
  3. ビューポイント取得: ウィッシュリストのカテゴリビューポイントデータを読み込み
  4. 関係読み込み: ビューポイント詳細と特定ビューポイントを読み込み
  5. レスポンス生成: 詳細リソースに変換しフォーマットされたレスポンスを返却

エラーハンドリング

  • 401 Unauthorized: 無効な認証
  • 404 Not Found: ウィッシュリストが見つからない
  • 500 Internal Server Error: データベースまたはシステムエラー