feat: bouton Dévalider BAP, barre actions 2 lignes, suppression colonne Utilisateur
This commit is contained in:
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user