1 files added
1 files modified
| New file |
| | |
| | | const db = require("../lib/db") |
| | | const yargs = require("yargs") |
| | | |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | const argv = yargs |
| | | .usage("$0 <ref_id>", "get kurs using <ref_id>",) |
| | | .strict() |
| | | .parse() |
| | | |
| | | console.log(`argv.ref_id=${argv.ref_id}`) |
| | | |
| | | run(argv) |
| | | .then(console.log) |
| | | .catch(console.error) |
| | | .finally(process.exit) |
| | | |
| | | async function run({ref_id}) { |
| | | return await db.getKursByRefId(ref_id) |
| | | } |
| | | |
| | |
| | | getRefIdFromObjId, |
| | | |
| | | getKurse, |
| | | getKurs, |
| | | getKursByObjId, |
| | | getKursByRefId, |
| | | getTeilnehmer, |
| | | } |
| | | |
| | |
| | | return results |
| | | } |
| | | |
| | | async function getKurs (obj_id) { |
| | | async function getKursByRefId (refId) { |
| | | const {ref_id, obj_id} = await getObjIdFromRefId(refId) |
| | | return getKursByObjId(obj_id) |
| | | } |
| | | |
| | | async function getKursByObjId (obj_id) { |
| | | const pool = await poolP |
| | | const q = `SELECT or2.ref_id, or2.obj_id, od.title, od.description, od.type |
| | | FROM ${database}.object_reference or2 |