[feat] Remove unuse code
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
const knex = require('knex');
|
||||
const config = require('src/config/index.js');
|
||||
|
||||
const pool = knex({
|
||||
client: 'pg',
|
||||
connection: {
|
||||
user: config.database.user,
|
||||
password: config.database.password,
|
||||
host: config.database.host,
|
||||
port: config.database.port,
|
||||
database: config.database.dbname,
|
||||
},
|
||||
pool: {
|
||||
max: config.database.pool_max,
|
||||
min: config.database.pool_min,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = pool;
|
||||
@@ -122,45 +122,3 @@ mod.selectObject = (obj, param) => {
|
||||
|
||||
return newObj;
|
||||
};
|
||||
|
||||
/**
|
||||
* pad string to target length
|
||||
* @param {any} v source input
|
||||
* @param {number} len target length
|
||||
* @param {number} direct pad direct (-1 left, 1 right)
|
||||
* @param {string} padChar default '0'
|
||||
* @return {string}
|
||||
*/
|
||||
mod.pad = (v, len = 0, direct = -1, padChar = '0') => {
|
||||
if (v === null || v === undefined) return '';
|
||||
if (typeof v !== 'string' && !v.toString) return '';
|
||||
if (direct !== 1 && direct !== -1) return '';
|
||||
if (typeof v !== 'string') v = v.toString();
|
||||
if (typeof padChar !== 'string') padChar = '0';
|
||||
len = mod.toNumber(len, 0, 0);
|
||||
if (v.length < len) {
|
||||
if (direct < 0) v = `${padChar}${v}`;
|
||||
else v = `${v}${padChar}`;
|
||||
return mod.pad(v, len, direct, padChar);
|
||||
}
|
||||
|
||||
return v;
|
||||
};
|
||||
|
||||
/**
|
||||
* pad left
|
||||
* @param {any} v
|
||||
* @param {number} len
|
||||
* @param {string} padChar
|
||||
* @return {string}
|
||||
*/
|
||||
mod.padLeft = (v, len = 0, padChar = '0') => mod.pad(v, len, -1, padChar);
|
||||
|
||||
/**
|
||||
* pad right
|
||||
* @param {any} v
|
||||
* @param {number} len
|
||||
* @param {string} padChar
|
||||
* @return {string}
|
||||
*/
|
||||
mod.padRight = (v, len = 0, padChar = '0') => mod.pad(v, len, 1, padChar);
|
||||
|
||||
@@ -117,8 +117,6 @@ mod.getToken = async (code, state) => {
|
||||
|
||||
const decoded = jwt.decode(idToken);
|
||||
if (!decoded || typeof decoded !== 'object') throw new Error('jwt decode fail');
|
||||
console.log('decoded ::: ', decoded)
|
||||
console.log('body ::: ', body)
|
||||
// @ts-ignore
|
||||
const { preferred_username: preferredUsername } = decoded;
|
||||
if (!preferredUsername) throw new Error('id token field missing');
|
||||
|
||||
Reference in New Issue
Block a user