feat: Add 'atas' (minutes/records) management feature, and implement various improvements across UI, backend logic, and authentication.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { query, mutation } from './_generated/server';
|
||||
import { internal } from './_generated/api';
|
||||
import { v } from 'convex/values';
|
||||
import { getCurrentUserFunction } from './auth';
|
||||
import type { Id, Doc } from './_generated/dataModel';
|
||||
import { internal } from './_generated/api';
|
||||
import type { Doc, Id } from './_generated/dataModel';
|
||||
import type { MutationCtx, QueryCtx } from './_generated/server';
|
||||
import { mutation, query } from './_generated/server';
|
||||
import { getCurrentUserFunction } from './auth';
|
||||
import { flowInstanceStatus, flowInstanceStepStatus, flowTemplateStatus } from './tables/flows';
|
||||
|
||||
// ============================================
|
||||
@@ -66,7 +66,10 @@ async function obterEtapaAnterior(
|
||||
.collect();
|
||||
|
||||
// Obter posições de cada passo
|
||||
const stepsWithPosition: Array<{ step: Doc<'flowInstanceSteps'>; position: number }> = [];
|
||||
const stepsWithPosition: Array<{
|
||||
step: Doc<'flowInstanceSteps'>;
|
||||
position: number;
|
||||
}> = [];
|
||||
for (const s of allSteps) {
|
||||
const flowStep = await ctx.db.get(s.flowStepId);
|
||||
if (flowStep) {
|
||||
@@ -1154,7 +1157,10 @@ export const completeStep = mutation({
|
||||
.collect();
|
||||
|
||||
// Encontrar o próximo passo pendente
|
||||
const flowSteps: Array<{ stepId: Id<'flowInstanceSteps'>; position: number }> = [];
|
||||
const flowSteps: Array<{
|
||||
stepId: Id<'flowInstanceSteps'>;
|
||||
position: number;
|
||||
}> = [];
|
||||
for (const s of allSteps) {
|
||||
const flowStep = await ctx.db.get(s.flowStepId);
|
||||
if (flowStep) {
|
||||
@@ -1192,7 +1198,9 @@ export const completeStep = mutation({
|
||||
|
||||
if (nextStep) {
|
||||
// Atualizar currentStepId para o próximo passo
|
||||
await ctx.db.patch(step.flowInstanceId, { currentStepId: nextStep.stepId });
|
||||
await ctx.db.patch(step.flowInstanceId, {
|
||||
currentStepId: nextStep.stepId
|
||||
});
|
||||
|
||||
// Criar notificações para o setor do próximo passo
|
||||
const nextStepData = await ctx.db.get(nextStep.stepId);
|
||||
@@ -1424,7 +1432,9 @@ export const reassignStep = mutation({
|
||||
throw new Error('O funcionário atribuído não pertence ao setor deste passo');
|
||||
}
|
||||
|
||||
await ctx.db.patch(args.instanceStepId, { assignedToId: args.assignedToId });
|
||||
await ctx.db.patch(args.instanceStepId, {
|
||||
assignedToId: args.assignedToId
|
||||
});
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user