Wishlist Product Management

Description

The Wishlist Product Management feature provides comprehensive product management capabilities within the official wishlist context, enabling users to view, analyze, and manage products associated with their wishlist groups. This system integrates with summary tables for optimized data access and provides specialized views for product analysis and tracking.

Unlike temporary product management, this feature focuses on production-ready product analysis with:

  • Product listing within wishlist context with advanced filtering
  • Registered product table for comprehensive product overview
  • Integration with summary tables for optimized performance
  • Product analysis integration for business intelligence
  • Schedule and priority management for product processing
  • Real-time product status tracking and updates

The system ensures data consistency through proper relationship management and provides efficient access to product data for analysis and reporting purposes.

Activity Diagram

---
config:
  theme: base
  layout: dagre
  flowchart:
    curve: linear
    htmlLabels: true
  themeVariables:
    edgeLabelBackground: "transparent"
---
flowchart TB
    %% Main components
    UserRequest[User Request]
    Database[(Database)]
    
    subgraph Controllers
        ProductController[WishlistProductController]
    end
    
    subgraph Services
        ProductService(WishlistProductService)
        AnalysisService(ProductAnalysisService)
    end
    
    subgraph Repositories
        ProductRepo[[WishlistProductRepository]]
        SummaryRepo[[SummaryWishlistProductRepository]]
    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'>Authentication & Wishlist Validation</p>
        </div>
    ]
    Step1 --> AuthMiddleware
    AuthMiddleware --> ProductController

    ProductController --- 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'>Product Data Retrieval & Summary Integration</p>
        </div>
    ]
    Step2 --> ProductService
    ProductService --> ProductRepo
    ProductService --> SummaryRepo

    ProductRepo --- 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'>Analysis Integration & Business Intelligence</p>
        </div>
    ]
    Step3 --> AnalysisService
    ProductRepo --> Database
    SummaryRepo --> Database

    AnalysisService --- 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'>Data Formatting & Response Generation</p>
        </div>
    ]
    Step4 --> ProductController

    %% Styling
    style UserRequest fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style Database fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style Controllers fill:#e6f3ff
    style Services fill:#f0f8e6
    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

Detail Dataflow Dependency

Step-by-Step Process

Step 1: Authentication & Wishlist Validation

  • Description: Validates user authentication and wishlist access for product operations
  • Action: Authenticate user session, validate wishlist ownership, check group membership
  • Input: User credentials, wishlist slug, group membership data
  • Output: Validated user context with wishlist access confirmation
  • Dependencies: User authentication service, wishlist repository, group validation
  • External Services: Authentication provider, group management service

Step 2: Product Data Retrieval & Summary Integration

  • Description: Retrieves product data with summary table integration for optimized performance
  • Action: Query wishlist products, load summary data, apply relationship joins
  • Input: Wishlist context, query parameters, filter criteria
  • Output: Product data with summary information and relationships
  • Dependencies: Product repository, summary table services, relationship management
  • External Services: Database cluster, caching services

Step 3: Analysis Integration & Business Intelligence

  • Description: Integrates product analysis data and business intelligence metrics
  • Action: Load analysis results, calculate metrics, process business intelligence data
  • Input: Product data, analysis parameters, business rules
  • Output: Enhanced product data with analysis insights and metrics
  • Dependencies: Analysis services, business intelligence processing, metrics calculation
  • External Services: Analysis APIs, business intelligence services

Step 4: Data Formatting & Response Generation

  • Description: Formats product data for API response with proper structure and pagination
  • Action: Transform data to API format, apply pagination, generate response structure
  • Input: Enhanced product data, pagination parameters, response format requirements
  • Output: Formatted API response with pagination and metadata
  • Dependencies: Data transformation services, pagination handling, response formatting
  • External Services: API response services, data serialization

Database Related Tables & Fields

Database: gb_console

erDiagram
    wishlist_products {
        bigint id PK
        bigint group_id FK
        bigint wishlist_to_group_id FK
        bigint summary_wishlist_product_id FK
        integer status "0: Inactive, 1: Active"
    }
    
    summary_wishlist_products {
        bigint id PK
        string input "The input of the product"
        string input_type "The type of the input: jan, asin, rakuten_id"
        string product_url "The url of the product"
        bigint mall_id FK
        integer sending_status "The status of the sending to crawler"
        integer crawl_status "The status of the crawling"
        integer status "The status of the product"
    }
    
    wishlist_to_groups {
        bigint id PK
        string name "Name of the wishlist"
        string slug "Slug of the wishlist"
        integer status "0: Inactive, 1: Active, 3: Canceled"
    }
    
    malls {
        bigint id PK
        string name
    }
    
    wishlist_products }|--|| wishlist_to_groups : "belongs to"
    wishlist_products }|--|| summary_wishlist_products : "references"
    summary_wishlist_products }|--|| malls : "belongs to"

Case Documentation

Case 1: List Wishlist Products

API: List Wishlist Products

