From d8856efd30dfcb05b26a5b66b5bb14cc0604e2b1 Mon Sep 17 00:00:00 2001 From: Biswa Kalyan Bhuyan Date: Fri, 25 Apr 2025 02:39:12 +0530 Subject: finance/backend: feat: added v1/goals and handlers/goal_handler for Goal CRUD --- backend/internal/api/v1/goals/goals.go | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 backend/internal/api/v1/goals/goals.go (limited to 'backend/internal/api/v1') diff --git a/backend/internal/api/v1/goals/goals.go b/backend/internal/api/v1/goals/goals.go new file mode 100644 index 0000000..1d2cd6f --- /dev/null +++ b/backend/internal/api/v1/goals/goals.go @@ -0,0 +1,43 @@ +package goals + +import ( + "finance/backend/handlers" + + "github.com/gin-gonic/gin" +) + +// GetGoals returns all goals for the authenticated user +func GetGoals() gin.HandlerFunc { + handler := handlers.NewGoalHandler() + return handler.GetGoals +} + +// GetGoalByID returns a specific goal by ID +func GetGoalByID() gin.HandlerFunc { + handler := handlers.NewGoalHandler() + return handler.GetGoal +} + +// CreateGoal creates a new financial goal +func CreateGoal() gin.HandlerFunc { + handler := handlers.NewGoalHandler() + return handler.CreateGoal +} + +// UpdateGoal updates an existing goal +func UpdateGoal() gin.HandlerFunc { + handler := handlers.NewGoalHandler() + return handler.UpdateGoal +} + +// DeleteGoal deletes a goal +func DeleteGoal() gin.HandlerFunc { + handler := handlers.NewGoalHandler() + return handler.DeleteGoal +} + +// UpdateGoalProgress updates just the progress (current amount) of a goal +func UpdateGoalProgress() gin.HandlerFunc { + handler := handlers.NewGoalHandler() + return handler.UpdateGoalProgress +} -- cgit v1.2.3-59-g8ed1b