Remove internal filament management, integrate FilamentDB, add job detail page
Filament removal:
- Deleted app/models/filament.py, routers/filaments.py, templates/filaments.html
- Migration 0009: drops filaments table and filament_id FK from print_jobs
- Removed Filaments from sidebar and all internal references
FilamentDB integration (read-only):
- app/filamentdb.py: GET /reports/stock with 5-min in-memory cache
- available_materials() / available_colors() populate job form dropdowns
- Falls back to static constants if FilamentDB unreachable
- Dashboard filament count now from FilamentDB rolls_in_stock
- FILAMENTDB_URL added to .env.install; httpx added to requirements
Job detail page (/jobs/{id}):
- Two cards: Job info (customer, material, printer, bracket, timing, cost)
and File & Geometry (bounding box + volume from stl_cache)
- Log timeline with Add Entry modal
- Filename in jobs list links to detail page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
41
alembic/versions/0009_remove_filaments.py
Normal file
41
alembic/versions/0009_remove_filaments.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""remove internal filaments table — filament data now from FilamentDB
|
||||
|
||||
Revision ID: 0009
|
||||
Revises: 0008
|
||||
Create Date: 2026-06-18
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0009"
|
||||
down_revision: Union[str, None] = "0008"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_constraint("fk_job_filament", "print_jobs", type_="foreignkey")
|
||||
op.drop_column("print_jobs", "filament_id")
|
||||
op.drop_table("filaments")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.create_table(
|
||||
"filaments",
|
||||
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column("brand", sa.String(100), nullable=True),
|
||||
sa.Column("material", sa.String(50), nullable=False, server_default="PLA"),
|
||||
sa.Column("color", sa.String(100), nullable=True),
|
||||
sa.Column("color_hex", sa.String(7), nullable=True),
|
||||
sa.Column("weight_total_g", sa.Numeric(8, 2), nullable=False),
|
||||
sa.Column("weight_remaining_g", sa.Numeric(8, 2), nullable=False),
|
||||
sa.Column("price_per_kg_eur", sa.Numeric(8, 2), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False, server_default=sa.text("CURRENT_TIMESTAMP")),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False, server_default=sa.text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.add_column("print_jobs", sa.Column("filament_id", sa.Integer(), nullable=True))
|
||||
op.create_foreign_key("fk_job_filament", "print_jobs", "filaments", ["filament_id"], ["id"])
|
||||
Reference in New Issue
Block a user