refactor: improve type safety and error handling in vacation management components

- Updated the `AprovarFerias.svelte` component to use specific types for `solicitacao` and `gestorId`, enhancing type safety.
- Improved error handling by refining catch blocks to handle errors more accurately.
- Made minor adjustments to ensure consistent code formatting and readability across the component.
This commit is contained in:
2025-10-31 13:39:41 -03:00
parent 5dec7d7da7
commit 5cb63f9437
20 changed files with 155 additions and 112 deletions

View File

@@ -1,5 +1,6 @@
import { internalMutation, query } from "./_generated/server";
import { v } from "convex/values";
import { Id, Doc } from "./_generated/dataModel";
/**
* Verificar duplicatas de matrícula
@@ -33,7 +34,7 @@ export const verificarDuplicatas = query({
email: usuario.email || "",
});
return acc;
}, {} as Record<string, any[]>);
}, {} as Record<string, Array<{ _id: Id<"usuarios">; nome: string; email: string }>>);
// Filtrar apenas duplicatas
const duplicatas = Object.entries(gruposPorMatricula)
@@ -67,7 +68,7 @@ export const removerDuplicatas = internalMutation({
}
acc[usuario.matricula].push(usuario);
return acc;
}, {} as Record<string, any[]>);
}, {} as Record<string, Doc<"usuarios">[]>);
let removidos = 0;
const matriculasDuplicadas: string[] = [];