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>
26 lines
986 B
Python
26 lines
986 B
Python
"""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}
|