refactor: update fichaPontoPDF and processamento to enhance legend styling and accumulate saldo for all days, improving report accuracy

This commit is contained in:
2025-12-15 11:50:51 -03:00
parent a951f61676
commit 60b53dac74
6 changed files with 124 additions and 36 deletions

View File

@@ -1,6 +1,18 @@
import { v } from 'convex/values';
import { mutation } from './_generated/server';
import { mutation, type MutationCtx } from './_generated/server';
import { authComponent, updatePassword } from './auth';
import type { GenericCtx } from '@convex-dev/better-auth';
import type { DataModel } from './_generated/dataModel';
/**
* Helper para converter MutationCtx para GenericCtx do better-auth
* Os tipos são estruturalmente compatíveis, apenas há diferença nas definições de tipo
*/
function toGenericCtx(ctx: MutationCtx): GenericCtx<DataModel> {
// Os tipos são estruturalmente idênticos, apenas há diferença nas definições de tipo
// entre a versão do Convex usada pelo projeto e a usada pelo @convex-dev/better-auth
return ctx as unknown as GenericCtx<DataModel>;
}
/**
* Alterar senha do usuário autenticado
@@ -19,7 +31,7 @@ export const alterarSenha = mutation({
handler: async (ctx, args) => {
try {
// Verificar se o usuário está autenticado
const authUser = await authComponent.safeGetAuthUser(ctx);
const authUser = await authComponent.safeGetAuthUser(toGenericCtx(ctx));
if (!authUser) {
return {
sucesso: false as const,