Wire product→merchant-profile write path
Multi-profile resolution shipped in :52 but nothing wrote products.merchant_profile_id, so it was non-functional end to end. Add merchant_profile_id to the Product model + all four product SELECTs, a set_product_merchant_profile writer (validates the target profile exists, returning 404 instead of a raw FK-violation 500), and thread an optional field through CreateProductReq (post-write) and UpdateProductReq (double-Option; Some(None) clears to default). The admin SPA product form shows a profile picker only when >1 profile exists. Mirrors the entitlements-catalog post-write pattern. Tests: repo round-trip (attach/resolve/clear/bad-id) + HTTP handler arms. api suite 54→56, full suite green.
This commit is contained in:
@@ -34,6 +34,12 @@ pub struct Product {
|
||||
/// behavior); operators can opt-in by adding rows.
|
||||
#[serde(default)]
|
||||
pub entitlements_catalog: Option<Vec<EntitlementDef>>,
|
||||
/// Merchant profile this product belongs to (migration 0020). None
|
||||
/// resolves to the default profile (back-compat for rows created
|
||||
/// before the operator ran more than one profile). Set via the admin
|
||||
/// product form when >1 profile exists.
|
||||
#[serde(default)]
|
||||
pub merchant_profile_id: Option<String>,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user