Hopefully formatted correctly

This commit is contained in:
Bryan Ashby 2023-01-06 13:52:33 -07:00
parent 848044bec6
commit 7380ef571a
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
1 changed files with 20 additions and 20 deletions

View File

@ -572,7 +572,7 @@ module.exports = class User {
static persistPropertyByUserId(userId, propName, propValue, cb) { static persistPropertyByUserId(userId, propName, propValue, cb) {
userDb.run( userDb.run(
`REPLACE INTO user_property (user_id, prop_name, prop_value) `REPLACE INTO user_property (user_id, prop_name, prop_value)
VALUES (?, ?, ?);`, VALUES (?, ?, ?);`,
[userId, propName, propValue], [userId, propName, propValue],
err => { err => {
if (cb) { if (cb) {
@ -619,7 +619,7 @@ module.exports = class User {
userDb.run( userDb.run(
`DELETE FROM user_property `DELETE FROM user_property
WHERE user_id = ? AND prop_name = ?;`, WHERE user_id = ? AND prop_name = ?;`,
[this.userId, propName], [this.userId, propName],
err => { err => {
if (cb) { if (cb) {
@ -680,7 +680,7 @@ module.exports = class User {
const stmt = transOrDb.prepare( const stmt = transOrDb.prepare(
`REPLACE INTO user_property (user_id, prop_name, prop_value) `REPLACE INTO user_property (user_id, prop_name, prop_value)
VALUES (?, ?, ?);` VALUES (?, ?, ?);`
); );
async.each( async.each(
@ -809,8 +809,8 @@ module.exports = class User {
static getUserIdAndName(username, cb) { static getUserIdAndName(username, cb) {
userDb.get( userDb.get(
`SELECT id, user_name `SELECT id, user_name
FROM user FROM user
WHERE user_name LIKE ?;`, WHERE user_name LIKE ?;`,
[username], [username],
(err, row) => { (err, row) => {
if (err) { if (err) {
@ -829,12 +829,12 @@ module.exports = class User {
static getUserIdAndNameByRealName(realName, cb) { static getUserIdAndNameByRealName(realName, cb) {
userDb.get( userDb.get(
`SELECT id, user_name `SELECT id, user_name
FROM user FROM user
WHERE id = ( WHERE id = (
SELECT user_id SELECT user_id
FROM user_property FROM user_property
WHERE prop_name='${UserProps.RealName}' AND prop_value LIKE ? WHERE prop_name='${UserProps.RealName}' AND prop_value LIKE ?
);`, );`,
[realName], [realName],
(err, row) => { (err, row) => {
if (err) { if (err) {
@ -865,8 +865,8 @@ module.exports = class User {
static getUserName(userId, cb) { static getUserName(userId, cb) {
userDb.get( userDb.get(
`SELECT user_name `SELECT user_name
FROM user FROM user
WHERE id = ?;`, WHERE id = ?;`,
[userId], [userId],
(err, row) => { (err, row) => {
if (err) { if (err) {
@ -889,8 +889,8 @@ module.exports = class User {
} }
let sql = `SELECT prop_name, prop_value let sql = `SELECT prop_name, prop_value
FROM user_property FROM user_property
WHERE user_id = ?`; WHERE user_id = ?`;
if (options.names) { if (options.names) {
sql += ` AND prop_name IN("${options.names.join('","')}");`; sql += ` AND prop_name IN("${options.names.join('","')}");`;
@ -920,8 +920,8 @@ module.exports = class User {
userDb.each( userDb.each(
`SELECT user_id `SELECT user_id
FROM user_property FROM user_property
WHERE prop_name = ? AND prop_value = ?;`, WHERE prop_name = ? AND prop_value = ?;`,
[propName, propValue], [propName, propValue],
(err, row) => { (err, row) => {
if (row) { if (row) {
@ -937,7 +937,7 @@ module.exports = class User {
static getUserCount(cb) { static getUserCount(cb) {
userDb.get( userDb.get(
`SELECT count() AS user_count `SELECT count() AS user_count
FROM user;`, FROM user;`,
(err, row) => { (err, row) => {
if (err) { if (err) {
return cb(err); return cb(err);
@ -965,8 +965,8 @@ module.exports = class User {
userDb.each( userDb.each(
`SELECT u.id as userId, u.user_name as userName, ${asList.join(', ')} `SELECT u.id as userId, u.user_name as userName, ${asList.join(', ')}
FROM user u ${joinList.join(' ')} FROM user u ${joinList.join(' ')}
ORDER BY u.user_name;`, ORDER BY u.user_name;`,
(err, row) => { (err, row) => {
if (err) { if (err) {
return cb(err); return cb(err);