feat: bouton Dévalider BAP, barre actions 2 lignes, suppression colonne Utilisateur

This commit is contained in:
Manus
2026-06-15 12:14:25 -04:00
parent a9387eaaea
commit b34e145d5d
2 changed files with 65 additions and 21 deletions

View File

@@ -654,6 +654,24 @@ export const appRouter = router({
};
}),
// ── Dévalidation BAP ──────────────────────────────────────
devalidateBAP: protectedProcedure
.input(z.object({ invoiceIds: z.array(z.number()) }))
.mutation(async ({ input, ctx }) => {
let processed = 0;
for (const id of input.invoiceIds) {
const invoice = await getInvoiceById(id);
if (!invoice || invoice.userId !== ctx.user.id) continue;
await updateInvoice(id, {
bapValidated: 0,
bapValidatedAt: null,
exportStatus: "not_exported",
});
processed++;
}
return { success: true, processed };
}),
// ── Validation BAP en masse ──────────────────────────────
validateBAPBulk: protectedProcedure
.mutation(async ({ ctx }) => {