Skip to content

Feat: implement note module - #36

Merged
MathCunha16 merged 5 commits into
feature/backend/refactor-to-golangfrom
feature/go-notes
Aug 9, 2026
Merged

Feat: implement note module#36
MathCunha16 merged 5 commits into
feature/backend/refactor-to-golangfrom
feature/go-notes

Conversation

@MathCunha16

@MathCunha16 MathCunha16 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

This Pull Request implements full Notes management functionality for the devaulty-backend Go service, following Hexagonal Architecture, centralized DTOs, polymorphic tag integration, REST handlers, comprehensive Unit and Integration Test coverage, and OpenAPI 3.0 documentation.


✨ Key Features

🏗️ 1. DTO Centralization (internal/dto/note_dto.go)

Added the following Note DTOs:

  • CreateNoteCommand

    • Validates title as required with 2–255 characters.
    • Validates content as required.
  • UpdateNoteCommand

    • Supports partial updates for title and content.
  • NoteView

    • Full response DTO containing:
      • id
      • projectId
      • title
      • content
      • archived
      • tags: []TagSummary
      • createdAt
      • updatedAt
  • NoteSummary

    • Lightweight response DTO used in paginated list responses.

⚙️ 2. Domain & Persistence

Domain Model (internal/domain/model)

Added model.Note containing:

  • id
  • project_id
  • title
  • content (*string)
  • archived (bool)
  • BaseEntity

Repository (internal/domain/port, internal/adapter/out/persistence)

Implemented NoteRepositoryAdapter with:

  • SQLite CRUD operations
  • Pagination using PaginateExec
  • Transaction safety

🧠 3. Use Case Business Logic (internal/usecase/note_usecase.go)

Create

  • Validates project existence.
  • Persists the new note.
  • Returns NoteView.

GetByID

  • Fetches the note by ID.
  • Batch-loads attached tags using itemTagRepo.FindTagsForItem.
  • Returns NoteView.

GetAllByProjectID

  • Retrieves paginated notes.
  • Batch-loads tags for all notes using itemTagRepo.FindTagsForItems.
  • Uses a single SQL query to avoid N+1 query performance issues.

Update

  • Supports partial updates to title and content.
  • Updates the updatedAt timestamp.
  • Re-attaches tags to the response.

Delete

  • Removes the note from persistence.
  • Cleans up associated item_tags entries using RemoveAllTagsFromItem.

🏷️ 4. ItemTag Polymorphic Integration

Updated internal/usecase/item_tag_usecase.go to register NoteRepository under:

model.ItemTypeNote

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Novos recursos**
  - Adicionada uma API completa para notas por projeto: criar, listar com paginação, consultar, atualizar e excluir.
  - Notas agora aceitam títulos, conteúdo, tags e informações de arquivamento.
  - Incluído suporte a autenticação, validações e respostas de erro padronizadas.
  - Notas podem utilizar operações de tags.

- **Testes**
  - Adicionados testes de integração e de regras de negócio para os principais fluxos de notas, incluindo erros e permissões.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

…ory updates

- Update `NoteRepository` with project-scoped methods:
  - `FindByIDAndProjectID`
  - `DeleteByIDAndProjectID`
- Introduce `NoteUseCase` for CRUD operations on notes, ensuring project context.
- Add DTOs (`CreateNoteCommand`, `NoteView`, `NoteSummary`) for note-related operations.
- Update `ItemTagUseCase` to support `ItemTypeNote`.
@MathCunha16 MathCunha16 self-assigned this Aug 7, 2026
@MathCunha16 MathCunha16 added documentation Improvements or additions to documentation enhancement New feature or request Backend Backend feature or modification labels Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e3590b20-98c8-4623-ab04-78baf02559fd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A API passa a oferecer CRUD de notas por projeto. A mudança inclui DTOs, casos de uso, persistência com escopo de projeto, tags, handlers HTTP, rotas autenticadas, documentação OpenAPI e testes de integração.

Changes

CRUD de notas

