fix: before approving, the panel learns that a file cannot be a final and says to treat the art (DTF-WEB-11)
All checks were successful
Build and deploy / Validate source (push) Successful in 8s
Build and deploy / Integration suite on a real stack (push) Successful in 7m15s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m28s

The panel offered the customer's correction (or an original) as ready to
approve, and the server refused it as not a transparent 300 DPI PNG,
an error for Sentry. POST /orders/{id}/final-check reads the header of
the order's own files with the same check as the approval and answers
200 with the problems; "Aprovar arquivo final" asks it first and, when a
file cannot be a final, says why and to use "Tratar a arte".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-23 11:52:01 -03:00
parent 6e05dd93c2
commit d51fe24eea
4 changed files with 65 additions and 6 deletions

View File

@@ -535,7 +535,19 @@ async function saveFinalFiles(order, files, note){
throw error;
}
}
// A customer's correction or an original may not be the transparent 300 DPI
// PNG a final must be: asked before approving, it is guidance with the way
// out, not a refusal (Sentry DTF-WEB-11). Returns whether all can be approved.
async function finalsOk(order,uploads){
const {problems}=await api('/orders/'+order.id+'/final-check',{uploads});
if(!problems.length)return true;
const first=problems[0];
say(first.name+' não pode ser o arquivo final como está: '+first.message.replace(/\.$/,'')+
'. Use “Tratar a arte” e envie o PNG preparado.'+(problems.length>1?' (e mais '+(problems.length-1)+')':''),false,12000);
return false;
}
async function approveReady(order,ready){
if(!await finalsOk(order,ready.flatMap(r=>r.files.map(f=>f.upload_id))))return;
const many=ready.length>1;
if(!await ask('Aprovar o arquivo final?','Conferiu? É este arquivo que vai para a impressão: '+
ready.map((r,i)=>(many?'item '+(i+1)+', ':'')+r.label).join('; ')+'.','Aprovar arquivo final',{host:$('drawer')}))return;