-
Notifications
You must be signed in to change notification settings - Fork 49
Database
The database is split up into several modules. To get the full functionality, you should import the entire folder.
const db = require("./server/database");
The database functions are all promise based. In order to use them in the route handler, use async await:
const user = await db.auth.getUser({ id: "VALID-UUID-HERE" })
This is the auth
module.
db.auth.getUser({ id: "VALID-UUID-HERE" })
.then(user => console.log(user))
All the functions return a user object, defined as such.
{
id, // uuid
name, // string
email, // string
division, // string
password, // string
perms // int
}
Returns the user associated with the given id.
Parameters: { id }
Returns: [User Object]
: The associated user
Creates a user given all the required parameters. Note that you need to pass in a valid uuid for id
.
Parameters: [User Object]
Returns: [User Object]
: The user that got created
Updates the parameters of a user with a given id. Only the id
parameter is required to be not undefined
. If a parameter is undefined, that parameter will not be updated.
Parameters: [User Object]
Returns: [User Object]
: The updated user