From 90b2d4ef539675ed2a8d643a59ea09c616c88727 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 29 Sep 2025 09:40:06 -0300 Subject: [PATCH] refactor(geral): implementando gerenciador de erro nos datas --- .../_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData.ts | 7 +++++-- .../GTRegimeComunhao/GTBRegimeComunhaoRemoveData.ts | 7 +++++-- .../_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData.ts | 7 +++++-- .../g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook.ts | 2 +- .../useGTBRegimeComunhaoRemoveHook.ts | 2 +- .../g_tb_regimecomunhao/useGTBRegimeComunhaoSaveHook.ts | 2 +- .../g_tb_regimecomunhao/GTBRegimeComunhaoIndexService.ts | 9 ++++++--- .../GTBRegimeComunhaoRemoveService.ts | 9 ++++++--- .../g_tb_regimecomunhao/GTBRegimeComunhaoSaveService.ts | 9 ++++++--- 9 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData.ts index 4dd3d24..e3e3771 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData.ts @@ -1,8 +1,9 @@ import API from "@/services/api/Api"; import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -export default async function GTBRegimeComunhaoIndexData() { +async function executeGTBRegimeComunhaoIndexData() { const api = new API(); @@ -11,4 +12,6 @@ export default async function GTBRegimeComunhaoIndexData() { endpoint: `administrativo/g_tb_regimecomunhao/` }); -} \ No newline at end of file +} + +export const GTBRegimeComunhaoIndexData = withClientErrorHandler(executeGTBRegimeComunhaoIndexData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData.ts index c92cb66..6352448 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData.ts @@ -1,8 +1,9 @@ import API from "@/services/api/Api"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -export default async function GTBRegimeComunhaoRemoveData(data: GTBRegimeComunhaoInterface) { +async function executeGTBRegimeComunhaoRemoveData(data: GTBRegimeComunhaoInterface) { const api = new API(); @@ -11,4 +12,6 @@ export default async function GTBRegimeComunhaoRemoveData(data: GTBRegimeComunha endpoint: `administrativo/g_tb_regimecomunhao/${data.tb_regimecomunhao_id}` }); -} \ No newline at end of file +} + +export const GTBRegimeComunhaoRemoveData = withClientErrorHandler(executeGTBRegimeComunhaoRemoveData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData.ts index 51cf575..adaad01 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData.ts @@ -1,8 +1,9 @@ import API from "@/services/api/Api"; import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -export default async function GTBRegimeComunhaoSaveData(data: GTBRegimeComunhaoInterface) { +async function executeGTBRegimeComunhaoSaveData(data: GTBRegimeComunhaoInterface) { const isUpdate = Boolean(data.tb_regimecomunhao_id); @@ -13,4 +14,6 @@ export default async function GTBRegimeComunhaoSaveData(data: GTBRegimeComunhaoI endpoint: `administrativo/g_tb_regimecomunhao/${data.tb_regimecomunhao_id || ''}`, body: data }); -} \ No newline at end of file +} + +export const GTBRegimeComunhaoSaveData = withClientErrorHandler(executeGTBRegimeComunhaoSaveData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook.ts index 1d1ff3a..412de89 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook.ts @@ -1,7 +1,7 @@ import { useResponse } from "@/app/_response/ResponseContext" import { useState } from "react"; import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; -import GTBRegimeComunhaoIndexService from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService"; +import { GTBRegimeComunhaoIndexService } from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService"; export const useGTBRegimeComunhaoReadHook = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoRemoveHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoRemoveHook.ts index 658231a..3550bd4 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoRemoveHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoRemoveHook.ts @@ -1,6 +1,6 @@ import { useResponse } from "@/app/_response/ResponseContext" import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; -import GTBRegimeComunhaoRemoveService from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService"; +import { GTBRegimeComunhaoRemoveService } from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService"; export const useGTBRegimeComunhaoRemoveHook = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoSaveHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoSaveHook.ts index b67690e..b37b082 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoSaveHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoSaveHook.ts @@ -1,7 +1,7 @@ import { useState } from "react"; import { useResponse } from "@/app/_response/ResponseContext" import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; -import GTBRegimeComunhaoSaveService from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService"; +import { GTBRegimeComunhaoSaveService } from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService"; export const useGTBRegimeComunhaoSaveHook = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService.ts index f23ded7..2dda641 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService.ts @@ -1,9 +1,12 @@ -import GTBRegimeComunhaoIndexData from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import { GTBRegimeComunhaoIndexData } from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData"; -export default async function GTBRegimeComunhaoIndexService() { +async function executeGTBRegimeComunhaoIndexService() { const response = await GTBRegimeComunhaoIndexData(); return response; -} \ No newline at end of file +} + +export const GTBRegimeComunhaoIndexService = withClientErrorHandler(executeGTBRegimeComunhaoIndexService) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService.ts index 06bec9b..05a2f1c 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService.ts @@ -1,10 +1,13 @@ -import GTBRegimeComunhaoRemoveData from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import { GTBRegimeComunhaoRemoveData } from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData"; import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; -export default async function GTBRegimeComunhaoRemoveService(data: GTBRegimeComunhaoInterface) { +async function executeGTBRegimeComunhaoRemoveService(data: GTBRegimeComunhaoInterface) { const response = await GTBRegimeComunhaoRemoveData(data); return response; -} \ No newline at end of file +} + +export const GTBRegimeComunhaoRemoveService = withClientErrorHandler(executeGTBRegimeComunhaoRemoveService) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService.ts index f81e5c9..eb9e69e 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService.ts @@ -1,10 +1,13 @@ -import GTBRegimeComunhaoSaveData from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import { GTBRegimeComunhaoSaveData } from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData"; import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface"; -export default async function GTBRegimeComunhaoSaveService(data: GTBRegimeComunhaoInterface) { +async function executeGTBRegimeComunhaoSaveService(data: GTBRegimeComunhaoInterface) { const response = await GTBRegimeComunhaoSaveData(data); return response; -} \ No newline at end of file +} + +export const GTBRegimeComunhaoSaveService = withClientErrorHandler(executeGTBRegimeComunhaoSaveService) \ No newline at end of file