- feat: remove unnecessary migrations, controllers and models files.

- feat: metable store
- feat: metable store with settings store.
- feat: settings middleware to auto-save and load.
- feat: DI db manager to master container.
- feat: write some logs to sale invoices.
This commit is contained in:
Ahmed Bouhuolia
2020-09-03 16:51:48 +02:00
parent abefba22ee
commit 9ee7ed89ec
98 changed files with 1697 additions and 2052 deletions

View File

@@ -10,7 +10,6 @@ const {
success,
log,
} = require('./utils');
const lincenseCommander = require('./license');
// - bigcapital system:migrate:latest
// - bigcapital system:migrate:rollback
@@ -21,9 +20,6 @@ const lincenseCommander = require('./license');
// - bigcapital tenants:migrate:make
// - bigcapital system:migrate:make
// - bigcapital tenants:list
//
// - bigcapital license:generate
// - bigcapital licenses:list
commander
.command('system:migrate:rollback')

View File

@@ -1,55 +0,0 @@
const commander = require('commander');
const color = require('colorette');
const argv = require('getopts')(process.argv.slice(2));
const cryptoRandomString = require('crypto-random-string');
const {
initSystemKnex,
getAllSystemTenants,
initTenantKnex,
exit,
success,
log,
} = require('./utils');
// License generate key.
commander
.command('license:generate <license_period>')
.description('Generates a new license key.')
.action(async (interval) => {
try {
const sysDb = initSystemKnex();
let repeat = true;
while(repeat) {
key = cryptoRandomString(16).toUpperCase();
const license = await sysDb('subscription_licenses').where('key', key);
if (license.length === 0) {
repeat = false;
}
}
const licenseIds = await sysDb('subscription_licenses').insert({
key,
license_period: interval ? parseInt(interval, 10) : 1,
license_interval: 'month',
});
const license = await sysDb('subscription_licenses').where('id', licenseIds[0]).first();
success(`ID: ${license.id} | License: ${license.key} | Interval: ${license.licenseInterval} | Period: ${license.licensePeriod}`);
} catch(error) {
exit(error);
}
});
// Retrieve licenses list.
commander
.command('licenses:list')
.description('Retrieve a list of subscription licenses.')
.action(async () => {
const sysDb = initSystemKnex();
const licenses = await sysDb('subscription_licenses');
licenses.forEach((license) => {
log(`ID: ${license.id} | Key: ${license.key} | Interval: ${license.licenseInterval} | Period: ${license.licensePeriod}`);
});
exit();
});