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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user