ываыв

This commit is contained in:
Kirill
2026-05-28 21:46:17 +05:00
parent ba375aee12
commit f34c05095a
12 changed files with 1039 additions and 18 deletions
+7
View File
@@ -7,6 +7,8 @@ export async function registerAdminOrderRoutes(fastify) {
const attentionCount = await prisma.order.count({
where: {
status: 'PENDING_PAYMENT',
deliveryType: 'delivery',
deliveryFeeLocked: false,
},
})
return { attentionCount }
@@ -97,6 +99,11 @@ export async function registerAdminOrderRoutes(fastify) {
error: `Нельзя сменить статус ${existing.status}${next}`,
})
}
if (next === 'PAID' && existing.deliveryType === 'delivery' && existing.deliveryFeeLocked === false) {
return reply.code(409).send({
error: 'Сначала подтвердите итоговую стоимость доставки',
})
}
const updated = await prisma.order.update({
where: { id },