From 7cc601ef180b8e580c87f07a4b9e3df9aec1eb6d Mon Sep 17 00:00:00 2001 From: david Date: Sun, 5 Apr 2026 17:25:38 +0200 Subject: [PATCH] . --- .../shared/adapters/list-proformas.adapter.ts | 6 +++--- .../proformas/shared/entities/proforma-list.entity.ts | 6 +++--- .../proformas/shared/hooks/proforma-cache-strategy.ts | 2 +- .../list/ui/blocks/customers-grid/customers-grid.tsx | 2 +- .../src/web/shared/adapters/list-customers.adapter.ts | 6 +++--- .../src/web/shared/entities/customer-list.entity.ts | 6 +++--- .../src/web/shared/hooks/customer-cache-strategy.ts | 2 +- .../src/web/shared/adapters/list-suppliers.adapter.ts | 6 +++--- .../src/web/shared/entities/supplier-list.entity.ts | 11 ++++++++--- .../src/web/shared/hooks/supplier-cache-strategy.ts | 2 +- 10 files changed, 27 insertions(+), 22 deletions(-) diff --git a/modules/customer-invoices/src/web/proformas/shared/adapters/list-proformas.adapter.ts b/modules/customer-invoices/src/web/proformas/shared/adapters/list-proformas.adapter.ts index 92913d2a..f7367269 100644 --- a/modules/customer-invoices/src/web/proformas/shared/adapters/list-proformas.adapter.ts +++ b/modules/customer-invoices/src/web/proformas/shared/adapters/list-proformas.adapter.ts @@ -8,9 +8,9 @@ export const ListProformasAdapter = { return { items: dto.items.map(ProformaListRowAdapter.fromDto), page: dto.page, - per_page: dto.per_page, - total_pages: dto.total_pages, - total_items: dto.total_items, + perPage: dto.per_page, + totalPages: dto.total_pages, + totalItems: dto.total_items, }; }, }; diff --git a/modules/customer-invoices/src/web/proformas/shared/entities/proforma-list.entity.ts b/modules/customer-invoices/src/web/proformas/shared/entities/proforma-list.entity.ts index 9eed4d38..ecaf64ef 100644 --- a/modules/customer-invoices/src/web/proformas/shared/entities/proforma-list.entity.ts +++ b/modules/customer-invoices/src/web/proformas/shared/entities/proforma-list.entity.ts @@ -7,8 +7,8 @@ import type { ProformaListRow } from "./proforma-list-row.entity"; export interface ProformaList { items: ProformaListRow[]; - total_pages: number; - total_items: number; + totalPages: number; + totalItems: number; page: number; - per_page: number; + perPage: number; } diff --git a/modules/customer-invoices/src/web/proformas/shared/hooks/proforma-cache-strategy.ts b/modules/customer-invoices/src/web/proformas/shared/hooks/proforma-cache-strategy.ts index d9f19a4b..8339eb9a 100644 --- a/modules/customer-invoices/src/web/proformas/shared/hooks/proforma-cache-strategy.ts +++ b/modules/customer-invoices/src/web/proformas/shared/hooks/proforma-cache-strategy.ts @@ -103,7 +103,7 @@ export function removeProformaFromListCaches( queryClient.setQueryData(key, { ...page, items: page.items.filter((row) => row.id !== proformaId), - total_items: Math.max(0, page.total_items - 1), + totalItems: Math.max(0, page.totalItems - 1), }); } diff --git a/modules/customers/src/web/list/ui/blocks/customers-grid/customers-grid.tsx b/modules/customers/src/web/list/ui/blocks/customers-grid/customers-grid.tsx index c3e98fc4..ba2ca8f2 100644 --- a/modules/customers/src/web/list/ui/blocks/customers-grid/customers-grid.tsx +++ b/modules/customers/src/web/list/ui/blocks/customers-grid/customers-grid.tsx @@ -31,7 +31,7 @@ export const CustomersGrid = ({ }: CustomersGridProps) => { const navigate = useNavigate(); const { t } = useTranslation(); - const { items, total_items } = data || { items: [], total_items: 0 }; + const { items, totalItems: total_items } = data || { items: [], totalItems: 0 }; if (loading) return ( diff --git a/modules/customers/src/web/shared/adapters/list-customers.adapter.ts b/modules/customers/src/web/shared/adapters/list-customers.adapter.ts index 4ecf0eed..83451a13 100644 --- a/modules/customers/src/web/shared/adapters/list-customers.adapter.ts +++ b/modules/customers/src/web/shared/adapters/list-customers.adapter.ts @@ -17,9 +17,9 @@ export const ListCustomersAdapter = { fromDTO(pageDto: ListCustomersResult, context?: unknown): CustomerList { return { page: pageDto.page, - per_page: pageDto.per_page, - total_pages: pageDto.total_pages, - total_items: pageDto.total_items, + perPage: pageDto.per_page, + totalPages: pageDto.total_pages, + totalItems: pageDto.total_items, items: pageDto.items.map((row) => ListCustomersRowAdapter.fromDTO(row, context)), }; }, diff --git a/modules/customers/src/web/shared/entities/customer-list.entity.ts b/modules/customers/src/web/shared/entities/customer-list.entity.ts index 154756c4..633f0694 100644 --- a/modules/customers/src/web/shared/entities/customer-list.entity.ts +++ b/modules/customers/src/web/shared/entities/customer-list.entity.ts @@ -7,8 +7,8 @@ import type { CustomerListRow } from "./customer-list-row.entity"; export interface CustomerList { items: CustomerListRow[]; - total_pages: number; - total_items: number; + totalPages: number; + totalItems: number; page: number; - per_page: number; + perPage: number; } diff --git a/modules/customers/src/web/shared/hooks/customer-cache-strategy.ts b/modules/customers/src/web/shared/hooks/customer-cache-strategy.ts index f23f7ac5..c5cbe919 100644 --- a/modules/customers/src/web/shared/hooks/customer-cache-strategy.ts +++ b/modules/customers/src/web/shared/hooks/customer-cache-strategy.ts @@ -103,7 +103,7 @@ export function removeCustomerFromListCaches( queryClient.setQueryData(key, { ...page, items: page.items.filter((row) => row.id !== customerId), - total_items: Math.max(0, page.total_items - 1), + totalItems: Math.max(0, page.totalItems - 1), }); } diff --git a/modules/supplier/src/web/shared/adapters/list-suppliers.adapter.ts b/modules/supplier/src/web/shared/adapters/list-suppliers.adapter.ts index ba15b5ec..490293cf 100644 --- a/modules/supplier/src/web/shared/adapters/list-suppliers.adapter.ts +++ b/modules/supplier/src/web/shared/adapters/list-suppliers.adapter.ts @@ -7,9 +7,9 @@ export const ListSuppliersAdapter = { fromDTO(pageDto: ListSuppliersResponseDTO): SupplierList { return { page: pageDto.page, - per_page: pageDto.per_page, - total_pages: pageDto.total_pages, - total_items: pageDto.total_items, + perPage: pageDto.per_page, + totalPages: pageDto.total_pages, + totalItems: pageDto.total_items, items: pageDto.items.map(ListSuppliersRowAdapter.fromDTO), }; }, diff --git a/modules/supplier/src/web/shared/entities/supplier-list.entity.ts b/modules/supplier/src/web/shared/entities/supplier-list.entity.ts index dc740a9d..f9c46ac4 100644 --- a/modules/supplier/src/web/shared/entities/supplier-list.entity.ts +++ b/modules/supplier/src/web/shared/entities/supplier-list.entity.ts @@ -1,9 +1,14 @@ import type { SupplierListRow } from "./supplier-list-row.entity"; +/** + * Interface que representa la respuesta paginada de una lista de proveedores, + * adaptada desde la respuesta de la API. + */ + export interface SupplierList { items: SupplierListRow[]; - total_pages: number; - total_items: number; + totalPages: number; + totalItems: number; page: number; - per_page: number; + perPage: number; } diff --git a/modules/supplier/src/web/shared/hooks/supplier-cache-strategy.ts b/modules/supplier/src/web/shared/hooks/supplier-cache-strategy.ts index 772a1e82..e473cb92 100644 --- a/modules/supplier/src/web/shared/hooks/supplier-cache-strategy.ts +++ b/modules/supplier/src/web/shared/hooks/supplier-cache-strategy.ts @@ -97,7 +97,7 @@ export function removeSupplierFromListCaches( queryClient.setQueryData(key, { ...page, items: page.items.filter((row) => row.id !== supplierId), - total_items: Math.max(0, page.total_items - 1), + totalItems: Math.max(0, page.totalItems - 1), }); }