From 9b4e217fcf5e3aa48c4bc54f7bddabdd88a66de0 Mon Sep 17 00:00:00 2001
From: Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com>
Date: Wed, 14 May 2025 15:23:58 +0200
Subject: [PATCH] Rename from allowance to history

---
 backend/api_test.go | 4 ++--
 backend/main.go     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/backend/api_test.go b/backend/api_test.go
index cfff1c9..c74919f 100644
--- a/backend/api_test.go
+++ b/backend/api_test.go
@@ -406,14 +406,14 @@ func TestPostAllowanceInvalidUserId(t *testing.T) {
 		Status(404)
 }
 
-func TestGetAllowance(t *testing.T) {
+func TestGetHistory(t *testing.T) {
 	e := startServer(t)
 
 	e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: 100}).Expect().Status(200)
 	e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: 20}).Expect().Status(200)
 	e.POST("/user/1/allowance").WithJSON(PostAllowance{Allowance: -10}).Expect().Status(200)
 
-	response := e.GET("/user/1/allowance").Expect().Status(200).JSON().Array()
+	response := e.GET("/user/1/history").Expect().Status(200).JSON().Array()
 	response.Length().IsEqual(3)
 	response.Value(0).Object().Value("allowance").Number().IsEqual(100)
 	response.Value(0).Object().Value("timestamp").String().AsDateTime().InRange(getDelta(time.Now(), 2.0))
diff --git a/backend/main.go b/backend/main.go
index 8006f5c..8608846 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -325,7 +325,7 @@ func postAllowance(c *gin.Context) {
 	c.JSON(http.StatusOK, gin.H{"message": "Allowance updated successfully"})
 }
 
-func getAllowance(c *gin.Context) {
+func getHistory(c *gin.Context) {
 	userIdStr := c.Param("userId")
 	userId, err := strconv.Atoi(userIdStr)
 	if err != nil {
@@ -356,7 +356,7 @@ func start(ctx context.Context, config *ServerConfig) {
 	router.GET("/api/users", getUsers)
 	router.GET("/api/user/:userId", getUser)
 	router.POST("/api/user/:userId/allowance", postAllowance)
-	router.GET("/api/user/:userId/allowance", getAllowance)
+	router.GET("/api/user/:userId/history", getHistory)
 	router.GET("/api/user/:userId/goals", getUserGoals)
 	router.POST("/api/user/:userId/goals", createUserGoal)
 	router.DELETE("/api/user/:userId/goal/:goalId", deleteUserGoal)