mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 22:59:28 +00:00
Close database connection when finished with it
This commit is contained in:
@@ -81,6 +81,8 @@ class Class {
|
|||||||
classId
|
classId
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
conn.close();
|
||||||
|
|
||||||
this.teacherIds = ids.map(record => record.id);
|
this.teacherIds = ids.map(record => record.id);
|
||||||
|
|
||||||
const [ teachers, subject ] = await Promise.all([
|
const [ teachers, subject ] = await Promise.all([
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class PasswordReset {
|
|||||||
token
|
token
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
conn.close();
|
||||||
|
|
||||||
if (!record.length)
|
if (!record.length)
|
||||||
throw new Error('No password reset found');
|
throw new Error('No password reset found');
|
||||||
|
|
||||||
@@ -69,6 +71,8 @@ class PasswordReset {
|
|||||||
|
|
||||||
await conn.runQuery(sql, [ u.id ]);
|
await conn.runQuery(sql, [ u.id ]);
|
||||||
|
|
||||||
|
conn.close();
|
||||||
|
|
||||||
const [ nonce, token ] = await PasswordReset.hashToken(u);
|
const [ nonce, token ] = await PasswordReset.hashToken(u);
|
||||||
|
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class Subject {
|
|||||||
subjectId,
|
subjectId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
conn.close();
|
||||||
|
|
||||||
if (!record.length)
|
if (!record.length)
|
||||||
throw new Error('No subject found');
|
throw new Error('No subject found');
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ class Test {
|
|||||||
testId,
|
testId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
conn.close();
|
||||||
|
|
||||||
if (!record.length)
|
if (!record.length)
|
||||||
throw new Error('No test found');
|
throw new Error('No test found');
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ class TestTemplate {
|
|||||||
testTemplateId,
|
testTemplateId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
conn.close();
|
||||||
|
|
||||||
if (!record.length)
|
if (!record.length)
|
||||||
throw new Error('No test template found');
|
throw new Error('No test template found');
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ class User {
|
|||||||
const res =
|
const res =
|
||||||
await conn.runQuery(sql, [ userId ]);
|
await conn.runQuery(sql, [ userId ]);
|
||||||
|
|
||||||
|
conn.close();
|
||||||
|
|
||||||
if (!res.length)
|
if (!res.length)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user