refactoring 1. step

This commit is contained in:
2026-03-02 10:09:24 -06:00
parent 198126c13e
commit 7226883a2e
18 changed files with 2915 additions and 2784 deletions

11
src/config/database.js Normal file
View File

@@ -0,0 +1,11 @@
const { Pool } = require('pg');
const pool = new Pool({
user: process.env.DB_USER || 'postgres',
host: process.env.DB_HOST || 'localhost',
database: process.env.DB_NAME || 'quotes_db',
password: process.env.DB_PASSWORD || 'postgres',
port: process.env.DB_PORT || 5432,
});
module.exports = { pool };

20
src/config/qbo.js Normal file
View File

@@ -0,0 +1,20 @@
const OAuthClient = require('intuit-oauth');
const { getOAuthClient: getClient, saveTokens, resetOAuthClient } = require('../../qbo_helper');
function getOAuthClient() {
return getClient();
}
function getQboBaseUrl() {
return process.env.QBO_ENVIRONMENT === 'production'
? 'https://quickbooks.api.intuit.com'
: 'https://sandbox-quickbooks.api.intuit.com';
}
module.exports = {
OAuthClient,
getOAuthClient,
getQboBaseUrl,
saveTokens,
resetOAuthClient
};