nova função de alterar task de competencia

This commit is contained in:
Vitex Tecnologia
2026-04-29 10:13:17 -03:00
parent b19e2963c4
commit d570029890
3 changed files with 206 additions and 2 deletions
+24
View File
@@ -95,6 +95,7 @@ export type ExportarPlanilhaResponse = {
type ApiErrorShape = {
error?: {
code?: string;
message?: string;
};
};
@@ -309,6 +310,29 @@ class FechamentoFechamentosService {
this.handleAxiosError(error, "Erro ao reprocessar tarefas do Asana.");
}
}
async alterarCompetenciaTarefa(
fechamentoId: string,
tarefaId: string,
input: { competenciaDestinoId: string; alteradoPorId: string; motivo?: string },
): Promise<FechamentoTarefaItem> {
try {
const headers = await buildCommanderHeaders();
const baseUrl = resolveCommanderBaseUrl();
const response = await axios.post<PatchTarefaResponse>(
`${baseUrl}/fechamentos/${fechamentoId}/tarefas/${tarefaId}/alterar-competencia`,
{
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 da tarefa.");
}
}
}
export const fechamentoFechamentosService = new FechamentoFechamentosService();