@ecopex/ecopex-framework 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -2
- package/libraries/fastify.js +1 -7
- package/libraries/knex.js +1 -1
- package/package.json +1 -1
- package/stores/base.js +1 -1
- package/utils/jsonRouteLoader.js +3 -3
- package/utils/middleware.js +1 -1
- package/utils/routeLoader.js +1 -1
- package/libraries/stores.js +0 -22
package/index.js
CHANGED
package/libraries/fastify.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
require('
|
|
2
|
-
require('dotenv').config();
|
|
3
|
-
|
|
4
|
-
const Store = require('@root/libraries/stores');
|
|
1
|
+
require('dotenv').config();
|
|
5
2
|
|
|
6
3
|
const fastify = require('fastify')({
|
|
7
4
|
logger: {
|
|
@@ -78,9 +75,6 @@ async function loadAdminRoutes() {
|
|
|
78
75
|
async function start() {
|
|
79
76
|
try {
|
|
80
77
|
|
|
81
|
-
// Initialize Store
|
|
82
|
-
await Store.init();
|
|
83
|
-
|
|
84
78
|
// Register plugins
|
|
85
79
|
await registerPlugins();
|
|
86
80
|
|
package/libraries/knex.js
CHANGED
package/package.json
CHANGED
package/stores/base.js
CHANGED
package/utils/jsonRouteLoader.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const handlers = require('
|
|
4
|
-
const general = require('
|
|
5
|
-
const { add_model } = require('
|
|
3
|
+
const handlers = require('../routes/auto/handler');
|
|
4
|
+
const general = require('../libraries/general');
|
|
5
|
+
const { add_model } = require('../stores');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* JSON Route Loader
|
package/utils/middleware.js
CHANGED
package/utils/routeLoader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const JsonRouteLoader = require('./jsonRouteLoader');
|
|
4
|
-
const general = require('
|
|
4
|
+
const general = require('../libraries/general');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Automatically loads routes from the routes directory
|
package/libraries/stores.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const db = require('@root/libraries/knex');
|
|
2
|
-
|
|
3
|
-
class Store {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.db = db;
|
|
6
|
-
this.currencies = new Map();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
async init() {
|
|
10
|
-
await this.get_currencies();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async get_currencies() {
|
|
14
|
-
const currencies = await this.db('currencies').select('currency_id', 'name', 'code', 'symbol');
|
|
15
|
-
currencies.forEach(currency => {
|
|
16
|
-
this.currencies.set(currency.currency_id, currency);
|
|
17
|
-
});
|
|
18
|
-
return this.currencies;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = new Store();
|