feat: Add 'atas' (minutes/records) management feature, and implement various improvements across UI, backend logic, and authentication.

This commit is contained in:
2025-12-02 16:37:48 -03:00
parent 05e7f1181d
commit 4bd9e21748
265 changed files with 29156 additions and 26460 deletions

View File

@@ -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;
}
});