Skip to content

Developer#64

Merged
keven-rdr merged 63 commits into
mainfrom
developer
Jun 11, 2026
Merged

Developer#64
keven-rdr merged 63 commits into
mainfrom
developer

Conversation

@keven-rdr

Copy link
Copy Markdown
Collaborator
  • adicionando a pipeline do CD

Update Supabase client config to use NEXT_PUBLIC_API_URL as an additional fallback for the project URL. Refactor the auth callback route to use a dedicated origin variable, and add comments to clarify proper redirect behavior for hosted platforms like Vercel to avoid localhost redirects in production.
rewrite the auth redirect logic to properly handle local and production environments
only use the configured environment redirect URL when it matches the current environment,
fall back to the current window origin's callback path when appropriate,
and update comments to document the new logic flow
remove unused NEXT_PUBLIC_API_URL fallback from Supabase client setup
update redirect to use URL constructor to avoid proxy-related issues, add explanatory comment
In src/proxy.ts:
- replace supabase.auth.getSession() with getUser() for more reliable middleware auth checks
- forward all request cookies during auth redirects to preserve session state

In src/presentation/hooks/use-auth.ts:
- simplify overly complex auth redirect URL logic
- ensure absolute redirect URLs to comply with Supabase OAuth requirements
strip trailing slashes from base redirect URLs to prevent path duplication, add missing /auth/callback path when the environment variable doesn't include it, and comply with Supabase OAuth URL requirements
create separate enum files for TransactionType and RepeatFrequency, delete the combined value-objects file, and update imports in category and transaction entities
set default values for optional transaction fields, add validation for amount, currency and repeat settings, and expose typed getters for all properties
convert transaction-type and repeat-frequency to proper TS enums, then remove the obsolete Transaction interface file
add TransactionMapper to handle conversion between domain and persistence models
update repository interface with fixed imports and simplified method signatures
implement getTransactionById for fetching single transaction by ID
refactor create, update and list methods to use the mapper for data handling
remove outdated Portuguese comment from the interface file
replace legacy procedural handler with class-based use case implementation
add CreateTransactionDto and ICreateTransactionUseCase interface for type safety
update unit tests to match new structure, remove old handler and test files
use domain Transaction entity for validation and depend on abstract repository interface
create IDeleteTransactionUseCase interface to define the use contract
refactor the standalone handler function into a class-based use case with dependency injection
add authentication, transaction existence, and ownership checks to fix security gaps and prevent deleting non-existent or unauthorized transactions
update both transaction-related hooks to use dependency-injected use case classes instead of direct handler imports, align with clean architecture principles, and adjust input types for create transaction operations.
add type-safe EditTransactionDto for standardized input
create IEditTransactionUseCase interface to define use case contract
implement class-based EditTransactionUseCase with repository dependency injection
add validation checks for authenticated session, transaction existence and user ownership
use domain Transaction entity's update method to enforce business rules
replace legacy handler file with new clean architecture implementation
Inject the transaction repository into the use case, use EditTransactionDto as the input type, update the hook to call the use case's edit method instead of the direct handler, and improve code decoupling while aligning with the application's hexagonal architecture pattern.
correct import paths for Transaction entity in use-transactions hook and dashboard page, add non-null assertion on selectedTransaction.id to resolve TypeScript type warning
update associated error message and mapper call to clarify the method's purpose of rehydrating existing transaction entities from persistence
export IDeleteTransactionUseCase interface for proper implementation
replace old handler tests with use case unit tests for delete and edit transactions
update create transaction test to use modern mocking practices
add coverage for auth checks, ownership validation and successful operations
remove deprecated handler test files
add IAuthService interface with getCurrentUser and getAuthenticatedUser methods
implement the interface with SupabaseAuthService using supabase client
add clearCache method to reset cached user data
export a singleton instance of the auth service
Extract all Supabase Auth session validation logic into a dedicated `authService` to centralize auth checks across the codebase. Update all transaction-related use cases (create, edit, delete) to accept the auth service as a constructor dependency, refactor presentation hooks and query handlers to use the centralized auth service instead of direct Supabase imports. Standardize entity field naming by renaming `is_paid` to `isPaid` in the list transactions handler and associated tests, and overhaul all related test suites to match the new dependency injection pattern.
Add authentication use cases: login with Google and logout, with corresponding unit tests
Implement create, edit, and delete transaction use cases including their interfaces, DTOs, and full test suites
Update all presentation hooks to use the correct usecase import paths (migrated from commands directory)
Fix list transactions handler to use TransactionType enum instead of hardcoded string literals
…cases

