@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 CHANGED
@@ -1,5 +1,4 @@
1
- require('module-alias/register')
2
- const { start: fastifyStart } = require('@root/libraries/fastify');
1
+ const { start: fastifyStart } = require('./libraries/fastify');
3
2
 
4
3
  module.exports = {
5
4
  fastifyStart
@@ -1,7 +1,4 @@
1
- require('module-alias/register')
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
@@ -1,6 +1,6 @@
1
1
  const knex = require('knex');
2
2
 
3
- const config = require('@root/config/database');
3
+ const config = require('../config/database');
4
4
 
5
5
  const db = knex(config[process.env.NODE_ENV || 'development']);
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecopex/ecopex-framework",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Javascript Framework for API and Admin Panel",
5
5
  "main": "ecosystem.config.js",
6
6
  "scripts": {
package/stores/base.js CHANGED
@@ -1,4 +1,4 @@
1
- const knex = require('@root/libraries/knex');
1
+ const knex = require('../libraries/knex');
2
2
 
3
3
  module.exports = class StoreModel {
4
4
  constructor(name = 'store_model', primary_key = 'id', schema = {}) {
@@ -1,8 +1,8 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
- const handlers = require('@root/routes/auto/handler');
4
- const general = require('@root/libraries/general');
5
- const { add_model } = require('@root/stores');
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
@@ -1,5 +1,5 @@
1
1
  const i18n = require('./i18n');
2
- const db = require('@root/libraries/knex');
2
+ const db = require('../libraries/knex');
3
3
  /**
4
4
  * Middleware utilities for Fastify
5
5
  */
@@ -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('@root/libraries/general');
4
+ const general = require('../libraries/general');
5
5
 
6
6
  /**
7
7
  * Automatically loads routes from the routes directory
@@ -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();