feat(#17): CRUD de categorias — API Go + tela Vue + testes unitários

API REST /api/categories (GET/POST/PUT/DELETE) com regras de negócio:
categorias padrão não podem ser excluídas; categorias com transações vinculadas
também bloqueadas. Tela Vue com formulário inline de criação/edição, indicador
visual de categorias padrão e botão de exclusão condicional.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-05-26 20:11:54 -03:00
co-authored by Claude Sonnet 4.6
parent a3d8f363a5
commit d6782d51a5
12 changed files with 720 additions and 1 deletions
+10 -1
View File
@@ -15,6 +15,8 @@ import (
"financeiro-carvalho/internal/db"
"financeiro-carvalho/internal/handler"
"financeiro-carvalho/internal/migration"
"financeiro-carvalho/internal/repository"
"financeiro-carvalho/internal/service"
"financeiro-carvalho/static"
)
@@ -46,10 +48,17 @@ func main() {
r.Use(middleware.Logger)
r.Use(middleware.Recoverer)
categoryRepo := repository.NewCategoryRepository(pool)
categorySvc := service.NewCategoryService(categoryRepo)
categoryHandler := handler.NewCategoryHandler(categorySvc)
r.Get("/health", handler.Health)
r.Route("/api", func(r chi.Router) {
// API routes added here as features are built
r.Get("/categories", categoryHandler.List)
r.Post("/categories", categoryHandler.Create)
r.Put("/categories/{id}", categoryHandler.Update)
r.Delete("/categories/{id}", categoryHandler.Delete)
})
// Serve Vue SPA — non-API routes fall through to index.html