feat: Refactor order flow initiation logic and enhance UI button styles for better user experience
This commit is contained in:
@@ -4,6 +4,7 @@ import type { Doc, Id } from './_generated/dataModel';
|
||||
import type { MutationCtx, QueryCtx } from './_generated/server';
|
||||
import { internalMutation, mutation, query } from './_generated/server';
|
||||
import { getCurrentUserFunction } from './auth';
|
||||
import { iniciarFluxoPedidoInternal } from './pedidoFlow';
|
||||
import { getTodayYMD, isWithinRangeYMD, maxYMD } from './utils/datas';
|
||||
|
||||
// ========== HELPERS ==========
|
||||
@@ -1292,6 +1293,9 @@ export const create = mutation({
|
||||
data: Date.now()
|
||||
});
|
||||
|
||||
// 5. Iniciar Fluxo se houver etapas
|
||||
await iniciarFluxoPedidoInternal(ctx, pedidoId, user._id);
|
||||
|
||||
return pedidoId;
|
||||
}
|
||||
});
|
||||
@@ -2079,6 +2083,9 @@ export const enviarParaAceite = mutation({
|
||||
data: Date.now()
|
||||
});
|
||||
|
||||
// Garantir que o fluxo foi iniciado
|
||||
await iniciarFluxoPedidoInternal(ctx, args.pedidoId, user._id);
|
||||
|
||||
await ctx.scheduler.runAfter(0, internal.pedidos.notifyStatusChange, {
|
||||
pedidoId: args.pedidoId,
|
||||
oldStatus,
|
||||
|
||||
Reference in New Issue
Block a user