# GetProductAttributeAssignment

## Overview

GetProductAttributeAssignment retrieves a specific product-to-attribute assignment by the composite key of productId and attributeId. Used for upsert detection in AssignAttributeValueToProduct and for validating attribute-product relationships.

## Business Rules

- Searches ProductAttributeAssignment table using both productId AND attributeId as a composite filter
- Returns the full assignment record if found (id, productId, attributeId, value, timestamps)
- Returns null if no assignment exists for the given pair

## Process Flow

```mermaid
flowchart TD
    A[Receive productId + attributeId] --> B[SELECT from ProductAttributeAssignment where productId = input AND attributeId = input]
    B --> C{Assignment found?}
    C -->|Yes| D[Return assignment record]
    C -->|No| E[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **ASSIGNMENT_NOT_FOUND**: No assignment exists for the specified product and attribute or category combination

## Test Cases

- returns assignments when found by productId and attributeId
- returns empty array when not found
