From 4f437a63ee466ada497b47f1c4f8601b4ab0dd37 Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <fabio@manganiello.tech>
Date: Thu, 3 Apr 2025 02:36:04 +0200
Subject: [PATCH] The key attribute of the `/stats` response should only
 contain groupBy columns

---
 src/repos/Stats.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/repos/Stats.ts b/src/repos/Stats.ts
index 4f2bcf3..81f1b90 100644
--- a/src/repos/Stats.ts
+++ b/src/repos/Stats.ts
@@ -28,7 +28,7 @@ class Stats {
       })
     ).map(({dataValues: data}: any) =>
       new LocationStats({
-        key: Object.keys(data).reduce((acc, k) => {
+        key: groupBy.reduce((acc, k) => {
           acc[dbColumnsToProps[k] || k] = data[k];
           return acc;
         }, {} as Record<string, any>),