mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 08:57:08 +00:00
Add setSurvey() utility function to DB interface.
It sets the current survey and optionally returns a client connection to use in subsequent queries.
This commit is contained in:
@@ -28,7 +28,16 @@ const transaction = {
|
||||
}
|
||||
};
|
||||
|
||||
async function setSurvey (projectId, client) {
|
||||
if (!client) {
|
||||
client = await pool.connect();
|
||||
}
|
||||
await client.query("CALL set_survey($1);", [projectId]);
|
||||
return client;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pool,
|
||||
transaction,
|
||||
setSurvey
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user