Skip to content

Commit

Permalink
refractor
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh Balyan committed Aug 6, 2024
1 parent 6900164 commit b280815
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 91 deletions.
2 changes: 1 addition & 1 deletion Routes/dev.unprotected.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createRequire } from 'module';
import passport from 'passport';
import swaggerUi from 'swagger-ui-express';
const require = createRequire(import.meta.url);
const swaggerFile = require('../swagger.json');
const swaggerFile = require('../Utils/Swagger/swagger.json');
// Swagger

const Router = express.Router();
Expand Down
2 changes: 1 addition & 1 deletion User/Controllers/auth.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import pkg from 'jsonwebtoken';

import errorConstants from '#constants/error.constant.js';
import successConstants from '#constants/success.contant.js';
import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';
// import { createBucket } from '#storage/Service/awsService.js';
import getError from '#utils/error.js';
// import { createToken, getTokenError } from '#utils/jwt.js';
Expand Down
2 changes: 1 addition & 1 deletion User/Controllers/superAdmin.controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import errorContstants from '#constants/error.constant.js';
import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';
import { deleteCustomer } from '#user/Service/database.service.js';
import { getCachedKeys } from '#utils/Cache/cache.service.js';
import cache from '#utils/Cache/index.js';
Expand Down
2 changes: 1 addition & 1 deletion User/Controllers/user.controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import successConstants from '#constants/success.contant.js';
import mongoose from 'mongoose';

import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';
/*
* import { s3, uploadFile } from '#storage/Service/awsService.js';
*/
Expand Down
2 changes: 1 addition & 1 deletion User/Seed/superadmin.seed.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';

const seedSuperAdmin = async () => {
const conn = await getTenantDB();
Expand Down
2 changes: 1 addition & 1 deletion User/Service/database.service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import errorContstants from '#constants/error.constant.js';
import { getTenantDB, removeTenantDB } from '#root/mongo.connection.js';
import { getTenantDB, removeTenantDB } from '#utils/Database/mongo.connection.js';
// import { deleteBucket } from '#storage/Service/awsService.js';

const deleteCustomer = async (tenant) => {
Expand Down
2 changes: 1 addition & 1 deletion User/Service/user.service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import errorContstants from '#constants/error.constant.js';
import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';
import cache from '#utils/Cache/index.js';
import { createToken } from '#utils/jwt.js';

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Utils/Middlewares/default.middleware.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';

const defaultMiddleware = () => async (req, _res, next) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion Utils/Middlewares/jwt.middleware.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pkg from 'jsonwebtoken';

import errorContstants from '#constants/error.constant.js';
import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';
import cache from '#utils/Cache/index.js';
import getError from '#utils/error.js';

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import helmet from 'helmet';

import defaultMiddleware from '#middlewares/default.middleware.js';
import { setupCors, setupErrorInterceptor, setupRateLimiter, setupResponseInterceptor, setupTimeout, setupValidationErrorInterceptor } from '#middlewares/server.middleware.js';
import { getTenantDB } from '#root/mongo.connection.js';
import { getTenantDB } from '#utils/Database/mongo.connection.js';
import seedSuperAdmin from '#user/Seed/superadmin.seed.js';
import morgalApiLogger from '#utils/Logger/api.logger.js';
import overrideConsole from '#utils/Logger/console.logger.js';
Expand Down
162 changes: 81 additions & 81 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
{
"name": "startex",
"version": "2.1",
"description": "now with mongo",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node --env-file=env/.env --env-file=env/.env.database --env-file=env/.env.logger --env-file=env/.env.server --env-file=env/.env.token --env-file=env/.env.mailer --env-file=env/.env.passport --no-warnings --trace-warnings --experimental-permission --allow-child-process --allow-fs-read=/ --watch index.js",
"swagger": "node swagger.js",
"lint": "eslint . --quiet --cache --cache-location=node_modules/.cache/eslint",
"lint-fix": "eslint . --fix",
"clean": "rimraf node_modules && npm install",
"test": "node Test/Api/index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@aws-sdk/client-s3": "^3.360.0",
"@aws-sdk/lib-storage": "^3.620.1",
"@hapi/joi": "^17.1.1",
"axios": "^1.7.3",
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.0",
"chalk": "^5.3.0",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"express": "^4.18.1",
"express-fileupload": "^1.4.0",
"express-rate-limit": "^7.1.5",
"express-validation": "^4.1.1",
"helmet": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21",
"mongoose": "^8.5.2",
"morgan-body": "^2.6.8",
"node-cache": "^5.1.2",
"nodemailer": "^6.9.14",
"passport": "^0.7.0",
"passport-github2": "^0.1.12",
"passport-google-oauth20": "^2.0.0",
"passport-http": "^0.3.0",
"passport-linkedin-oauth2": "^2.0.0",
"passport-microsoft": "^2.1.0",
"swagger-autogen": "^2.23.7",
"swagger-ui-express": "^5.0.1"
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-autofix": "^2.1.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-eqeqeq-fix": "^1.0.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-redux": "^4.1.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonar": "^0.14.1",
"eslint-plugin-sonarjs": "^0.25.1",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unused-imports": "^3.1.0"
},
"overrides": {
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.0.0"
},
"imports": {
"#validations/*": "./Utils/Validations/*",
"#middlewares/*": "./Utils/Middlewares/*",
"#constants/*": "./Utils/Constants/*",
"#utils/*": "./Utils/*",
"#storage/*": "./Storage/*",
"#user/*": "./User/*",
"#project/*": "./Project/*",
"#controllers/*": "./Controllers/*",
"#routes/*": "./Routes/*",
"#encryption/*": "./Encryption/*",
"#scheduler/*": "./Scheduler/*",
"#root/*": "./*"
}
"name": "startex",
"version": "2.1",
"description": "now with mongo",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node --env-file=env/.env --env-file=env/.env.database --env-file=env/.env.logger --env-file=env/.env.server --env-file=env/.env.token --env-file=env/.env.mailer --env-file=env/.env.passport --no-warnings --trace-warnings --experimental-permission --allow-child-process --allow-fs-read=/ --watch index.js",
"swagger": "node ./Utils/Swagger/swagger.js",
"lint": "eslint . --quiet --cache --cache-location=node_modules/.cache/eslint",
"lint-fix": "eslint . --fix",
"clean": "rimraf node_modules && npm install",
"test": "node Test/Api/index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@aws-sdk/client-s3": "^3.360.0",
"@aws-sdk/lib-storage": "^3.620.1",
"@hapi/joi": "^17.1.1",
"axios": "^1.7.3",
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.0",
"chalk": "^5.3.0",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"express": "^4.18.1",
"express-fileupload": "^1.4.0",
"express-rate-limit": "^7.1.5",
"express-validation": "^4.1.1",
"helmet": "^7.1.0",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21",
"mongoose": "^8.5.2",
"morgan-body": "^2.6.8",
"node-cache": "^5.1.2",
"nodemailer": "^6.9.14",
"passport": "^0.7.0",
"passport-github2": "^0.1.12",
"passport-google-oauth20": "^2.0.0",
"passport-http": "^0.3.0",
"passport-linkedin-oauth2": "^2.0.0",
"passport-microsoft": "^2.1.0",
"swagger-autogen": "^2.23.7",
"swagger-ui-express": "^5.0.1"
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-autofix": "^2.1.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-eqeqeq-fix": "^1.0.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-redux": "^4.1.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonar": "^0.14.1",
"eslint-plugin-sonarjs": "^0.25.1",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unused-imports": "^3.1.0"
},
"overrides": {
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.0.0"
},
"imports": {
"#validations/*": "./Utils/Validations/*",
"#middlewares/*": "./Utils/Middlewares/*",
"#constants/*": "./Utils/Constants/*",
"#utils/*": "./Utils/*",
"#storage/*": "./Storage/*",
"#user/*": "./User/*",
"#project/*": "./Project/*",
"#controllers/*": "./Controllers/*",
"#routes/*": "./Routes/*",
"#encryption/*": "./Encryption/*",
"#scheduler/*": "./Scheduler/*",
"#root/*": "./*"
}
}

0 comments on commit b280815

Please sign in to comment.