This commit is contained in:
xds
2026-03-22 12:40:33 +03:00
commit 28a5d51389
61 changed files with 6085 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
from sqlalchemy import Boolean, Float, Integer, String, Text, func
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm import Mapped, mapped_column
from datetime import datetime
from app.database import Base
class Material(Base):
__tablename__ = "materials"
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(100), nullable=False)
category: Mapped[str] = mapped_column(String(50), nullable=False)
density_g_cm3: Mapped[float] = mapped_column(Float, nullable=False)
price_per_gram: Mapped[float] = mapped_column(Float, nullable=False)
flow_rate_mm3_s: Mapped[float] = mapped_column(Float, nullable=False)
max_temp_c: Mapped[int | None] = mapped_column(Integer)
min_temp_c: Mapped[int | None] = mapped_column(Integer)
strength: Mapped[str | None] = mapped_column(String(20))
flexibility: Mapped[str | None] = mapped_column(String(20))
chemical_resistance: Mapped[str | None] = mapped_column(String(20))
uv_resistance: Mapped[str | None] = mapped_column(String(20))
food_safe: Mapped[bool] = mapped_column(Boolean, default=False)
description: Mapped[str | None] = mapped_column(Text)
color_options: Mapped[dict] = mapped_column(JSONB, default=list)
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
created_at: Mapped[datetime] = mapped_column(default=func.now())