From bd6b930043d6bca90b6a3be7a4a18c9da713555d Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Mon, 30 Jun 2025 14:21:26 +0000
Subject: [PATCH] update settings

---
 lib/db.js |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/lib/db.js b/lib/db.js
index 531e5cf..48215e6 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -40,6 +40,9 @@
    getKursTeilnehmer,
    getKursTeilnehmerCount,
 
+   getUdf,
+
+   getMemberRoleForCourse,
 }
 
 /////////////////////////////////////////////////////////////////////////
@@ -311,6 +314,7 @@
               WHERE (or2.ref_id = ${ref_id} OR parent_id = ${ref_id})
               ORDER BY usr_id
    `
+   console.log(q)
    const [results] = await pool.query(q)
    return results
 }
@@ -350,3 +354,33 @@
    const [results] = await pool.query(q)
    return results
 }
+
+/////// UDF ////////////////////////////////////////////////////////////////
+
+async function getUdf () {
+   const pool = await poolP
+   const q = `SELECT field_id, field_name, field_type
+              from ${database}.udf_definition;`
+   const [results] = await pool.query(q)
+   return results
+}
+
+/////// ROLLEN ////////////////////////////////////////////////////////////////
+
+async function getMemberRoleForCourse (obj_id) {
+   const pool = await poolP
+   const q = `SELECT obj_id, title, description
+              from object_data od
+              WHERE type = "role" #AND title LIKE 'il_crs_member_157'
+                AND od.description LIKE 'Member%${obj_id}'
+   `
+   const [results] = await pool.query(q)
+   // darf nur einen Treffer ergeben
+   if (results.length) {
+      const {obj_id, title, description} = results[0]
+      return obj_id
+   }
+   else {
+      return null
+   }
+}

--
Gitblit v1.8.0