generated from azures04/Base-REST-API
Add badges, checkins, and transport endpoints
Introduce gamification and check-in support plus expanded transport/admin APIs. Added DDL for checkins, badges and user_badges. New repositories: badgeRepository, userBadgeRepository, checkinRepository. New routes: admin badge management, admin transport (lines/platforms/stations), public transport endpoints, user checkins and stations endpoints, and user badges on /me. Services updated: adminService (badge CRUD & user assignment), userService (checkins, badge queries), authService (hasAdminRights). Minor package.json name update. These changes implement database, repo, service and route wiring for badges, user_badins and checkin features and additional transport admin routes.
This commit is contained in:
@@ -111,6 +111,13 @@ async function isLogged(req, res, next) {
|
||||
next()
|
||||
}
|
||||
|
||||
function hasAdminRights(req, res, next) {
|
||||
if (req.user?.role == "admin") {
|
||||
return next()
|
||||
}
|
||||
throw new DefaultError(403, "Forbidden", "You must be administrator.")
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isLogged,
|
||||
loginLocal,
|
||||
@@ -118,5 +125,6 @@ module.exports = {
|
||||
resetPassword,
|
||||
registerLocal,
|
||||
changePassword,
|
||||
hasAdminRights,
|
||||
refreshAccessToken,
|
||||
}
|
||||
Reference in New Issue
Block a user