Stelle den Frontend-MVP und die v0.3-API auf develop bereit, damit Dev API und PWA zusammen deployen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
827e6a2a11
commit
b276758ee1
152 files changed
+25846
-34
No files matched your search
@@ -0,0 +1,81 @@
|
||||
"""Notebook-pilot metadata only. Not part of the core schema or bootstrap."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.discovery.definitions import get_definition_by_key, upsert_definition
|
||||
from app.persistence.models import AttributeDefinitionRecord
|
||||
from app.services.catalog_service import ensure_product_category
|
||||
|
||||
|
||||
NOTEBOOK_ATTRIBUTE_SEEDS = (
|
||||
{"key": "ram_gb", "value_type": "number", "canonical_unit": "GB", "minimum": 0},
|
||||
{"key": "storage_gb", "value_type": "number", "canonical_unit": "GB", "minimum": 0},
|
||||
{"key": "weight_kg", "value_type": "number", "canonical_unit": "kg", "minimum": 0},
|
||||
{"key": "battery_score", "value_type": "number", "minimum": 0, "maximum": 100},
|
||||
{"key": "display_score", "value_type": "number", "minimum": 0, "maximum": 100},
|
||||
{"key": "cpu_score", "value_type": "number", "minimum": 0, "maximum": 100},
|
||||
)
|
||||
|
||||
NOTEBOOK_CRITERION_SEEDS = (
|
||||
{
|
||||
"key": "ram_gb",
|
||||
"origin": "SOURCE",
|
||||
"source": "geizhals",
|
||||
"product_category_id": "notebook",
|
||||
"label": "Arbeitsspeicher",
|
||||
"value_type": "number",
|
||||
"unit": "GB",
|
||||
"semantic": "working_memory",
|
||||
"category": "notebook",
|
||||
"scoring_attribute_key": "ram_gb",
|
||||
},
|
||||
{
|
||||
"key": "storage_gb",
|
||||
"origin": "SOURCE",
|
||||
"source": "geizhals",
|
||||
"product_category_id": "notebook",
|
||||
"label": "SSD",
|
||||
"value_type": "number",
|
||||
"unit": "GB",
|
||||
"semantic": "storage",
|
||||
"category": "notebook",
|
||||
"scoring_attribute_key": "storage_gb",
|
||||
},
|
||||
{
|
||||
"key": "weight_kg",
|
||||
"origin": "SOURCE",
|
||||
"source": "geizhals",
|
||||
"product_category_id": "notebook",
|
||||
"label": "Gewicht",
|
||||
"value_type": "number",
|
||||
"unit": "kg",
|
||||
"semantic": "weight",
|
||||
"category": "notebook",
|
||||
"scoring_attribute_key": "weight_kg",
|
||||
},
|
||||
{
|
||||
"key": "price_eur",
|
||||
"origin": "SOURCE",
|
||||
"source": "geizhals",
|
||||
"product_category_id": "notebook",
|
||||
"label": "Preis",
|
||||
"value_type": "number",
|
||||
"unit": "EUR",
|
||||
"semantic": "price",
|
||||
"category": "notebook",
|
||||
"scoring_attribute_key": "price_eur",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def seed_notebook_pilot(session: Session) -> None:
|
||||
ensure_product_category(session, "notebook", "Notebooks")
|
||||
for item in NOTEBOOK_ATTRIBUTE_SEEDS:
|
||||
if session.get(AttributeDefinitionRecord, item["key"]) is None:
|
||||
session.add(AttributeDefinitionRecord(**item, description=None))
|
||||
for item in NOTEBOOK_CRITERION_SEEDS:
|
||||
if get_definition_by_key(session, item["key"]) is None:
|
||||
upsert_definition(session, item)
|
||||
session.flush()
|
||||
Reference in new issue
Block a user