implementacao de logs de auditoria e alterar multiplos registros de competencia
This commit is contained in:
@@ -392,6 +392,27 @@ class FechamentoFechamentosService {
|
||||
this.handleAxiosError(error, "Erro ao alterar competência da tarefa.");
|
||||
}
|
||||
}
|
||||
|
||||
async alterarCompetenciaTarefasEmLote(
|
||||
fechamentoId: string,
|
||||
input: { tarefaIds: string[]; competenciaDestinoId: string; alteradoPorId: string; motivo?: string },
|
||||
): Promise<{ alteradas: number; tarefas: FechamentoTarefaItem[] }> {
|
||||
try {
|
||||
const headers = await buildCommanderHeaders();
|
||||
const baseUrl = resolveCommanderBaseUrl();
|
||||
const response = await axios.post<{
|
||||
data: { alteradas: number; tarefas: FechamentoTarefaItem[] };
|
||||
}>(`${baseUrl}/fechamentos/${fechamentoId}/tarefas/alterar-competencia`, {
|
||||
tarefa_ids: input.tarefaIds,
|
||||
competencia_destino_id: input.competenciaDestinoId,
|
||||
alterado_por_id: input.alteradoPorId,
|
||||
...(input.motivo?.trim() ? { motivo: input.motivo.trim() } : {}),
|
||||
}, { headers });
|
||||
return response.data.data;
|
||||
} catch (error) {
|
||||
this.handleAxiosError(error, "Erro ao alterar competência das tarefas.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const fechamentoFechamentosService = new FechamentoFechamentosService();
|
||||
|
||||
Reference in New Issue
Block a user