mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 20:42:39 +00:00
fix: Resolve all lint warnings and type errors across frontend and backend.
Frontend: - Memoize pagination object in TransactionsTable to prevent unnecessary re-renders and fix exhaustive-deps warning - Add optional success and message fields to backup API response types for proper error handling Backend: - Add TypedDict for transaction type configuration to improve type safety in generate_sample_db - Fix unpacking of amount_range with explicit float type hints - Add explicit type hints for descriptions dictionary and specific_descriptions variable - Fix sync endpoint return types: get_sync_status returns SyncStatus and sync_now returns SyncResult - Fix transactions endpoint data type declaration to properly support Union types in PaginatedResponse All checks now pass: - Frontend: npm lint and npm build ✓ - Backend: mypy type checking ✓ - Backend: ruff lint on modified files ✓ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Elisiário Couto
parent
966440006a
commit
159cba508e
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
useReactTable,
|
||||
@@ -126,16 +126,20 @@ export default function TransactionsTable() {
|
||||
});
|
||||
|
||||
const transactions = transactionsResponse?.data || [];
|
||||
const pagination = transactionsResponse
|
||||
? {
|
||||
page: transactionsResponse.page,
|
||||
total_pages: transactionsResponse.total_pages,
|
||||
per_page: transactionsResponse.per_page,
|
||||
total: transactionsResponse.total,
|
||||
has_next: transactionsResponse.has_next,
|
||||
has_prev: transactionsResponse.has_prev,
|
||||
}
|
||||
: undefined;
|
||||
const pagination = useMemo(
|
||||
() =>
|
||||
transactionsResponse
|
||||
? {
|
||||
page: transactionsResponse.page,
|
||||
total_pages: transactionsResponse.total_pages,
|
||||
per_page: transactionsResponse.per_page,
|
||||
total: transactionsResponse.total,
|
||||
has_next: transactionsResponse.has_next,
|
||||
has_prev: transactionsResponse.has_prev,
|
||||
}
|
||||
: undefined,
|
||||
[transactionsResponse],
|
||||
);
|
||||
|
||||
// Check if search is currently debouncing
|
||||
const isSearchLoading = filterState.searchTerm !== debouncedSearchTerm;
|
||||
|
||||
@@ -288,11 +288,14 @@ export const apiClient = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
testBackupConnection: async (test: BackupTest): Promise<{ connected?: boolean }> => {
|
||||
const response = await api.post<{ connected?: boolean }>(
|
||||
"/backup/test",
|
||||
test,
|
||||
);
|
||||
testBackupConnection: async (
|
||||
test: BackupTest,
|
||||
): Promise<{ connected?: boolean; success?: boolean; message?: string }> => {
|
||||
const response = await api.post<{
|
||||
connected?: boolean;
|
||||
success?: boolean;
|
||||
message?: string;
|
||||
}>("/backup/test", test);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
@@ -301,11 +304,20 @@ export const apiClient = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
performBackupOperation: async (operation: BackupOperation): Promise<{ operation: string; completed: boolean }> => {
|
||||
const response = await api.post<{ operation: string; completed: boolean }>(
|
||||
"/backup/operation",
|
||||
operation,
|
||||
);
|
||||
performBackupOperation: async (
|
||||
operation: BackupOperation,
|
||||
): Promise<{
|
||||
operation: string;
|
||||
completed: boolean;
|
||||
success?: boolean;
|
||||
message?: string;
|
||||
}> => {
|
||||
const response = await api.post<{
|
||||
operation: string;
|
||||
completed: boolean;
|
||||
success?: boolean;
|
||||
message?: string;
|
||||
}>("/backup/operation", operation);
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user