feat: Expedição profile, stamp sizes and the Montar folha screen (front 7a.1)
The new Expedição profile and the seller may assemble sheets (capability assemble). Gestão edits the size table (letter and width). The Montar tab reads Estampas/<code>-<size>.png or <code>.png from the orders folder, checks the resolution with the Site's 96/200 DPI ruler, merges repeated lines and estimates the metres. Montar itself is slice 2. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
25
app/api/stamps.py
Normal file
25
app/api/stamps.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""The montador's stamp sizes (Fase 2, front 7): Gestão edits the table."""
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from ..core import db
|
||||
from ..core.auth import audit, can
|
||||
from ..core.models import StampSizeTable
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get('/api/operator/stamp-sizes')
|
||||
def stamp_sizes(user=Depends(can('assemble'))):
|
||||
with db.connect() as c:
|
||||
rows = c.execute('SELECT letter,width_cm FROM dtf_local.stamp_sizes ORDER BY width_cm, letter').fetchall()
|
||||
return {'sizes': rows}
|
||||
|
||||
|
||||
@router.post('/api/operator/stamp-sizes')
|
||||
def save_stamp_sizes(body: StampSizeTable, user=Depends(can('manage'))):
|
||||
with db.connect() as c:
|
||||
c.execute('DELETE FROM dtf_local.stamp_sizes')
|
||||
c.cursor().executemany('INSERT INTO dtf_local.stamp_sizes(letter,width_cm,updated_by) VALUES(%s,%s,%s)',
|
||||
[(row.letter, row.width_cm, user) for row in body.sizes])
|
||||
audit('stamp_sizes_changed', operator=user, sizes=len(body.sizes))
|
||||
return {'ok': True}
|
||||
@@ -26,7 +26,7 @@ class UserIn(StrictModel):
|
||||
# The profiles an administrator may give; superadmin only comes from the console.
|
||||
name: str = Field(min_length=1, max_length=80)
|
||||
email: str = Field(min_length=3, max_length=254)
|
||||
role: Literal['admin', 'gestao', 'designer', 'operador', 'revisor', 'vendedor', 'financeiro']
|
||||
role: Literal['admin', 'gestao', 'designer', 'operador', 'revisor', 'vendedor', 'financeiro', 'expedicao']
|
||||
password: str | None = Field(default=None, min_length=8, max_length=128)
|
||||
active: bool = True
|
||||
# No longer used: an operator's machine is the one chosen after signing in
|
||||
|
||||
Reference in New Issue
Block a user