feat: the Financeiro profile (Dropstar, 2026-10-30)
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 4m44s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m12s

Financeiro sees the whole board, Pagamentos, Números and Cotações, and
cancels an order with its reason. It moves no card and touches no file;
resolving a payment stays with Gestão and Administração. Two narrower
capabilities carry it: "payments" (the Pagamentos list) and "cancel",
which used to need "manage". The order panel's menu shows each profile
only what it may do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-30 12:56:53 -03:00
parent 6a312bec9c
commit 8c053596b7
7 changed files with 44 additions and 13 deletions

View File

@@ -281,7 +281,7 @@ def finished_page(request: Request, before_created_at: datetime | None = None, b
@router.get('/api/operator/payment-events')
def payment_events(state: Literal['open','resolved','all'] = 'open',
offset: int = Query(default=0, ge=0),
limit: int = Query(default=20, ge=1, le=100), user=Depends(can('manage'))):
limit: int = Query(default=20, ge=1, le=100), user=Depends(can('payments'))):
"""Payments that needed a person, newest first: open ones to act on, resolved ones as history."""
where = {'open': 'AND resolved_at IS NULL', 'resolved': 'AND resolved_at IS NOT NULL', 'all': ''}[state]
with db.connect() as c:
@@ -611,7 +611,7 @@ def release_files(c, uploads):
@router.post('/api/operator/orders/{uid}/cancel')
def cancel_order(uid: UUID, body: Resolution, user=Depends(can('manage'))):
def cancel_order(uid: UUID, body: Resolution, user=Depends(can('cancel'))):
"""A paid order leaves the board but keeps its payment and history. Nothing
is refunded here (that is done at the provider); Tiny is told, so the
order is cancelled there too while it was not invoiced (app/tiny.py)."""

View File

@@ -25,7 +25,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']
role: Literal['admin', 'gestao', 'designer', 'operador', 'revisor', 'vendedor', 'financeiro']
password: str | None = Field(default=None, min_length=8, max_length=128)
active: bool = True
machines: list[UUID] = Field(default_factory=list, max_length=50)