Skip to content

Commit 6dd6341

Browse files
committed
fixing lint issues
1 parent e7e0449 commit 6dd6341

File tree

3 files changed

+19
-26
lines changed

3 files changed

+19
-26
lines changed

commands/course.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ module.exports = {
198198
/** @type {DBuser} */
199199
const userDB = global.userDB;
200200
userDB.remove_user_role(interaction.user.id, role.name);
201-
201+
202202
await interaction.member.roles.remove(role);
203203
return await interaction.reply({
204204
content: `✅ | Removed you from the role and chat for \`${course}\`.`,

events/db_ready.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22
const { DBuser } = require("../lib/database/database");
3-
const { CronJob } = require('cron');
3+
const { CronJob } = require("cron");
44

55
/* eslint-disable */
66
const CSESOC_SERVER_ID = "693779865916276746";

lib/database/database.js

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,19 @@ class DBuser {
112112

113113
// Creates the user roles table
114114
async create_table_user_roles() {
115-
const client = await this.pool.connect();
115+
const client = await this.pool.connect();
116116
try {
117117
// if ((await this.check_table("user_roles")) == false) {
118118

119119
await client.query("BEGIN");
120-
const query = `CREATE TABLE user_roles (
121-
rid INTEGER PRIMARY KEY,
122-
userid BIGINT NOT NULL,
123-
role varchar(64),
124-
time_assigned TIMESTAMP
125-
)`;
126-
await client.query(query);
127-
await client.query("COMMIT");
128-
// } else {
129-
// console.log("Deleting create_user_roles_table");
130-
// await client.query("BEGIN");
131-
// const query = `DROP TABLE user_roles`;
132-
// await client.query(query);
133-
// await client.query("COMMIT");
134-
// }
120+
const query = `CREATE TABLE user_roles (
121+
rid INTEGER PRIMARY KEY,
122+
userid BIGINT NOT NULL,
123+
role varchar(64),
124+
time_assigned TIMESTAMP
125+
)`;
126+
await client.query(query);
127+
await client.query("COMMIT");
135128
} catch (ex) {
136129
console.log(`Something wrong happende:${ex}`);
137130
} finally {
@@ -259,7 +252,8 @@ class DBuser {
259252
let result = await client.query(query);
260253

261254
const count = result.rows[0]["max"] + 1;
262-
query = "INSERT INTO user_roles (RID, USERID, ROLE, TIME_ASSIGNED) VALUES ($1,$2,$3,NOW())";
255+
query =
256+
"INSERT INTO user_roles (RID, USERID, ROLE, TIME_ASSIGNED) VALUES ($1,$2,$3,NOW())";
263257
const values = [count, userid, role];
264258
result = await client.query(query, values);
265259

@@ -271,7 +265,7 @@ class DBuser {
271265
client.release();
272266
// console.log("Client released successfully.")
273267
}
274-
}
268+
}
275269

276270
// Removing a user role
277271
async remove_user_role(userid, role) {
@@ -467,23 +461,22 @@ class DBuser {
467461
const query = `
468462
SELECT * FROM user_roles WHERE time_assigned < NOW() - interval '1 year'
469463
`;
470-
464+
471465
const result = await client.query(query);
472466

473-
const old_roles = result.rows.map(row => ({
467+
const old_roles = result.rows.map((row) => ({
474468
role_name: row.role,
475-
userid: row.userid
469+
userid: row.userid,
476470
}));
477-
471+
478472
return old_roles;
479473
} catch (error) {
480474
console.error(error);
481-
return old_roles;
475+
return [];
482476
} finally {
483477
client.release();
484478
}
485479
}
486-
487480
}
488481

489482
module.exports = {

0 commit comments

Comments
 (0)