REST Service for POPCORN - ILIAS
alex
2025-06-05 1f306616c68939ba1905d4bc6faa33502bc59370
app.js
@@ -45,8 +45,8 @@
   .get("/api/user/login/:login", async function (req, res) {
      const {login} = req.params
      const user = await db.getUserByLogin(login)
      if (user.length) {
         return res.send(user[0])
      if (user) {
         return res.send(user)
      }
      else {
         return res.code(404).send({status: "error", msg: "not found"})
@@ -66,11 +66,12 @@
      }
   })
   .get("/api/user/teilnahmen/:userId", async function (req, res) {
      const {userid} = req.params
      if(!userid || isNaN(Number(userid))) {
         return res.code(500).send({status: "error", msg: "userid error"})
      let userId = req.params.userId
      console.log(`--------${userId}-----------`, typeof userId)
      if(!userId || isNaN(Number(userId))) {
         return res.code(500).send({status: "error", msg: "userId error"})
      }
      const tn = await db.getUserTeilnahmen(userid)
      const tn = await db.getUserTeilnahmen(userId)
      if (tn) {
         return res.send(tn)
      }
@@ -124,7 +125,7 @@
   })
   .get("/api/kurs/items/:refId", async function (req, res) {
      const {refId} = req.params
      let data = await db.getKursItems(refId)
      let data = await db.getKursItems2(refId)
      if (data) {
         return res.send(data)
      }