v0.1.27
Fix: Throughput API v1 available - Details posted to Irving. POWERBI_KEY was missing from the .ENV file, so was not live. Add: Editor now supports editing a mix's resolved formula directly, with % and kg dual entry on ingredient rows Fix: Mix Editor should bring through correct ingredients. New resolved formula (same logic we use in Mix Calculator). Fix: Security headers on all API responses (hardening) Add: New mix button available on the Mix Editor. Add: New ingredient button available on the Ingredient Editor
This commit is contained in:
@@ -10,6 +10,7 @@ from app.api.deps import AuthSession, require_client_module_access
|
||||
from app.db.session import get_db
|
||||
from app.models.throughput import ProductionThroughput, ThroughputProduct
|
||||
from app.schemas.throughput import (
|
||||
ThroughputDeleteAllResult,
|
||||
ThroughputEntryCreate,
|
||||
ThroughputEntryRead,
|
||||
ThroughputEntryUpdate,
|
||||
@@ -216,6 +217,21 @@ def import_entries(
|
||||
return result
|
||||
|
||||
|
||||
@router.delete("/entries", response_model=ThroughputDeleteAllResult)
|
||||
def delete_all_entries(
|
||||
# Clearing the log is part of correcting a bad import, so it sits at the same
|
||||
# "edit" level as deleting a single entry. It is scoped to the caller's
|
||||
# tenant, so one client can never wipe another's data.
|
||||
session: AuthSession = Depends(require_client_module_access(MODULE_KEY, "edit")),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
deleted = db.query(ProductionThroughput).filter(
|
||||
ProductionThroughput.tenant_id == session.tenant_id
|
||||
).delete(synchronize_session=False)
|
||||
db.commit()
|
||||
return ThroughputDeleteAllResult(entries_deleted=deleted)
|
||||
|
||||
|
||||
@router.get("/entries/{entry_id}", response_model=ThroughputEntryRead)
|
||||
def get_entry(
|
||||
entry_id: int,
|
||||
|
||||
Reference in New Issue
Block a user