Sequence Diagram

sequenceDiagram
    participant Client
    participant Controller as WishlistProductController
    participant Service as WishlistProductService
    participant Repository as WishlistProductRepository
    participant SummaryRepo as SummaryWishlistProductRepository
    participant Database
    
    Note over Client,Database: List Wishlist Products Flow
    
    rect rgb(255, 255, 200)
    Note right of Client: Authentication Phase
    Client->>Controller: GET /api/v1/wishlist-to-group/{slug}/wishlist-product
    Controller->>Controller: Authenticate User
    Controller->>Controller: Validate Wishlist Access
    end
    
    rect rgb(200, 230, 255)
    Note right of Controller: Validation Phase
    Controller->>Controller: Validate Query Parameters
    Controller->>Service: list(params, wishlistSlug)
    Service->>Service: Apply Default Filters
    Service->>Service: Validate Pagination Parameters
    end
    
    rect rgb(200, 255, 255)
    Note right of Service: Data Retrieval
    Service->>Repository: findWhere(conditions)
    Repository->>Database: SELECT with JOIN summary_products
    Database-->>Repository: Product Records
    Repository-->>Service: Product Collection
    end
    
    rect rgb(230, 200, 255)
    Note right of Service: Summary Integration
    Service->>SummaryRepo: loadSummaryData(productIds)
    SummaryRepo->>Database: SELECT summary data
    Database-->>SummaryRepo: Summary Records
    SummaryRepo-->>Service: Enhanced Product Data
    end
    
    rect rgb(200, 255, 200)
    Note right of Service: Success Response
    Service->>Service: Apply Pagination
    Service->>Service: Transform to Resources
    Service-->>Controller: Paginated Products
    Controller-->>Client: JSON Response with Pagination
    end

Steps

  1. Authentication: Validate user session and wishlist access
  2. Parameter Validation: Validate query parameters and pagination settings
  3. Data Retrieval: Query wishlist products with proper filtering
  4. Summary Integration: Load and integrate summary product data
  5. Pagination: Apply pagination and transform to API resources
  6. Response Generation: Return formatted response with metadata

Error Handling

  • 401 Unauthorized: Invalid authentication
  • 404 Not Found: Wishlist not found or access denied
  • 400 Bad Request: Invalid query parameters
  • 500 Internal Server Error: Database or system errors

Case 2: Registered Product Table

API: Registered Product Table

Sequence Diagram

sequenceDiagram
    participant Client
    participant Controller as WishlistProductController
    participant Service as WishlistProductService
    participant AnalysisService as ProductAnalysisService
    participant Repository as WishlistProductRepository
    participant Database
    
    Note over Client,Database: Registered Product Table Flow
    
    rect rgb(255, 255, 200)
    Note right of Client: Authentication Phase
    Client->>Controller: GET /api/v1/wishlist-to-group/{slug}/registered-product-table
    Controller->>Controller: Authenticate User
    Controller->>Controller: Validate Wishlist Access
    end
    
    rect rgb(200, 230, 255)
    Note right of Controller: Validation Phase
    Controller->>Controller: Validate Query Parameters
    Controller->>Service: registeredProductTable(params, wishlistSlug)
    Service->>Service: Validate Table Parameters
    end
    
    rect rgb(200, 255, 255)
    Note right of Service: Product Data Loading
    Service->>Repository: getRegisteredProducts(wishlistId)
    Repository->>Database: SELECT registered products
    Database-->>Repository: Product Records
    Repository-->>Service: Product Collection
    end
    
    rect rgb(255, 230, 200)
    Note right of Service: Analysis Integration
    Service->>AnalysisService: getProductAnalysisData(products)
    AnalysisService->>AnalysisService: Load Analysis Results
    AnalysisService->>AnalysisService: Calculate Metrics
    AnalysisService-->>Service: Analysis Data
    end
    
    rect rgb(230, 200, 255)
    Note right of Service: Table Formatting
    Service->>Service: formatTableData(products, analysis)
    Service->>Service: Apply Sorting and Filtering
    Service->>Service: Generate Table Structure
    end
    
    rect rgb(200, 255, 200)
    Note right of Service: Success Response
    Service-->>Controller: Formatted Table Data
    Controller->>Controller: Transform to Table Resource
    Controller-->>Client: JSON Response with Table
    end

Steps

  1. Authentication & Authorization: Validate user and wishlist access
  2. Parameter Validation: Validate table parameters and options
  3. Product Data Loading: Load registered products for the wishlist
  4. Analysis Integration: Integrate product analysis data and metrics
  5. Table Formatting: Format data into table structure with sorting
  6. Response Generation: Return formatted table data

Error Handling

  • 401 Unauthorized: Invalid authentication
  • 404 Not Found: Wishlist not found or access denied
  • 400 Bad Request: Invalid table parameters
  • 503 Service Unavailable: Analysis service unavailable
  • 500 Internal Server Error: Database or system errors