diff options
Diffstat (limited to 'api/internal/controllers/stats.go')
-rw-r--r-- | api/internal/controllers/stats.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/api/internal/controllers/stats.go b/api/internal/controllers/stats.go index d8ed434..2234787 100644 --- a/api/internal/controllers/stats.go +++ b/api/internal/controllers/stats.go | |||
@@ -8,6 +8,10 @@ import ( | |||
8 | "water/api/internal/models" | 8 | "water/api/internal/models" |
9 | ) | 9 | ) |
10 | 10 | ||
11 | // TODO: add comments to all exported members of package. | ||
12 | |||
13 | // GetAllStatistics connects to the database and queries for all statistics in the database. | ||
14 | // If none have been found it will return an error, otherwise a 200 code is sent along with the list of statistics. | ||
11 | func GetAllStatistics(c *gin.Context) { | 15 | func GetAllStatistics(c *gin.Context) { |
12 | db := database.EstablishDBConnection() | 16 | db := database.EstablishDBConnection() |
13 | defer func(db *sql.DB) { | 17 | defer func(db *sql.DB) { |
@@ -78,7 +82,7 @@ func PostNewStatistic(c *gin.Context) { | |||
78 | c.JSON(http.StatusCreated, gin.H{"status": "created", "id": id}) | 82 | c.JSON(http.StatusCreated, gin.H{"status": "created", "id": id}) |
79 | } | 83 | } |
80 | 84 | ||
81 | func GetWeeklyStatistics (c *gin.Context) { | 85 | func GetWeeklyStatistics(c *gin.Context) { |
82 | db := database.EstablishDBConnection() | 86 | db := database.EstablishDBConnection() |
83 | defer func(db *sql.DB) { | 87 | defer func(db *sql.DB) { |
84 | err := db.Close() | 88 | err := db.Close() |