REST Service for POPCORN - ILIAS
alex
8 hours ago a82027a51a3056e574b9c6c8941a7a16f5841126
lib/libIlias.js
@@ -5,6 +5,7 @@
const db = require("./db")
const {url, iliastoken} = settings.ilias
const search = require("./search")
const log = require("../logger")
/////////////////////////////////////////////////////////////////////////
@@ -35,6 +36,7 @@
      token: iliastoken,
   })
   let url2 = `${url}?${sp.toString()}`
   log.debug("pinging url", url2)
   const res = await fetch(url2, {method: "GET"})
   return await res.json() //
}
@@ -84,13 +86,16 @@
   const udfDef = await db.getUdf()
   const udfMap = _.keyBy(udfDef, "field_name")
   user.udf = _.mapKeys(user.udf, function (value, key) {
   // do not mutate the caller's user object
   const user2 = _.cloneDeep(user)
   user2.udf = _.mapKeys(user.udf, function (value, key) {
      return udfMap[key].field_id
   })
   const res = await fetch(url2, {
      method: "POST",
      body: JSON.stringify(user)
      body: JSON.stringify(user2)
   })
   const text = await res.text()
   try {
@@ -188,7 +193,7 @@
      token: iliastoken,
   })
   let url2 = `${url}?${sp.toString()}`
   console.log(url2)
   log.debug(url2)
   const res = await fetch(url2, {method: "POST"})
   return await res.json()
}
@@ -201,7 +206,7 @@
      token: iliastoken,
   })
   let url2 = `${url}?${sp.toString()}`
   console.log(url2)
   log.debug(url2)
   const res = await fetch(url2, {method: "DELETE"})
   return await res.json()
}