feat(F-085): completed feature

This commit is contained in:
chattie
2026-08-20 06:10:48 +02:00
parent 3b5ea8f261
commit 7ece045e13
10 changed files with 190 additions and 23 deletions

View File

@@ -145,6 +145,7 @@ export async function registerPricingRoutes(
name: z.string().min(1).max(40).optional(),
ratePercent: z.number().min(0).max(100).optional(),
active: z.boolean().optional(),
appliesTo: z.enum(['general', 'reduced', 'super-reduced']).optional(),
}),
request.body,
);
@@ -163,6 +164,10 @@ export async function registerPricingRoutes(
sets.push(`active = $${i++}`);
values.push(patch.active);
}
if (patch.appliesTo !== undefined) {
sets.push(`applies_to = $${i++}`);
values.push(patch.appliesTo);
}
if (!sets.length) return reply.send({ ok: true });
values.push(id);
await deps.pool.query(`UPDATE tax_rates SET ${sets.join(', ')} WHERE id = $${i}`, values);