[MVPTN-88] fix(Build): Ajustes diversos para realizar a build

This commit is contained in:
Keven Willian Pereira de Souza 2025-10-09 16:15:16 -03:00
parent 37f0f8713d
commit cb3f1ffcba
9 changed files with 27 additions and 26 deletions

View file

@ -16,11 +16,12 @@ import Header from '@/shared/components/structure/Header';
import { TImovelIndexInterface } from '../../interfaces/TImovel/TImovelIndexInterface';
import TImovelTable from './TImovelTable';
import TImovelForm from './TImovelForm';
import { TImovelIndexDataInterface } from '../../interfaces/TImovel/TImovelIndexDataInterface';
export default function TImovelIndex({ pageTitle, pageDescription, tipoClasse }: TImovelIndexInterface) {
const TImovelIndexInterface: TImovelIndexInterface = {
tipoClasse: tipoClasse
const TImovelIndexDataInterface: TImovelIndexDataInterface = {
tipo_classe: tipoClasse
}
// Controle de estado do botão
@ -79,7 +80,7 @@ export default function TImovelIndex({ pageTitle, pageDescription, tipoClasse }:
setButtonIsLoading(false);
// Atualiza a lista de dados
indexTImovel(TImovelIndexInterface);
indexTImovel(TImovelIndexDataInterface);
},
[saveTImovel, indexTImovel, handleCloseForm],
);
@ -109,7 +110,7 @@ export default function TImovelIndex({ pageTitle, pageDescription, tipoClasse }:
await deleteTImovel(itemToDelete);
// Atualiza a lista
await indexTImovel(TImovelIndexInterface);
await indexTImovel(TImovelIndexDataInterface);
// Limpa o item selecionado
setItemToDelete(null);
@ -122,7 +123,7 @@ export default function TImovelIndex({ pageTitle, pageDescription, tipoClasse }:
* Busca inicial dos dados
*/
useEffect(() => {
indexTImovel(TImovelIndexInterface);
indexTImovel(TImovelIndexDataInterface);
}, []);
/**

View file

@ -51,8 +51,6 @@ export default function TImovelUnidadeRuralIndex({ imovel_id }: TImovelUnidadePa
* Abre o formulário no modo de edição ou criação
*/
const handleOpenForm = useCallback((data: TImovelUnidadeRuralInterface | null) => {
// Se não houver dados (criação), cria um objeto inicial com imovel_id
const initialData: TImovelUnidadeRuralInterface = data ?? { imovel_id } as TImovelUnidadeRuralInterface;
setSelectedData(data);
setIsFormOpen(true);
}, []);

View file

@ -2,17 +2,14 @@ import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/
import API from "@/shared/services/api/Api";
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
import ApiResponseInterface from "@/shared/services/api/interfaces/ApiResponseInterface";
import { TImovelIndexInterface } from "../../interfaces/TImovel/TImovelIndexInterface";
async function executeTImovelIndexData(data: TImovelIndexInterface): Promise<ApiResponseInterface> {
import { TImovelIndexDataInterface } from "../../interfaces/TImovel/TImovelIndexDataInterface";
async function executeTImovelIndexData(data: TImovelIndexDataInterface): Promise<ApiResponseInterface> {
const api = new API();
return api.send({
method: Methods.GET,
endpoint: `administrativo/t_imovel/classe/${data.tipoClasse}`
endpoint: `administrativo/t_imovel/classe/${data.tipo_classe}`
});
}
export const TImovelIndexData = withClientErrorHandler(executeTImovelIndexData);

View file

@ -3,16 +3,16 @@
import { useResponse } from '@/shared/components/response/ResponseContext';
import { useState } from 'react';
import TImovelInterface from '../../interfaces/TImovel/TImovelInterface';
import { TImovelIndexData } from '../../data/TImovel/TImovelIndexData';
import { TImovelIndexInterface } from '../../interfaces/TImovel/TImovelIndexInterface';
import { TImovelIndexDataInterface } from '../../interfaces/TImovel/TImovelIndexDataInterface';
import { TImovelIndexService } from '../../services/TImovel/TImovelIndexService';
export const useTImovelIndexHook = () => {
const { setResponse } = useResponse();
const [tImovel, setTImovel] = useState<TImovelInterface[]>([]);
const indexTImovel = async (data: TImovelIndexInterface) => {
const response = await TImovelIndexData(data);
const indexTImovel = async (data: TImovelIndexDataInterface) => {
const response = await TImovelIndexService(data);
// Armazena os dados consultados
setTImovel(response.data);
// Define os dados do componente de resposta (toast, modal, etc)

View file

@ -0,0 +1,3 @@
export interface TImovelIndexDataInterface {
tipo_classe: number,
}

View file

@ -1,5 +1,5 @@
export interface TImovelIndexInterface {
pageTitle?: string,
pageDescription?: string,
tipoClasse?: number
pageTitle: string,
pageDescription: string,
tipoClasse: number
}

View file

@ -1,10 +1,11 @@
import { SituacoesEnum } from "@/shared/enums/SituacoesEnum";
import TImovelUnidadeInterface from "../TImovelUnidadeInterface";
export interface TImovelUnidadeRuralInterface extends TImovelUnidadeInterface {
galpao?: string;
nao_se_aplica?: boolean;
reserva_florestal?: boolean;
geo_referenciamento?: boolean;
reserva_florestal?: SituacoesEnum;
geo_referenciamento?: SituacoesEnum;
nome_identificacao?: string;
ccir?: string;
denominacao?: string;

View file

@ -5,8 +5,8 @@ import { SituacoesEnum } from "@/shared/enums/SituacoesEnum";
export const TImovelUnidadeRuralSchema = TImovelUnidadeSchema.extend({
galpao: z.string().optional(),
nao_se_aplica: z.boolean().optional(),
reserva_florestal: z.enum(SituacoesEnum),
geo_referenciamento: z.enum(SituacoesEnum),
reserva_florestal: z.enum(SituacoesEnum).optional(),
geo_referenciamento: z.enum(SituacoesEnum).optional(),
nome_identificacao: z.string().optional(),
ccir: z.string().optional(),
denominacao: z.string().optional(),

View file

@ -1,8 +1,9 @@
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
import { TImovelIndexData } from '../../data/TImovel/TImovelIndexData';
import { TImovelIndexDataInterface } from '../../interfaces/TImovel/TImovelIndexDataInterface';
export default async function executeTImovelIndexService() {
const response = await TImovelIndexData();
export default async function executeTImovelIndexService(data: TImovelIndexDataInterface) {
const response = await TImovelIndexData(data);
return response;
}