feat(F-085): completed feature
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user