From 71d793aabb443cccd8325c84d2ef10ec39f9b524 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Mon, 27 Feb 2023 01:09:49 +0000 Subject: [PATCH] add additional prototypes in db.js --- db.js | 14 ++++++++++++++ main.js | 1 + 2 files changed, 15 insertions(+) diff --git a/db.js b/db.js index ef55a42..17f2776 100644 --- a/db.js +++ b/db.js @@ -1,3 +1,7 @@ +const fs = require("fs"); + +filename = "localdb.json"; + /** * called at app startup, can be used to initialize any variables needed for database access */ @@ -7,13 +11,23 @@ function init () {} * user requests additional resources specified in k-v pairs * @param {string} user user's proxmox username in the form username@authrealm * @param {Object} resources k-v pairs with resource name as keys and resource ammount as values + * @returns {boolean} whether the user is approved to allocate requested resources */ function requestResources (user, resources) {} +/** + * user allocates additional resources specified in k-v pairs + * @param {string} user user's proxmox username in the form username@authrealm + * @param {Object} resources k-v pairs with resource name as keys and resource ammount as values + * @returns {boolean} true if resources were successfully allocated, false otherwise + */ +function allocateResources (user, resources) {} + /** * user releases allocated resources specified in k-v pairs * @param {string} user user's proxmox username in the form username@authrealm * @param {Object} resources k-v pairs with resource name as keys and resource ammount as values + * @returns {boolean} true if resources were successfully deallocated, false otherwise */ function releaseResources (user, resources) {} diff --git a/main.js b/main.js index 33267e4..cc0b817 100644 --- a/main.js +++ b/main.js @@ -240,5 +240,6 @@ async function handleResponse (node, response) { } app.listen(listenPort, () => { + init(); console.log(`proxmoxaas-api v${api.version} listening on port ${listenPort}`); }); \ No newline at end of file