From 2d37d4d4212ca93f10350adaaaffe0ae6387d4da Mon Sep 17 00:00:00 2001 From: Keven Date: Tue, 2 Dec 2025 18:23:41 -0300 Subject: [PATCH] [MVPTN-37] feat(Pesquisa): Adiciona query params nas urls --- .../_data/GEmolumento/GEmolumentoIndexData.ts | 6 ++--- .../_interfaces/GEmolumentoReadInterface.ts | 1 + .../g_emolumento/GEmolumentoIndexService.ts | 1 + .../GEmolumento/GEmolumentoServicoSelect.tsx | 3 ++- .../components/GUsuario/GUsuarioSelect.tsx | 13 +++++++++- .../TPessoa/TPessoaTableFormSubview.tsx | 4 +-- .../TServicoTipo/TServicoTipoSelect.tsx | 11 +++++++- .../data/GUsuario/GUsuarioIndexData.ts | 8 ++++-- .../TServicoTipo/TServicoTipoIndexData.ts | 10 +++++--- .../hooks/GUsuario/useGUsuarioIndexHook.ts | 9 ++++--- .../TServicoTipo/useTServicoTipoReadHook.ts | 11 +++++--- .../GUsuario/GUsuarioIndexInterface.ts | 3 +++ .../TServicoTipo/TServicoTipoIndexInteface.ts | 3 +++ .../services/GUsuario/GUsuarioIndex.ts | 5 ++-- .../TServicoTipo/TServicoTipoIndexService.ts | 5 ++-- .../TServicoPedidoDetailsPagamento.tsx | 22 ---------------- src/shared/components/dataTable/DataTable.tsx | 6 ++--- .../data/fingertech/FingerTechCaptureData.ts | 8 ++++++ .../data/fingertech/FingerTechEnrollData.ts | 25 +++++++++++++++++++ .../data/fingertech/FingerTechMatchData.ts | 23 +++++++++++++++++ ...dexHook.ts => useFingerTechCaptureHook.ts} | 2 +- .../FingerTech/useFingerTechEnrollHook.ts | 25 +++++++++++++++++++ .../FingerTech/useFingerTechMatchHook.ts | 25 +++++++++++++++++++ .../FingerTech/FingerTechEnrollService.ts | 9 +++++++ .../FingerTech/FingerTechMatchService.ts | 9 +++++++ 25 files changed, 195 insertions(+), 52 deletions(-) create mode 100644 src/packages/administrativo/interfaces/GUsuario/GUsuarioIndexInterface.ts create mode 100644 src/packages/administrativo/interfaces/TServicoTipo/TServicoTipoIndexInteface.ts create mode 100644 src/shared/data/fingertech/FingerTechEnrollData.ts create mode 100644 src/shared/data/fingertech/FingerTechMatchData.ts rename src/shared/hooks/FingerTech/{useFingerTechIndexHook.ts => useFingerTechCaptureHook.ts} (90%) create mode 100644 src/shared/hooks/FingerTech/useFingerTechEnrollHook.ts create mode 100644 src/shared/hooks/FingerTech/useFingerTechMatchHook.ts create mode 100644 src/shared/services/FingerTech/FingerTechEnrollService.ts create mode 100644 src/shared/services/FingerTech/FingerTechMatchService.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/GEmolumento/GEmolumentoIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/GEmolumento/GEmolumentoIndexData.ts index e8e80b8..ceb79ab 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/GEmolumento/GEmolumentoIndexData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/GEmolumento/GEmolumentoIndexData.ts @@ -11,16 +11,14 @@ import { GEmolumentoReadInterface } from '../../_interfaces/GEmolumentoReadInter // Função assíncrona responsável por executar a requisição para listar os tipos de marcação async function executeGEmolumentoIndexData(data: GEmolumentoReadInterface) { + // Cria uma nova instância da classe API para enviar a requisição const api = new API(); - // Concatena o endpoint com a query string (caso existam parâmetros) - const endpoint = `administrativo/g_emolumento/sistema/${data.sistema_id}`; - // Envia uma requisição GET para o endpoint 'administrativo/g_marcacao_tipo/' return await api.send({ method: Methods.GET, - endpoint: endpoint, + endpoint: `administrativo/g_emolumento/sistema/${data.sistema_id}?${new URLSearchParams(data.urlParams).toString()}`, }); } diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface.ts index 111562f..b853138 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_interfaces/GEmolumentoReadInterface.ts @@ -1,3 +1,4 @@ export interface GEmolumentoReadInterface { sistema_id?: number; + urlParams?: object } diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/g_emolumento/GEmolumentoIndexService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/g_emolumento/GEmolumentoIndexService.ts index 4d46361..8d90167 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/g_emolumento/GEmolumentoIndexService.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_services/g_emolumento/GEmolumentoIndexService.ts @@ -7,6 +7,7 @@ import { GEmolumentoReadInterface } from '../../_interfaces/GEmolumentoReadInter // Função assíncrona responsável por executar o serviço de listagem de tipos de marcação async function executeGEmolumentoIndexService(data: GEmolumentoReadInterface) { + // Chama a função que realiza a requisição à API e aguarda a resposta const response = await GEmolumentoIndexData(data); diff --git a/src/packages/administrativo/components/GEmolumento/GEmolumentoServicoSelect.tsx b/src/packages/administrativo/components/GEmolumento/GEmolumentoServicoSelect.tsx index 487c82f..bf7a479 100644 --- a/src/packages/administrativo/components/GEmolumento/GEmolumentoServicoSelect.tsx +++ b/src/packages/administrativo/components/GEmolumento/GEmolumentoServicoSelect.tsx @@ -37,7 +37,8 @@ export default function GEmolumentoServicoSelect({ const [open, setOpen] = useState(false); const [isLoading, setIsLoading] = useState(false); - const gEmolumentoReadParams: GEmolumentoReadInterface = { sistema_id }; + // Define parâmetros de leitura para o hook que busca os emolumentos + const gEmolumentoReadParams: GEmolumentoReadInterface = { sistema_id, urlParams: { situacao: 'A' } }; const { gEmolumento = [], fetchGEmolumento } = useGEmolumentoReadHook(); /** diff --git a/src/packages/administrativo/components/GUsuario/GUsuarioSelect.tsx b/src/packages/administrativo/components/GUsuario/GUsuarioSelect.tsx index 856e772..ee5d466 100644 --- a/src/packages/administrativo/components/GUsuario/GUsuarioSelect.tsx +++ b/src/packages/administrativo/components/GUsuario/GUsuarioSelect.tsx @@ -19,6 +19,7 @@ import { useGUsuarioIndexHook } from '@/packages/administrativo/hooks/GUsuario/u import GUsuarioSelectInterface from '@/packages/administrativo/interfaces/GUsuario/GUsuarioSelectInterface'; import GetCapitalize from '@/shared/actions/text/GetCapitalize'; +import GUsuarioIndexInterface from '../../interfaces/GUsuario/GusuarioIndexInterface'; export default function GUsuarioSelect({ field }: GUsuarioSelectInterface) { const [open, setOpen] = useState(false); @@ -30,9 +31,19 @@ export default function GUsuarioSelect({ field }: GUsuarioSelectInterface) { * useCallback evita recriação desnecessária da função. */ const loadData = useCallback(async () => { + + const urlParams = { + assina: 'S', + situacao: 'A' + } + + const GUsuarioIndex: GUsuarioIndexInterface = { + urlParams: urlParams + } + if (usuarios?.length) return; setIsLoading(true); - await fetchUsuarios(); + await fetchUsuarios(GUsuarioIndex); setIsLoading(false); }, [usuarios?.length, fetchUsuarios]); diff --git a/src/packages/administrativo/components/TPessoa/TPessoaTableFormSubview.tsx b/src/packages/administrativo/components/TPessoa/TPessoaTableFormSubview.tsx index 95c06f1..367b213 100644 --- a/src/packages/administrativo/components/TPessoa/TPessoaTableFormSubview.tsx +++ b/src/packages/administrativo/components/TPessoa/TPessoaTableFormSubview.tsx @@ -19,7 +19,7 @@ import { import TPessoaCartaoForm from '@/packages/servicos/components/TPessoaCartao/TPessoaCartaoForm'; import GetNameInitials from '@/shared/actions/text/GetNameInitials'; import WebCamDialog from '@/shared/components/webcam/WebCamDialog'; -import { useFingerTechIndexHook } from '@/shared/hooks/FingerTech/useFingerTechIndexHook'; +import { useFingerTechCaptureHook } from '@/shared/hooks/FingerTech/useFingerTechCaptureHook'; import TPessoaTableFormSubviewInterface from '../../interfaces/TPessoa/TPessoaTableFormSubviewInterface'; @@ -31,7 +31,7 @@ function TPessoaTableFormSubview({ }: TPessoaTableFormSubviewInterface) { const [isWebCamOpenDialog, setIsWebCamOpenDialog] = useState(false) - const { base64, captureFingerTech } = useFingerTechIndexHook(); + const { base64, captureFingerTech } = useFingerTechCaptureHook(); // Chama o leitor biométrico const handleBiometria = useCallback(() => { diff --git a/src/packages/administrativo/components/TServicoTipo/TServicoTipoSelect.tsx b/src/packages/administrativo/components/TServicoTipo/TServicoTipoSelect.tsx index 1d9aeb3..232b308 100644 --- a/src/packages/administrativo/components/TServicoTipo/TServicoTipoSelect.tsx +++ b/src/packages/administrativo/components/TServicoTipo/TServicoTipoSelect.tsx @@ -19,6 +19,8 @@ import { useTServicoTipoReadHook } from '@/packages/administrativo/hooks/TServic import TServicoTipoSelectInterface from '@/packages/administrativo/interfaces/TServicoTipo/TServicoTipoSelectInterface'; import GetCapitalize from '@/shared/actions/text/GetCapitalize'; +import TServicoTipoIndexInteface from '../../interfaces/TServicoTipo/TServicoTipoIndexInteface'; + export default function TServicoTipoSelect({ field }: TServicoTipoSelectInterface) { const [open, setOpen] = useState(false); const [isLoading, setIsLoading] = useState(false); @@ -28,9 +30,16 @@ export default function TServicoTipoSelect({ field }: TServicoTipoSelectInterfac * Efeito para buscar os dados apenas uma vez. */ const loadData = useCallback(async () => { + + const TServicoTipoIndex: TServicoTipoIndexInteface = { + urlParams: { + situacao: 'A' + } + } + if (tServicoTipo.length) return; setIsLoading(true); - await fetchTServicoTipo(); + await fetchTServicoTipo(TServicoTipoIndex); setIsLoading(false); }, [tServicoTipo.length, fetchTServicoTipo]); diff --git a/src/packages/administrativo/data/GUsuario/GUsuarioIndexData.ts b/src/packages/administrativo/data/GUsuario/GUsuarioIndexData.ts index 1d0ceba..d5d1b99 100644 --- a/src/packages/administrativo/data/GUsuario/GUsuarioIndexData.ts +++ b/src/packages/administrativo/data/GUsuario/GUsuarioIndexData.ts @@ -3,13 +3,17 @@ import API from '@/shared/services/api/Api'; import { Methods } from '@/shared/services/api/enums/ApiMethodEnum'; -export default async function GUsuarioIndexData() { +import GUsuarioIndexInterface from '../../interfaces/GUsuario/GusuarioIndexInterface'; + +export default async function GUsuarioIndexData(data: GUsuarioIndexInterface) { const api = new API(); const response = await api.send({ method: Methods.GET, - endpoint: `administrativo/g_usuario/`, + endpoint: `administrativo/g_usuario?${new URLSearchParams(data.urlParams).toString()}`, }); + console.log(response) + return response; } diff --git a/src/packages/administrativo/data/TServicoTipo/TServicoTipoIndexData.ts b/src/packages/administrativo/data/TServicoTipo/TServicoTipoIndexData.ts index 7003e6e..3aadff7 100644 --- a/src/packages/administrativo/data/TServicoTipo/TServicoTipoIndexData.ts +++ b/src/packages/administrativo/data/TServicoTipo/TServicoTipoIndexData.ts @@ -1,21 +1,23 @@ // Importa o serviço de API que será utilizado para realizar requisições HTTP -import API from '@/shared/services/api/Api'; // +import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; +import API from '@/shared/services/api/Api'; // Importa o enum que contém os métodos HTTP disponíveis (GET, POST, PUT, DELETE) import { Methods } from '@/shared/services/api/enums/ApiMethodEnum'; // +import TServicoTipoIndexInteface from '../../interfaces/TServicoTipo/TServicoTipoIndexInteface'; + // Importa função que encapsula chamadas assíncronas e trata erros automaticamente -import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; // // Função assíncrona que implementa a lógica de buscar todos os tipos de serviço (GET) -async function executeTServicoTipoIndexData() { +async function executeTServicoTipoIndexData(data: TServicoTipoIndexInteface) { // Instancia o cliente da API para enviar a requisição const api = new API(); // // Executa a requisição para a API com o método apropriado e o endpoint da tabela t_servico_tipo return await api.send({ method: Methods.GET, // GET listar todos os itens - endpoint: `administrativo/t_servico_tipo/`, // Endpoint atualizado + endpoint: `administrativo/t_servico_tipo/?${new URLSearchParams(data.urlParams).toString()}`, }); } diff --git a/src/packages/administrativo/hooks/GUsuario/useGUsuarioIndexHook.ts b/src/packages/administrativo/hooks/GUsuario/useGUsuarioIndexHook.ts index f081677..1cb7b36 100644 --- a/src/packages/administrativo/hooks/GUsuario/useGUsuarioIndexHook.ts +++ b/src/packages/administrativo/hooks/GUsuario/useGUsuarioIndexHook.ts @@ -2,18 +2,21 @@ import { useState } from 'react'; +import Usuario from '@/packages/administrativo/interfaces/GUsuario/GUsuarioInterface'; import { useResponse } from '@/shared/components/response/ResponseContext'; -import Usuario from '../../interfaces/GUsuario/GUsuarioInterface'; +import GUsuarioIndexInterface from '../../interfaces/GUsuario/GusuarioIndexInterface'; import GUsuarioIndex from '../../services/GUsuario/GUsuarioIndex'; + export const useGUsuarioIndexHook = () => { const { setResponse } = useResponse(); const [usuarios, setUsuarios] = useState(null); - const fetchUsuarios = async () => { - const response = await GUsuarioIndex(); + const fetchUsuarios = async (data: GUsuarioIndexInterface) => { + + const response = await GUsuarioIndex(data); setUsuarios(response.data); diff --git a/src/packages/administrativo/hooks/TServicoTipo/useTServicoTipoReadHook.ts b/src/packages/administrativo/hooks/TServicoTipo/useTServicoTipoReadHook.ts index 8c3b1f5..a50af75 100644 --- a/src/packages/administrativo/hooks/TServicoTipo/useTServicoTipoReadHook.ts +++ b/src/packages/administrativo/hooks/TServicoTipo/useTServicoTipoReadHook.ts @@ -1,14 +1,17 @@ -import { useResponse } from '@/shared/components/response/ResponseContext'; // Contexto global para gerenciar respostas da API import { useState } from 'react'; +import { useResponse } from '@/shared/components/response/ResponseContext'; // Contexto global para gerenciar respostas da API + // Serviço que busca a lista de tipos de serviço (TServicoTipoIndexService) +import TServicoTipoInterface from '../../../../app/(protected)/(cadastros)/cadastros/_interfaces/TServicoTipoInterface'; +import TServicoTipoIndexInteface from '../../interfaces/TServicoTipo/TServicoTipoIndexInteface'; import { TServicoTipoIndexService } from '../../services/TServicoTipo/TServicoTipoIndexService'; // Interface tipada do tipo de serviço -import TServicoTipoInterface from '../../../../app/(protected)/(cadastros)/cadastros/_interfaces/TServicoTipoInterface'; // Hook customizado para leitura de dados de tipos de serviço export const useTServicoTipoReadHook = () => { + // Hook do contexto de resposta para feedback global (alertas, mensagens etc.) const { setResponse } = useResponse(); @@ -16,9 +19,9 @@ export const useTServicoTipoReadHook = () => { const [tServicoTipo, setTServicoTipo] = useState([]); // Função assíncrona que busca os dados dos tipos de serviço - const fetchTServicoTipo = async () => { + const fetchTServicoTipo = async (data: TServicoTipoIndexInteface) => { // Chama o serviço responsável por consultar a API - const response = await TServicoTipoIndexService(); + const response = await TServicoTipoIndexService(data); // Atualiza o estado local com os dados retornados setTServicoTipo(response.data); diff --git a/src/packages/administrativo/interfaces/GUsuario/GUsuarioIndexInterface.ts b/src/packages/administrativo/interfaces/GUsuario/GUsuarioIndexInterface.ts new file mode 100644 index 0000000..dabc97d --- /dev/null +++ b/src/packages/administrativo/interfaces/GUsuario/GUsuarioIndexInterface.ts @@ -0,0 +1,3 @@ +export default interface GUsuarioIndexInterface { + urlParams: object +} \ No newline at end of file diff --git a/src/packages/administrativo/interfaces/TServicoTipo/TServicoTipoIndexInteface.ts b/src/packages/administrativo/interfaces/TServicoTipo/TServicoTipoIndexInteface.ts new file mode 100644 index 0000000..ab18dc8 --- /dev/null +++ b/src/packages/administrativo/interfaces/TServicoTipo/TServicoTipoIndexInteface.ts @@ -0,0 +1,3 @@ +export default interface TServicoTipoIndexInteface { + urlParams: object +} \ No newline at end of file diff --git a/src/packages/administrativo/services/GUsuario/GUsuarioIndex.ts b/src/packages/administrativo/services/GUsuario/GUsuarioIndex.ts index ac2d962..bde697b 100644 --- a/src/packages/administrativo/services/GUsuario/GUsuarioIndex.ts +++ b/src/packages/administrativo/services/GUsuario/GUsuarioIndex.ts @@ -1,9 +1,10 @@ 'use server'; import GUsuarioIndexData from '../../data/GUsuario/GUsuarioIndexData'; +import GUsuarioIndexInterface from '../../interfaces/GUsuario/GusuarioIndexInterface'; -export default async function GUsuarioIndex() { - const response = await GUsuarioIndexData(); +export default async function GUsuarioIndex(data: GUsuarioIndexInterface) { + const response = await GUsuarioIndexData(data); return response; } diff --git a/src/packages/administrativo/services/TServicoTipo/TServicoTipoIndexService.ts b/src/packages/administrativo/services/TServicoTipo/TServicoTipoIndexService.ts index cb4860c..ed7dcc8 100644 --- a/src/packages/administrativo/services/TServicoTipo/TServicoTipoIndexService.ts +++ b/src/packages/administrativo/services/TServicoTipo/TServicoTipoIndexService.ts @@ -2,12 +2,13 @@ import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/ // Função que envolve qualquer ação assíncrona para capturar e tratar erros do cliente import { TServicoTipoIndexData } from '../../data/TServicoTipo/TServicoTipoIndexData'; +import TServicoTipoIndexInteface from '../../interfaces/TServicoTipo/TServicoTipoIndexInteface'; // Função que retorna os dados da lista de tipos de serviço (chamada à API ou mock) // Função assíncrona que executa a chamada para buscar os dados dos tipos de serviço -async function executeTServicoTipoIndexService() { +async function executeTServicoTipoIndexService(data: TServicoTipoIndexInteface) { // Chama a função que retorna os dados dos tipos de serviço - const response = await TServicoTipoIndexData(); + const response = await TServicoTipoIndexData(data); // Retorna a resposta para o chamador return response; diff --git a/src/packages/servicos/components/TServicoPedido/TServicoPedidoDetailsPagamento.tsx b/src/packages/servicos/components/TServicoPedido/TServicoPedidoDetailsPagamento.tsx index 077e883..de7f70a 100644 --- a/src/packages/servicos/components/TServicoPedido/TServicoPedidoDetailsPagamento.tsx +++ b/src/packages/servicos/components/TServicoPedido/TServicoPedidoDetailsPagamento.tsx @@ -78,28 +78,6 @@ export default function TServicoPedidoDetailsPagamento({ {FormatMoney(total)} - - -
- Emolumento - {FormatMoney(emolumento)} -
- -
- Tx. Judiciária - {FormatMoney(taxa_judiciaria)} -
- -
- ISS - {FormatMoney(valor_iss)} -
- -
- Fundesp - {FormatMoney(fundesp)} -
- diff --git a/src/shared/components/dataTable/DataTable.tsx b/src/shared/components/dataTable/DataTable.tsx index 68aaa5d..6b82471 100644 --- a/src/shared/components/dataTable/DataTable.tsx +++ b/src/shared/components/dataTable/DataTable.tsx @@ -181,9 +181,8 @@ export function DataTable Rea table.getRowModel().rows.map((row) => { return ( onRowClick?.(row.original)} > {row.getVisibleCells().map((cell) => ( @@ -208,6 +207,7 @@ export function DataTable Rea )} + diff --git a/src/shared/data/fingertech/FingerTechCaptureData.ts b/src/shared/data/fingertech/FingerTechCaptureData.ts index bea8dfd..cc50617 100644 --- a/src/shared/data/fingertech/FingerTechCaptureData.ts +++ b/src/shared/data/fingertech/FingerTechCaptureData.ts @@ -1,5 +1,13 @@ import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; +/********************************************* +* Nome: Capture +* Descrição: Chama o método "Capture" da aplicação desktop, +* responsável por chamar a tela de captura de digital para apenas um único dedo. +* Este método é recomendável quando você deseja capturar a impressão digital de um único dedo e +* não existe a necessidade de identificar qual dedo da mão esta digital pertence. +* Retorno: Template (String) ou Null +*********************************************/ async function executeFingerTechCaptureData() { const response = await fetch(`http://localhost:9000/api/public/v1/captura/Capturar/1`, diff --git a/src/shared/data/fingertech/FingerTechEnrollData.ts b/src/shared/data/fingertech/FingerTechEnrollData.ts new file mode 100644 index 0000000..c54361d --- /dev/null +++ b/src/shared/data/fingertech/FingerTechEnrollData.ts @@ -0,0 +1,25 @@ +import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; + +/********************************************* +* Nome: Enroll +* Descrição: Chama o método "Enroll" da aplicação desktop, +* responsável por chamar a tela de captura de impressão digital para mais de um dedo. +* Este método é recomendável quando você deseja capturar a impressão digital de mais de um dedo e +* quando é necessário identificar a qual dedo esta digital pertence. +* Quando houver a captura de mais de uma impressão digital, elas serão armazenadas de maneira +* codificada no mesmo "Template" (String), mas durante a comparação qualquer dedo poderá ser +* comparado. +* Retorno: Template (String) ou "" (Vazio) +*********************************************/ +async function executeFingerTechEnrollData() { + + const response = await fetch(`http://localhost:9000/api/public/v1/captura/Enroll/1`, + { + method: 'GET' + }, + ); + + return await response.text() +} + +export const FingerTechEnrollData = withClientErrorHandler(executeFingerTechEnrollData); diff --git a/src/shared/data/fingertech/FingerTechMatchData.ts b/src/shared/data/fingertech/FingerTechMatchData.ts new file mode 100644 index 0000000..0450850 --- /dev/null +++ b/src/shared/data/fingertech/FingerTechMatchData.ts @@ -0,0 +1,23 @@ +import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; + +/********************************************* +* Nome: Match +* Descrição: Chama o método "VerifyMatch" da aplicação desktop, +* responsável por chamar a tela de captura de digital para apenas um único dedo e realizar a +* comparação com um outro template (impressão digital) já cadastrada. +* Este método é recomendável quando você deseja você comparação de 1:1 (Um para Um). +* Retorno: Template (String) ou Null +*********************************************/ +async function executeFingerTechMatchData() { + + // 'http://localhost:9000/api/public/v1/captura/Comparar?Digital=' + digital, + const response = await fetch(`http://localhost:9000/api/public/v1/captura/Capturar/1`, + { + method: 'GET' + }, + ); + + return await response.text() +} + +export const FingerTechMatchData = withClientErrorHandler(executeFingerTechMatchData); diff --git a/src/shared/hooks/FingerTech/useFingerTechIndexHook.ts b/src/shared/hooks/FingerTech/useFingerTechCaptureHook.ts similarity index 90% rename from src/shared/hooks/FingerTech/useFingerTechIndexHook.ts rename to src/shared/hooks/FingerTech/useFingerTechCaptureHook.ts index 2674bca..956f504 100644 --- a/src/shared/hooks/FingerTech/useFingerTechIndexHook.ts +++ b/src/shared/hooks/FingerTech/useFingerTechCaptureHook.ts @@ -4,7 +4,7 @@ import { useState } from 'react'; import { FingerTechCaptureService } from '@/shared/services/FingerTech/FingerTechCaptureService'; -export const useFingerTechIndexHook = () => { +export const useFingerTechCaptureHook = () => { const [base64, setBase64] = useState(''); diff --git a/src/shared/hooks/FingerTech/useFingerTechEnrollHook.ts b/src/shared/hooks/FingerTech/useFingerTechEnrollHook.ts new file mode 100644 index 0000000..74afb2e --- /dev/null +++ b/src/shared/hooks/FingerTech/useFingerTechEnrollHook.ts @@ -0,0 +1,25 @@ +'use client'; + +import { useState } from 'react'; + +import { FingerTechEnrollService } from '@/shared/services/FingerTech/FingerTechEnrollService'; + +export const useFingerTechEnrollHook = () => { + + const [base64, setBase64] = useState(''); + + const enrollFingerTech = async () => { + + const response = await FingerTechEnrollService(); + + setBase64(response); + + return response + + }; + + return { + base64, + enrollFingerTech, + }; +}; diff --git a/src/shared/hooks/FingerTech/useFingerTechMatchHook.ts b/src/shared/hooks/FingerTech/useFingerTechMatchHook.ts new file mode 100644 index 0000000..85734e1 --- /dev/null +++ b/src/shared/hooks/FingerTech/useFingerTechMatchHook.ts @@ -0,0 +1,25 @@ +'use client'; + +import { useState } from 'react'; + +import { FingerTechMatchService } from '@/shared/services/FingerTech/FingerTechMatchService'; + +export const useFingerTechMatchHook = () => { + + const [base64, setBase64] = useState(''); + + const matchFingerTech = async () => { + + const response = await FingerTechMatchService(); + + setBase64(response); + + return response + + }; + + return { + base64, + matchFingerTech, + }; +}; diff --git a/src/shared/services/FingerTech/FingerTechEnrollService.ts b/src/shared/services/FingerTech/FingerTechEnrollService.ts new file mode 100644 index 0000000..7316166 --- /dev/null +++ b/src/shared/services/FingerTech/FingerTechEnrollService.ts @@ -0,0 +1,9 @@ +import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; +import { FingerTechEnrollData } from '@/shared/data/fingertech/FingerTechEnrollData'; + +export default async function executeFingerTechCEnrollService() { + const response = await FingerTechEnrollData(); + return response; +} + +export const FingerTechEnrollService = withClientErrorHandler(executeFingerTechCEnrollService); diff --git a/src/shared/services/FingerTech/FingerTechMatchService.ts b/src/shared/services/FingerTech/FingerTechMatchService.ts new file mode 100644 index 0000000..b52ddc7 --- /dev/null +++ b/src/shared/services/FingerTech/FingerTechMatchService.ts @@ -0,0 +1,9 @@ +import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler'; +import { FingerTechMatchData } from '@/shared/data/fingertech/FingerTechMatchData'; + +export default async function executeFingerTechMatchService() { + const response = await FingerTechMatchData(); + return response; +} + +export const FingerTechMatchService = withClientErrorHandler(executeFingerTechMatchService);