- migrate auth logic from legacy repository handlers to clean use case pattern with IAuthService
- replace old auth handlers with LoginUseCase and LogoutUseCase implementations
- add complete transaction CRUD use cases (create, delete, edit, fetch)
- update all presentation hooks to use the new use cases
- add unit tests for all new use cases and auth services
- remove deprecated auth handler files, tests, and IAuthRepository interface
- implement new logout page with loading state
- Move IAuthService interface from application/services to infrastructure/services, update all relevant imports across use cases, tests and auth implementation
- Add reusable MonthYear and TransactionSummary value objects with accompanying unit tests
- Refactor legacy listTransactions handler into proper clean architecture GetTransactionsUseCase
- Update presentation hook to use the new use case instead of the deprecated handler
- Fix import paths for all transaction-related use case tests
- Remove deprecated handler file and its associated test suite
Restructure the presentation hooks directory to group related hooks by feature:
- Move auth-related hooks to `/src/presentation/hooks/auth/`
- Organize transaction hooks into nested subdirectories under `/src/presentation/hooks/transaction/` for each CRUD operation
- Update all imports across the entire codebase to match the new hook paths
- Add comprehensive unit tests for all restructured and newly created hooks

This change improves code maintainability and makes it easier to discover related hooks while preserving all existing application functionality.
- Migrate Supabase client and all repository imports to the standardized /src/infrastructure/repositories/supabase directory
- Update all existing service, hook, and test imports to use the new file paths
- Replace legacy single-file Category interface with proper domain entity, props interface, and CategoryType enum
- Add CategoryMapper to handle domain-persistence layer conversion
- Implement full CRUD TransactionRepository with test coverage
- Add initial category repository structure
- Remove unused TransactionType import from TransactionMapper
- Clean up and remove deprecated single-file Category entity
Replace unsafe `as any` type casts with proper typed assertions across all test files
Update category and transaction mapper return types to use `Record<string, unknown>` instead of `any`
Add missing imports for DTOs, Transaction entity, and Supabase User type
Remove unused Transaction import in get-transaction use case
Memoize the use case instance in useTransactions hook and fix the effect's dependency array
update all mock module import paths to match the actual project directory structure, resolving broken test imports
- replace all hardcoded "INCOME"/"EXPENSE" string literals with TransactionType enum across dashboard, transaction form, and use cases
- refactor DTO imports for create and edit transaction use cases to import from ./dto
- fix transaction form initial data typing and field mapping for edit transactions
- clean up entity imports in the transaction form component
add readonly modifier to all private constructor-injected dependencies in use case classes to enforce immutability and remove redundant manual field assignments
fix SSR-compatible origin URL calculation in the use-auth hook by referencing globalThis.window
keven.rodrigues and others added 21 commits May 29, 2026 14:20
## Alterações realizadas

- Movida a abstração de autenticação para
`src/application/ports/iauth.service.ts`.
- Removida a dependência dos casos de uso em `IAuthService` dentro de
`infrastructure`.
- Criado o tipo `AuthenticatedUser`, evitando que a aplicação dependa
diretamente do tipo `User` do Supabase.
- Mantida a implementação concreta `SupabaseAuthService` na camada de
infraestrutura.
- Criado o Value Object `Amount` para validar valores monetários
positivos e finitos.
- Fortalecida a entidade `Transaction` com validações de domínio:
  - valor maior que zero;
  - usuário obrigatório;
  - moeda obrigatória;
  - data válida;
  - tipo de transação válido;
  - recorrência com frequência e quantidade obrigatórias.
