generated from azures04/Base-REST-API
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.
28 lines
952 B
JavaScript
28 lines
952 B
JavaScript
const express = require("express")
|
|
const transportService = require("../../../../services/transportService")
|
|
const router = express.Router({ mergeParams: true })
|
|
|
|
router.get("/:lineId", async (req, res) => {
|
|
const { lineId } = req.params
|
|
const line = await transportService.getLineById({ lineId })
|
|
return res.status(200).json(line)
|
|
})
|
|
|
|
router.get("/:lineId/stations", async (req, res) => {
|
|
const { lineId } = req.params
|
|
const stations = await transportService.getLineStations({ lineId, directionId: 0 })
|
|
return res.status(200).json(stations)
|
|
})
|
|
|
|
router.get("/all", async (req, res) => {
|
|
const lines = await transportService.getAllLines()
|
|
return res.status(200).json(lines)
|
|
})
|
|
|
|
router.get("/all/:transportType", async (req, res) => {
|
|
const { transportType } = req.params
|
|
const lines = await transportService.getLinesByTransportType(transportType)
|
|
return res.status(200).json(lines)
|
|
})
|
|
|
|
module.exports = router |