aboutsummaryrefslogtreecommitdiffstats
path: root/thallium-backend/src
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-08-25 04:00:55 +0100
committerGravatar Joe Banks <[email protected]>2024-08-25 04:00:55 +0100
commit1f00ab65906ea93d5d2a7c887456b66767500838 (patch)
tree2244a203498bcd2a88d0c5ba89c0e8c1925a2727 /thallium-backend/src
parentCorrect permission in seed script (diff)
Add support for nullable colour and colour_code2
Diffstat (limited to 'thallium-backend/src')
-rw-r--r--thallium-backend/src/dto/templates.py5
-rw-r--r--thallium-backend/src/orm/templates.py5
-rw-r--r--thallium-backend/src/routes/admin.py2
3 files changed, 8 insertions, 4 deletions
diff --git a/thallium-backend/src/dto/templates.py b/thallium-backend/src/dto/templates.py
index 48ab685..8f3b382 100644
--- a/thallium-backend/src/dto/templates.py
+++ b/thallium-backend/src/dto/templates.py
@@ -20,8 +20,9 @@ class Variant(BaseModel):
variant_id: int
name: str
size: str
- colour: str
- colour_code: str
+ colour: str | None
+ colour_code: str | None
+ colour_code2: str | None
price: Decimal
last_synced: datetime
diff --git a/thallium-backend/src/orm/templates.py b/thallium-backend/src/orm/templates.py
index cffd5ca..e46d015 100644
--- a/thallium-backend/src/orm/templates.py
+++ b/thallium-backend/src/orm/templates.py
@@ -45,8 +45,9 @@ class Variant(AuditBase, Base):
variant_id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str]
size: Mapped[str]
- colour: Mapped[str]
- colour_code: Mapped[str]
+ colour: Mapped[str] = mapped_column(nullable=True)
+ colour_code: Mapped[str] = mapped_column(nullable=True)
+ colour_code2: Mapped[str] = mapped_column(nullable=True)
price: Mapped[Decimal]
last_synced: Mapped[datetime] = mapped_column(DateTime(timezone=True))
diff --git a/thallium-backend/src/routes/admin.py b/thallium-backend/src/routes/admin.py
index c2e0228..9eb146d 100644
--- a/thallium-backend/src/routes/admin.py
+++ b/thallium-backend/src/routes/admin.py
@@ -43,6 +43,7 @@ async def sync_variants(variant_ids: list[int], db: DBSession, client: PrintfulC
"size": variant["size"],
"colour": variant["color"],
"colour_code": variant["color_code"],
+ "colour_code2": variant["color_code2"],
"price": variant["price"],
"last_synced": datetime.now(tz=UTC),
}
@@ -55,6 +56,7 @@ async def sync_variants(variant_ids: list[int], db: DBSession, client: PrintfulC
"size": stmt.excluded.size,
"colour": stmt.excluded.colour,
"colour_code": stmt.excluded.colour_code,
+ "colour_code2": stmt.excluded.colour_code2,
"price": stmt.excluded.price,
"last_synced": stmt.excluded.last_synced,
},