- Transformada `Account` de interface simples para entidade de domínio
com `create`, `restore`, getters e validações.
- Fortalecida `Category` com validação de tipo e `created_at` opcional
para permitir criação antes da persistência.
- Criados contratos de repositório para `Account` e `Category`:
  - `IAccountRepository`;
  - `ICategoryRepository`.
- Criada implementação Supabase para `AccountRepository`.
- Implementada a estrutura de `CategoryRepository`, que antes estava
vazia.
- Criado `AccountMapper` para conversão entre domínio e persistência.
- Atualizados testes dos casos de uso para dependerem da nova porta de
autenticação.
- Adicionados testes de domínio para:
  - `Amount`;
  - `Transaction`;
  - `Account`;
  - `Category`.
- Adicionado o arquivo `MELHORIAS_DDD.md` documentando as melhorias
aplicadas e os pontos que seguem como evolução futura.
Add full category CRUD functionality including:
- Domain layer use cases, DTOs and interface contracts
- Frontend React hooks, dashboard page and category form component
- Update sidebar navigation with categories link
- Add `update` method to Category domain entity
- Fix dashboard main content padding
- Add comprehensive unit tests for all use cases and hooks
- Add DDD implementation report document
…alidation

Refactored CategoryType enum to avoid duplicate definitions by re-exporting from TransactionType. Added category validation logic for create and edit transaction use cases, which checks that the provided category exists, belongs to the authenticated user, and matches the transaction's type. Added comprehensive tests for the new validation rules. Added a category dropdown selector to the transaction form, filtered to show only categories matching the current transaction type. Updated transaction hooks and use case constructors to accept the category repository dependency. Fixed the categories page to use the typed CategoryType enum instead of hardcoded strings, and updated the dashboard form to include category ID in submission payloads.
Implement account CRUD use cases with authentication and ownership validation, add account entity update method and DTOs, build presentation hooks and UI components, add comprehensive tests, and update transaction use cases to validate account existence and ownership.
- add account name and category name getters to Transaction entity
- update Supabase transaction repo to fetch account data alongside category
- add account selection field to transaction form component
- add account validation logic to create and edit transaction use cases
- add unit tests for account validation flows
Remove redundant TransactionWithCategory custom type, add helper function for formatting transaction subtitles with category and account, update TransactionCard props to use the helper, and fix missing accountId in edit transaction submission.
…ields

- Replace TransactionType enum imports in create/edit transaction DTOs with inline "EXPENSE" | "INCOME" union types
- Make category_id and account_id required fields in both transaction DTOs, adding trim validation for non-empty values
- Update create/edit transaction use cases to properly convert input type to TransactionType enum for internal use
- Refactor dashboard page and transaction form components to use literal type strings instead of the imported enum
- Improve transaction form select inputs with better loading and empty states, and add required validation
- Update all related test files to match the new type definitions and validation logic
- add two new methods to ITransactionRepository: hasTransactionsWithCategoryId and hasTransactionsWithAccountId
- implement the new repository methods in the Supabase transaction repository
- update delete account and category use cases to block deletion when linked transactions exist
- update associated React hooks to pass the transaction repository to the use cases
- add unit tests to validate the new deletion prevention logic
- Adicionando pipeline para realizar o CD no google cloud
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots
5.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
72.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@LCapistrano25 LCapistrano25 requested review from LCapistrano25 and joao-fcosta and removed request for joao-fcosta June 11, 2026 12:00
@keven-rdr keven-rdr merged commit fca991f into main Jun 11, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants