refactor(products): remove usage notes and contraindications fields
This commit is contained in:
parent
9df241a6a9
commit
013492ec2b
16 changed files with 54 additions and 179 deletions
|
|
@ -107,9 +107,6 @@ class ProductBase(SQLModel):
|
|||
recommended_for: list[SkinType] = Field(default_factory=list)
|
||||
|
||||
targets: list[SkinConcern] = Field(default_factory=list)
|
||||
contraindications: list[str] = Field(default_factory=list)
|
||||
usage_notes: str | None = None
|
||||
|
||||
fragrance_free: bool | None = None
|
||||
essential_oils_free: bool | None = None
|
||||
alcohol_denat_free: bool | None = None
|
||||
|
|
@ -161,9 +158,6 @@ class Product(ProductBase, table=True):
|
|||
targets: list[SkinConcern] = Field(
|
||||
default_factory=list, sa_column=Column(JSON, nullable=False)
|
||||
)
|
||||
contraindications: list[str] = Field(
|
||||
default_factory=list, sa_column=Column(JSON, nullable=False)
|
||||
)
|
||||
|
||||
product_effect_profile: ProductEffectProfile = Field(
|
||||
default_factory=ProductEffectProfile,
|
||||
|
|
@ -217,9 +211,6 @@ class Product(ProductBase, table=True):
|
|||
if self.category == ProductCategory.SPF and not self.leave_on:
|
||||
raise ValueError("SPF products must be leave-on")
|
||||
|
||||
if self.is_medication and not self.usage_notes:
|
||||
raise ValueError("Medication products must have usage_notes")
|
||||
|
||||
if self.price_currency is not None:
|
||||
self.price_currency = self.price_currency.upper()
|
||||
|
||||
|
|
@ -267,9 +258,6 @@ class Product(ProductBase, table=True):
|
|||
ctx["recommended_for"] = [_ev(s) for s in self.recommended_for]
|
||||
if self.targets:
|
||||
ctx["targets"] = [_ev(s) for s in self.targets]
|
||||
if self.contraindications:
|
||||
ctx["contraindications"] = self.contraindications
|
||||
|
||||
if self.actives:
|
||||
actives_ctx = []
|
||||
for a in self.actives:
|
||||
|
|
@ -337,9 +325,6 @@ class Product(ProductBase, table=True):
|
|||
ctx["is_tool"] = True
|
||||
if self.needle_length_mm is not None:
|
||||
ctx["needle_length_mm"] = self.needle_length_mm
|
||||
if self.usage_notes:
|
||||
ctx["usage_notes"] = self.usage_notes
|
||||
|
||||
if self.personal_tolerance_notes:
|
||||
ctx["personal_tolerance_notes"] = self.personal_tolerance_notes
|
||||
if self.personal_repurchase_intent is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue