From 7fe725bdeb702455337e93cb57914f9e596793c3 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 29 Sep 2025 09:24:10 -0300 Subject: [PATCH 1/2] refactor(geral): implementando gerenciador de erro nos datas --- .../TTBAndamentoServico/TTBAndamentoServicoIndexData.ts | 7 +++++-- .../TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts | 7 +++++-- .../useTTBAndamentoServicoDeleteHook.ts | 2 +- .../useTTBAndamentoServicoReadHook.ts | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts index 3865338..cfb11af 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts @@ -1,9 +1,10 @@ 'use server' +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; import API from "@/services/api/Api"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; -export default async function TTBAndamentoServicoIndexData() { +async function executeTTBAndamentoServicoIndexData() { const api = new API(); @@ -14,4 +15,6 @@ export default async function TTBAndamentoServicoIndexData() { return response; -} \ No newline at end of file +} + +export const TTBAndamentoServicoIndexData = withClientErrorHandler(executeTTBAndamentoServicoIndexData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts index 5ad8fc9..cedc970 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts @@ -3,8 +3,9 @@ import API from "@/services/api/Api"; import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -export default async function TTBAndamentoServicoRemoveData(tTBAndamentoServico: TTBAndamentoServicoInteface) { +async function executeTTBAndamentoServicoRemoveData(tTBAndamentoServico: TTBAndamentoServicoInteface) { const api = new API(); @@ -15,4 +16,6 @@ export default async function TTBAndamentoServicoRemoveData(tTBAndamentoServico: return response; -} \ No newline at end of file +} + +export const TTBAndamentoServicoRemoveData = withClientErrorHandler(executeTTBAndamentoServicoRemoveData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts index c3407ee..8e3a115 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts @@ -1,7 +1,7 @@ import { useResponse } from "@/app/_response/ResponseContext" import { useState } from "react"; import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface"; -import TTBAndamentoServicoRemoveData from "../../_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData"; +import { TTBAndamentoServicoRemoveData } from "../../_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData"; export const useTTBAndamentoServicoDeleteHook = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts index bc0d99c..5e0eadf 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts @@ -3,7 +3,7 @@ import { useResponse } from "@/app/_response/ResponseContext" import { useState } from "react"; import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface"; -import TTBAndamentoServicoIndexData from "../../_data/TTBAndamentoServico/TTBAndamentoServicoIndexData"; +import { TTBAndamentoServicoIndexData } from "../../_data/TTBAndamentoServico/TTBAndamentoServicoIndexData"; export const useTTBAndamentoServicoReadHook = () => { From 3df00e38bc4c703b8bb18ab3d8c7189614eb455c Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 29 Sep 2025 09:27:12 -0300 Subject: [PATCH 2/2] refactor(geral): implementando gerenciador de erro nos datas --- .../TTBReconhecimentoTipoDeleteData.ts | 7 +++++-- .../TTBReconhecimentoTipoIndexData.ts | 7 +++++-- .../TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData.ts | 7 +++++-- .../useTTBReconhecimentoTipoDeleteHook.ts | 2 +- .../useTTBReconhecimentoTipoReadHook.ts | 2 +- .../useTTBReconhecimentoTipoSaveHook.ts | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData.ts index 5f279f9..acbb077 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData.ts @@ -1,8 +1,9 @@ import API from "@/services/api/Api"; import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -export default async function TTBReconhecimentoTipoDeleteData(data: TTBReconhecimentoTipoInterface) { +async function executeTTBReconhecimentoTipoDeleteData(data: TTBReconhecimentoTipoInterface) { const api = new API(); @@ -13,4 +14,6 @@ export default async function TTBReconhecimentoTipoDeleteData(data: TTBReconheci return response; -} \ No newline at end of file +} + +export const TTBReconhecimentoTipoDeleteData = withClientErrorHandler(executeTTBReconhecimentoTipoDeleteData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData.ts index 7d7995e..a9bea1b 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData.ts @@ -1,9 +1,10 @@ 'use server' +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; import API from "@/services/api/Api" import { Methods } from "@/services/api/enums/ApiMethodEnum"; -export default async function TTBReconhecimentoTipoIndexData() { +async function executeTTBReconhecimentoTipoIndexData() { const api = new API(); @@ -14,4 +15,6 @@ export default async function TTBReconhecimentoTipoIndexData() { return response; -} \ No newline at end of file +} + +export const TTBReconhecimentoTipoIndexData = withClientErrorHandler(executeTTBReconhecimentoTipoIndexData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData.ts index e045e65..37d9eea 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData.ts @@ -1,8 +1,9 @@ import API from "@/services/api/Api"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -export default async function TTBReconhecimentoTipoSaveData(data: TTBReconhecimentoTipoInterface) { +async function executeTTBReconhecimentoTipoSaveData(data: TTBReconhecimentoTipoInterface) { const api = new API(); @@ -14,4 +15,6 @@ export default async function TTBReconhecimentoTipoSaveData(data: TTBReconhecime return response; -} \ No newline at end of file +} + +export const TTBReconhecimentoTipoSaveData = withClientErrorHandler(executeTTBReconhecimentoTipoSaveData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoDeleteHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoDeleteHook.ts index eb926e7..782c22b 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoDeleteHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoDeleteHook.ts @@ -1,6 +1,6 @@ import { useResponse } from "@/app/_response/ResponseContext" import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface"; -import TTBReconhecimentoTipoDeleteData from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData"; +import { TTBReconhecimentoTipoDeleteData } from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData"; export const useTTBReconhecimentoTipoDeleteHook = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoReadHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoReadHook.ts index 5817953..8bd73db 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoReadHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoReadHook.ts @@ -3,7 +3,7 @@ import ITTTBReconhecimentoTipo from '../../_interfaces/TTBReconhecimentoTipoInterface' import { useResponse } from "@/app/_response/ResponseContext" import { useState } from "react"; -import TTBReconhecimentoTipoIndexData from '../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData'; +import { TTBReconhecimentoTipoIndexData } from '../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData'; export const useTTBReconhecimentoTipoReadHook = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoSaveHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoSaveHook.ts index 88a88df..75a3c76 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoSaveHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoSaveHook.ts @@ -3,7 +3,7 @@ import { useResponse } from "@/app/_response/ResponseContext" import { useState } from "react"; import ITTTBReconhecimentoTipo from '../../_interfaces/TTBReconhecimentoTipoInterface' -import TTBReconhecimentoTipoSaveData from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData"; +import { TTBReconhecimentoTipoSaveData } from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData"; export const useTTBReconhecimentoTipoSaveHook = () => {