Skip to content

Commit 3245894

Browse files
committed
adding
1 parent 9f27314 commit 3245894

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

services/hexathons/src/routes/hexathon-users.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ hexathonUserRouter.route("/:hexathonId/users/:userId").get(
8282
})
8383
);
8484

85+
hexathonUserRouter.route("/:hexathonId/refresh-users-points").get(
86+
checkAbility("update", "HexathonUser"),
87+
asyncHandler(async (req, res) => {
88+
const hexathonUsers = await HexathonUserModel.find({
89+
hexathon: req.params.hexathonId,
90+
});
91+
92+
const updatedUsers = await Promise.all(
93+
hexathonUsers.map(user =>
94+
getHexathonUserWithUpdatedPoints(req, user.userId, req.params.hexathonId)
95+
)
96+
);
97+
98+
return res.send({
99+
updatedCount: updatedUsers.length,
100+
});
101+
})
102+
);
103+
85104
hexathonUserRouter.route("/:hexathonId/users/:userId").patch(
86105
checkAbility("update", "HexathonUser"),
87106
asyncHandler(async (req, res) => {

0 commit comments

Comments
 (0)