Layer / File(s) Summary
Contratos e persistência
backend-go/internal/dto/note_dto.go, backend-go/internal/domain/port/note_repository.go, backend-go/internal/adapter/out/persistence/note_repository.go, backend-go/docs/openapi.yaml
Adiciona comandos e respostas para notas. O repositório restringe consulta e exclusão por project_id. A especificação OpenAPI define os schemas e o enum ItemType.NOTE.
Casos de uso e tags
backend-go/internal/usecase/note_usecase.go, backend-go/internal/usecase/item_tag_usecase.go, backend-go/internal/usecase/*_test.go
Implementa criação, consulta, listagem paginada, atualização e exclusão. O fluxo carrega e remove tags. O ItemTagUseCase registra o repositório de notas.
Exposição HTTP
backend-go/internal/adapter/in/web/handler/note_handler.go, backend-go/internal/adapter/in/web/router.go, backend-go/cmd/api/main.go, backend-go/docs/openapi.yaml
Adiciona os endpoints autenticados de notas. O handler valida UUIDs, JSON e paginação, mapeia erros HTTP, define Location na criação e retorna 204 na exclusão.
Validação dos fluxos
backend-go/internal/adapter/in/web/handler/note_handler_test.go, backend-go/internal/usecase/note_usecase_test.go
Testa criação, consulta, listagem, atualização e exclusão, incluindo autenticação, validações, recursos inexistentes e erros de persistência.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Cliente
  participant NoteHandler
  participant NoteUseCase
  participant NoteRepository
  Cliente->>NoteHandler: envia requisição autenticada
  NoteHandler->>NoteUseCase: valida e encaminha comando
  NoteUseCase->>NoteRepository: executa operação por projeto
  NoteRepository-->>NoteUseCase: retorna dados ou resultado
  NoteUseCase-->>NoteHandler: retorna DTO ou erro
  NoteHandler-->>Cliente: retorna resposta HTTP
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título descreve de forma clara e concisa a implementação do módulo completo de notas, que é o objetivo principal do pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

…tions, add associated tests

- Implement `NoteUseCase.Update` and `NoteUseCase.Delete` methods.
- Update `NoteUseCase.GetByID` to improve error handling and tag retrieval.
- Integrate `NoteRepository` into `ItemTagUseCase`.
- Add mock repository for notes in tests.
- Adjust `NoteView` and `NoteSummary` DTO fields for consistency.
- Add unit tests for note use cases.
…perations

- Implement `NoteHandler` for handling notes within project context.
- Add router mappings and integrate `NoteHandler` into the API.
- Update test helpers and add extensive tests for note routes and handler logic.
- Document CRUD operations for notes: create, read (single and paginated), update, and delete.
- Add schemas for `Note`, `NoteSummary`, `NoteSummaryPage`, `CreateNoteCommand`, and `UpdateNoteCommand`.
- Extend `ItemType` enum with `NOTE`.
- Define paths for `/projects/{project_id}/notes` and `/projects/{project_id}/notes/{note_id}`.
@MathCunha16
MathCunha16 marked this pull request as ready for review August 9, 2026 21:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
backend-go/internal/usecase/item_tag_usecase_test.go (1)

108-117: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Retorne também o mockNoteRepo do setup.

SetupItemTagUseCaseTest cria o mockNoteRepo, mas não o devolve. Os testes não conseguem configurar expectativas para model.ItemTypeNote, portanto o novo caminho de despacho fica sem cobertura. Inclua o mock no retorno.

♻️ Correção proposta
 func SetupItemTagUseCaseTest() (
 	*MockItemTagRepository,
 	*MockTagRepository,
 	*MockProjectRepository,
 	*MockSnippetRepository,
 	*MockLinkRepository,
 	*MockProblemRepository,
+	*MockNoteRepository,
 	*usecase.ItemTagUseCase,
 ) {
@@
-	return mockItemTagRepo, mockTagRepo, mockProjectRepo, mockSnippetRepo, mockLinkRepo, mockProblemRepo, uc
+	return mockItemTagRepo, mockTagRepo, mockProjectRepo, mockSnippetRepo, mockLinkRepo, mockProblemRepo, mockNoteRepo, uc
 }

Observação: todos os chamadores de SetupItemTagUseCaseTest precisam ser atualizados.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend-go/internal/usecase/item_tag_usecase_test.go` around lines 108 - 117,
Atualize SetupItemTagUseCaseTest para incluir mockNoteRepo em seu retorno,
permitindo configurar expectativas para model.ItemTypeNote; ajuste todos os
chamadores para receber o novo valor sem alterar os demais mocks.
backend-go/internal/domain/port/note_repository.go (1)

12-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Padronize a ordem dos parâmetros UUID.

Use uma ordem única, preferencialmente (projectID, id), em ProjectScopedRepository.ExistsByIDAndProjectID e nas implementações, helpers, mocks e chamadas relacionadas. Atualmente, esse método usa (id, projectID), ao contrário de FindByIDAndProjectID e DeleteByIDAndProjectID.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend-go/internal/domain/port/note_repository.go` around lines 12 - 14,
Padronize a assinatura de ProjectScopedRepository.ExistsByIDAndProjectID para
receber UUIDs na ordem (projectID, id), alinhando-a com FindByIDAndProjectID e
DeleteByIDAndProjectID. Atualize todas as implementações, helpers, mocks e
chamadas relacionadas para preservar essa mesma ordem de argumentos.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend-go/docs/openapi.yaml`:
- Around line 792-798: Atualize as descrições de item_type nos endpoints de
associação e desassociação de tags no OpenAPI para incluir NOTE junto de
SNIPPET, LINK e PROBLEM, mantendo o enum ItemType e o restante da documentação
inalterados.

In `@backend-go/internal/adapter/in/web/handler/note_handler.go`:
- Around line 44-45: Registre o erro retornado por Create antes de enviar a
resposta 500, seguindo o padrão de log.Printf já usado por GetAll, Get, Update e
Delete no note_handler. Preserve a resposta JSON e o retorno antecipado após o
registro.

In `@backend-go/internal/usecase/note_usecase.go`:
- Around line 159-168: Torne o fluxo de exclusão em torno de
DeleteByIDAndProjectID e RemoveAllTagsFromItem transacional, garantindo rollback
quando a remoção das tags falhar. Substitua o log de aviso por propagação do
erro e faça o método retornar falha nesse caso; adicione um teste cobrindo a
falha de RemoveAllTagsFromItem e verificando a atomicidade.

---

Nitpick comments:
In `@backend-go/internal/domain/port/note_repository.go`:
- Around line 12-14: Padronize a assinatura de
ProjectScopedRepository.ExistsByIDAndProjectID para receber UUIDs na ordem
(projectID, id), alinhando-a com FindByIDAndProjectID e DeleteByIDAndProjectID.
Atualize todas as implementações, helpers, mocks e chamadas relacionadas para
preservar essa mesma ordem de argumentos.

In `@backend-go/internal/usecase/item_tag_usecase_test.go`:
- Around line 108-117: Atualize SetupItemTagUseCaseTest para incluir
mockNoteRepo em seu retorno, permitindo configurar expectativas para
model.ItemTypeNote; ajuste todos os chamadores para receber o novo valor sem
alterar os demais mocks.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 03f5749e-e338-45c3-b35a-ce6e168f2d75

📥 Commits

Reviewing files that changed from the base of the PR and between bbba5fe and 71d009d.

📒 Files selected for processing (13)
  • backend-go/cmd/api/main.go
  • backend-go/docs/openapi.yaml
  • backend-go/internal/adapter/in/web/handler/note_handler.go
  • backend-go/internal/adapter/in/web/handler/note_handler_test.go
  • backend-go/internal/adapter/in/web/handler/test_helper_test.go
  • backend-go/internal/adapter/in/web/router.go
  • backend-go/internal/adapter/out/persistence/note_repository.go
  • backend-go/internal/domain/port/note_repository.go
  • backend-go/internal/dto/note_dto.go
  • backend-go/internal/usecase/item_tag_usecase.go
  • backend-go/internal/usecase/item_tag_usecase_test.go
  • backend-go/internal/usecase/note_usecase.go
  • backend-go/internal/usecase/note_usecase_test.go

Comment thread backend-go/docs/openapi.yaml
Comment thread backend-go/internal/adapter/in/web/handler/note_handler.go
Comment thread backend-go/internal/usecase/note_usecase.go
…API docs for NOTE item type

- Log detailed error information in `NoteHandler.Create` on internal server errors.
- Extend OpenAPI `ItemType` descriptions to include support for `NOTE` in tag association endpoints.
@MathCunha16
MathCunha16 merged commit 741d025 into feature/backend/refactor-to-golang Aug 9, 2026
1 check passed
@MathCunha16
MathCunha16 deleted the feature/go-notes branch August 9, 2026 21:32
MathCunha16 added a commit that referenced this pull request Aug 14, 2026
…dules (#40)

* feat: integrate Tauri framework with initial splash screen, IPC commands, and automatic version synchronization script

* refactor: migrate to Tauri-based packaging by bundling the backend JAR and removing legacy Java desktop components.

* feat(backend-go): setup initial sql migrations and domain models" -m "- Initialize Go module (go.mod, go.sum) and
  project structure
    - Add 9 SQL database migrations mirroring Java Liquibase changesets
    - Add domain entity models (BaseEntity, AppSetting, Project, Snippet, Link, Problem, Note, Credential, Tag, ItemTag)
    - Add .gitignore for Go backend"

* Feat: (GO) add repository interfaces and implement persistence layer (#30)

* feat(backend-go): add repository interfaces for domain models

* feat(backend-go): implement persistence layer and adapters for repositories

* fix(backend-go): improve error handling and update repository method consistency

- Handle `sql.ErrNoRows` in `FindByID` to return `nil` instead of error.
- Standardize method naming (`ExistsById` → `ExistsByID`).
- Simplify and optimize `NewPage` calculations.
- Align `ItemTagRepository` methods with additional `projectID` parameter for consistency and data integrity.

* Enhance backend API with project management features and documentation (#31)

* feat(backend-go): add API entry point, project use case, and unit tests

- Implement main.go as the entry point for the backend API
- Add `ProjectUseCase` with CRUD, archive, and unarchive methods for projects
- Write unit tests for the project use case with a mock repository
- Update go.mod and go.sum with new dependencies for testing and validation

* feat(backend-go): add project API with middleware, routing, and migrations

- Extend `main.go` with server setup, project routing, and UUID token handling
- Implement `ProjectHandler` for project creation and retrieval via Gin
- Add CORS and auth middleware to secure and facilitate API requests
- Update database migrations to use `DATETIME` for timestamps
- Add validation to `CreateProjectCommand`
- Update dependencies in `go.mod` and `go.sum` for API and middleware functionality

* refactor(backend-go): reorganize project handler into separate package and enhance test coverage

- Move `ProjectHandler` to `handler` package for better modularity
- Add comprehensive test coverage for project handler, including success and failure cases
- Introduce `GetAll`, `Update`, `Archive`, `Unarchive`, and `Delete` methods to `ProjectHandler`
- Implement pagination support via `PaginationQuery` in `GetAll`
- Adjust router and test helper to reflect structural changes

* feat(backend-go): add OpenAPI documentation hosting and API reference routes

- Introduce `/docs` and `/openapi.yaml` routes for hosting API documentation
- Implement `registerDocsRoutes` function to serve documentation in development environment
- Add dependency `go-scalar-api-reference` for generating interactive API reference
- Include OpenAPI YAML specification for Devaulty API

* feat(backend-go): enhance error handling, validation, and CORS middleware

- Add detailed error handling in project APIs for "not found" and invalid states
- Update pagination validation with binding rules for `PageNumber` and `PageSize`
- Improve CORS middleware with restricted allowed origins list
- Replace direct string comparisons with constant-time comparison in auth middleware
- Extend OpenAPI specification with validation, error responses, and pagination constraints
- Enhance test coverage for new validation and error scenarios

* Feat: Complete Snippet Module Implementation, Integration Tests & API Docs (#32)

* feat(backend-go): add Snippet use case with tests and repository adjustments

- Implement `SnippetUseCase` for Create, Read, Update, and Delete operations.
- Add unit tests for Snippet use case.
- Modify repository to support project-scoped Snippet operations with `FindByIDAndProjectID` and `DeleteByIDAndProjectID`.
- Refactor auxiliary functions to ensure project existence.

* feat(backend-go): add SnippetHandler with tests and OpenAPI documentation

- Implement SnippetHandler for Create, Read, Update, and Delete endpoints.
- Add integration tests for SnippetHandler.
- Extend OpenAPI documentation to include Snippet operations.
- Introduce `ExtractUUIDParam` helper for parameter validation.

* reafactor(backend-go): improve error handling and extend delete operations

- Enhance error responses in ProjectHandler and SnippetHandler with proper status codes and logging.
- Modify repository delete methods to return success status and adjust use cases accordingly.
- Update integration and unit tests to validate deletion behavior and persistence.
- Extend OpenAPI documentation with 500 error responses and specific error scenarios for delete endpoints.

* Feat: Complete Link Module Implementation, Integration Tests & OpenAPI Documentation (#33)

* reafactor(backend-go): improve error handling and extend delete operations

- Enhance error responses in ProjectHandler and SnippetHandler with proper status codes and logging.
- Modify repository delete methods to return success status and adjust use cases accordingly.
- Update integration and unit tests to validate deletion behavior and persistence.
- Extend OpenAPI documentation with 500 error responses and specific error scenarios for delete endpoints.

* docs(openapi): remove nullable attribute from several fields

* Feat: Complete Problem Module Implementation (#34)

* feat(backend-go): implement problem use case with repository and unit tests

- Added `ProblemUseCase` handling CRUD operations and business logic for problems.
- Implemented `Create`, `Update`, `UpdateStatus`, `GetByID`, `GetAllByProjectID`, and `Delete` methods.
- Updated `ProblemRepository` to include project-scoped methods (`FindByIDAndProjectID`, `DeleteByIDAndProjectID`, `ExistsByIDAndProjectID`).
- Added comprehensive unit tests to validate problem use case functionality.

* feat(backend-go): add problem handler, routes, and integration tests

- Implemented `ProblemHandler` to handle HTTP operations for problems.
- Added CRUD and pagination routes for problem management under `/projects/:project_id/problems`.
- Extended OpenAPI documentation with schemas and endpoints for problems.
- Updated integration test suite with comprehensive tests for problem API operations.
- Modified `ProblemUseCase` and repository types to include summary support.

* Feat: Complete Tag & ItemTag Module Implementation (#35)

* feat(tag): enhance tag repository methods and add use cases

- Update repository methods to include project scope (`FindByIDAndProjectID`, `DeleteByIDAndProjectID`).
- Implement `TagUseCase` with create, update, delete, and search operations.
- Add unit tests for `TagUseCase` methods.
- Introduce `ItemTagUseCase` for associating/disassociating tags with items.

* feat(usecase): integrate item-tag repository into use cases

- Extend `ProblemUseCase`, `SnippetUseCase`, and `LinkUseCase` to manage item-tag associations.
- Remove all related tags during deletion of problems, snippets, and links.
- Update constructors and unit tests to include `ItemTagRepository`.
- Adjust API handlers and test helpers to support the new dependency.

* feat(handler): implement tag and item-tag HTTP handlers with tests

- Add `TagHandler` to manage CRUD operations and search functionality for tags.
- Introduce `ItemTagHandler` to handle tag associations and disassociations with items.
- Update `router.go` and initialization logic to register new routes and handlers.
- Add comprehensive unit tests for both handlers covering success and error scenarios.

* refactor(dto): replace inline command structs with DTO package

- Move command structs (`CreateProblemCommand`, `UpdateProblemCommand`, etc.) to `dto` package for better reuse and consistency.
- Update use cases, handlers, and tests to use the new DTO package.
- Refactor logic in related use case methods (`Create`, `Update`, etc.) to map domain models to view models.
- Adjust unit tests to align with the DTO-based refactor.

* docs: update security and tag architecture docs for Go backend

- Revise local development token documentation to align with Go backend implementation.
- Update token naming conventions, middleware logic, and local testing instructions.
- Rewrite tag system architecture docs to reflect Go backend design, including database schema, use cases, and DTO changes.

* refactor(usecase): update tag use cases to return DTOs and enhance item-tag handling

- Refactor `TagUseCase` methods to return `TagView` DTOs instead of domain models.
- Add mapping functions to convert domain models to DTOs (`mapTagToView`, `mapTagsToViews`) for consistency.
- Extend `ItemTagUseCase` to properly handle duplicate item IDs during tag associations.
- Update related tests to reflect DTO usage and improved item-tag logic.
- Introduce better error logging for tag removal failures across use cases (`LinkUseCase`, `SnippetUseCase`, `ProblemUseCase`).
- Modify OpenAPI spec to reflect supported item types for tag operations.

* Feat: implement note module (#36)

* feat(backend-go): implement project-scoped note use cases and repository updates

- Update `NoteRepository` with project-scoped methods:
  - `FindByIDAndProjectID`
  - `DeleteByIDAndProjectID`
- Introduce `NoteUseCase` for CRUD operations on notes, ensuring project context.
- Add DTOs (`CreateNoteCommand`, `NoteView`, `NoteSummary`) for note-related operations.
- Update `ItemTagUseCase` to support `ItemTypeNote`.

* feat(backend-go): enhance note use cases with update and delete operations, add associated tests

- Implement `NoteUseCase.Update` and `NoteUseCase.Delete` methods.
- Update `NoteUseCase.GetByID` to improve error handling and tag retrieval.
- Integrate `NoteRepository` into `ItemTagUseCase`.
- Add mock repository for notes in tests.
- Adjust `NoteView` and `NoteSummary` DTO fields for consistency.
- Add unit tests for note use cases.

* feat(backend-go): add NoteHandler for managing notes with full CRUD operations

- Implement `NoteHandler` for handling notes within project context.
- Add router mappings and integrate `NoteHandler` into the API.
- Update test helpers and add extensive tests for note routes and handler logic.

* feat(api-docs): add OpenAPI documentation for notes management

- Document CRUD operations for notes: create, read (single and paginated), update, and delete.
- Add schemas for `Note`, `NoteSummary`, `NoteSummaryPage`, `CreateNoteCommand`, and `UpdateNoteCommand`.
- Extend `ItemType` enum with `NOTE`.
- Define paths for `/projects/{project_id}/notes` and `/projects/{project_id}/notes/{note_id}`.

* fix(backend-go): improve error logging in NoteHandler and update OpenAPI docs for NOTE item type

- Log detailed error information in `NoteHandler.Create` on internal server errors.
- Extend OpenAPI `ItemType` descriptions to include support for `NOTE` in tag association endpoints.

* feat:  Vault Security Engine & AppSettings (#37)

* feat(backend-go): implement secure vault use case and key management

- Add VaultUseCase to manage master password setup, unlocking, and session status.
- Introduce MasterKeySession and Argon2KeyDeriver adapters for secure key handling.
- Add DTOs for handling API interactions related to the vault and app settings.
- Implement unit tests for VaultUseCase methods.
- Upgrade dependencies in go.mod and go.sum for crypto and security improvements.

* feat(backend-go): add SecurityHandler and integrate Vault APIs

- Introduce SecurityHandler to manage master password setup, unlocking, session status, and vault locking.
- Extend Gin router with security-related routes.
- Update DTO validation for master password constraints.
- Add OpenAPI documentation for security endpoints.
- Implement unit tests for SecurityHandler functions.
- Refactor memory hygiene guide to align with backend-go security standards.

* refactor(backend-go): improve memory handling and add comprehensive security tests

- Enhance memory hygiene in SecurityHandler by ensuring proper password reference clearing.
- Add extensive unit tests for Argon2KeyDeriver and MasterKeySessionHolder for key derivation, salt generation, and session management.
- Simplify VaultUseCase by consolidating app setting save operations with `SaveMasterPasswordSettings`.
- Improve synchronization and defensive copying in MasterKeySessionHolder.
- Introduce transaction handling and constraints for saving master password settings in AppSettingRepository.

* Feat: Credentials Module Implementation & AES-256-GCM Security Integration (#38)

* feat(backend-go): implement AES-GCM crypto adapter and related DTOs

- Add AES-GCM encryption/decryption implementation (`AESGCMCryptoAdapter`)
- Create Crypto port interface for encryption abstraction
- Include tests for AES-GCM encryption/decryption scenarios
- Add credential-related DTOs for command and view models
- Update `CredentialRepositoryAdapter` to refine query for credential retrieval

* **feat(backend-go): add credential use case with unit tests and repository enhancements**

- Implement `CredentialUseCase` for CRUD operations, including:
  - `Create`, `GetById`, `GetAllByProjectID`, `Update`, and `Delete`.
- Add corresponding unit tests to ensure robustness.
- Extend `CredentialRepository` interface for project-scoped queries.
- Update `CredentialRepositoryAdapter` with project-specific operations for `FindByID` and `DeleteByID`.

* **feat(backend-go): add CredentialHandler and API routes for credential management**

- Introduced `CredentialHandler` with CRUD operations (`Create`, `GetAll`, `GetById`, `Update`, `Delete`).
- Mapped routes under `/projects/:project_id/credentials`.
- Updated dependency injection for `CredentialHandler` in `main.go`.
- Enhanced test coverage with integration tests for credential APIs.

* **feat(backend-go): add VaultAutoLock scheduler to purge expired sessions**

- Introduced `VaultAutoLock` in the `scheduler` package to handle automatic session purging.
- Integrated the scheduler into `main.go` for periodic cleanup of expired sessions.
- Refactored `MasterKeySession` field casing for consistency across the codebase.

* **feat: extend OpenAPI spec to include credential management and secret payload handling**

- Added schemas for `CredentialSecretType`, `CreateCredentialCommand`, `UpdateCredentialCommand`, `CredentialView`, and paginated responses.
- Documented new endpoints under `/projects/{project_id}/credentials` for CRUD operations.
- Updated handling for item types to support `CREDENTIAL`.
- Improved sensitive data marshaling using `SecretBytes` for enhanced memory hygiene.

* **refactor(backend-go): improve test memory hygiene and update credential update logic**

- Refactored unit tests to ensure zeroing of sensitive `masterKey` during runtime.
- Updated `UpdateCredential` to handle partial updates with secret payload merging.
- Improved error messages for decryption failure scenarios.
- Adjusted OpenAPI spec error description for clarity on UUID validation.

* Feature/adapt frontend to golang (#39)

* feat(frontend): adapt REST API client to Go backend

- Update internal security token header to DEVAULTY_INTERNAL_TOKEN
- Adapt error interceptor to handle Go backend error payload format ({ error: string })
- Align MasterPassword setup check response with MasterPasswordSetupRequiredView schema
- Update tag search query parameter to tag_name
- Add tag badges rendering and tag search filtering to Snippets list view

* feat(tauri): integrate native Go backend and optimize memory usage

- Replace Java JRE integration in Tauri Rust shell with native Go sidecar execution
- Implement secure IPC using CSPRNG UUID token and stdout stream handshake
- Embed SQL migrations inside Go binary via go:embed for a self-contained executable
- Reduce Go backend RAM footprint down to 19MB via Gin ReleaseMode and GOGC tuning
- Implement 3-phase app startup (handshake, HTTP health check, minimum 2s splash screen)
- Update cross-platform build scripts and purge all remaining Java/Spring dependencies

* refactor: migrate backend from Gradle/Java to Go and update CI/CD pipelines to build installers via Tauri

* fix: improve backend data directory resolution, clean build artifacts, and normalize application versioning for Tauri compatibility.

* refactor!: replace Java backend with native Go backend and update Tauri v2 pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Backend feature or modification documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant