refactor(products): remove obsolete interaction fields across stack
This commit is contained in:
parent
1d8a8eafb8
commit
c5ea38880c
16 changed files with 32 additions and 278 deletions
|
|
@ -12,7 +12,6 @@ from .enums import (
|
|||
AbsorptionSpeed,
|
||||
DayTime,
|
||||
IngredientFunction,
|
||||
InteractionScope,
|
||||
PriceTier,
|
||||
ProductCategory,
|
||||
SkinConcern,
|
||||
|
|
@ -57,12 +56,6 @@ class ActiveIngredient(SQLModel):
|
|||
irritation_potential: StrengthLevel | None = None
|
||||
|
||||
|
||||
class ProductInteraction(SQLModel):
|
||||
target: str
|
||||
scope: InteractionScope
|
||||
reason: str | None = None
|
||||
|
||||
|
||||
class ProductContext(SQLModel):
|
||||
safe_after_shaving: bool | None = None
|
||||
safe_after_acids: bool | None = None
|
||||
|
|
@ -128,8 +121,6 @@ class ProductBase(SQLModel):
|
|||
ph_min: float | None = Field(default=None, ge=0, le=14)
|
||||
ph_max: float | None = Field(default=None, ge=0, le=14)
|
||||
|
||||
incompatible_with: list[ProductInteraction] | None = None
|
||||
synergizes_with: list[str] | None = None
|
||||
context_rules: ProductContext | None = None
|
||||
|
||||
min_interval_hours: int | None = Field(default=None, ge=0)
|
||||
|
|
@ -181,12 +172,6 @@ class Product(ProductBase, table=True):
|
|||
sa_column=Column(JSON, nullable=False),
|
||||
)
|
||||
|
||||
incompatible_with: list[ProductInteraction] | None = Field(
|
||||
default=None, sa_column=Column(JSON, nullable=True)
|
||||
)
|
||||
synergizes_with: list[str] | None = Field(
|
||||
default=None, sa_column=Column(JSON, nullable=True)
|
||||
)
|
||||
context_rules: ProductContext | None = Field(
|
||||
default=None, sa_column=Column(JSON, nullable=True)
|
||||
)
|
||||
|
|
@ -302,26 +287,6 @@ class Product(ProductBase, table=True):
|
|||
if nonzero:
|
||||
ctx["effect_profile"] = nonzero
|
||||
|
||||
if self.incompatible_with:
|
||||
parts = []
|
||||
for inc in self.incompatible_with:
|
||||
if isinstance(inc, dict):
|
||||
scope = inc.get("scope", "")
|
||||
target = inc.get("target", "")
|
||||
reason = inc.get("reason")
|
||||
else:
|
||||
scope = _ev(inc.scope)
|
||||
target = inc.target
|
||||
reason = inc.reason
|
||||
msg = f"avoid {target} ({scope})"
|
||||
if reason:
|
||||
msg += f": {reason}"
|
||||
parts.append(msg)
|
||||
ctx["incompatible_with"] = parts
|
||||
|
||||
if self.synergizes_with:
|
||||
ctx["synergizes_with"] = self.synergizes_with
|
||||
|
||||
if self.context_rules is not None:
|
||||
cr = self.context_rules
|
||||
if isinstance(cr, dict):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue