tango-app-api-infra 3.0.20-dev → 3.0.21-dev

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/app.js ADDED
@@ -0,0 +1,42 @@
1
+
2
+ import express from 'express';
3
+ import { infraRouter, internalInfraRouter, userInfraRouter, storeInfraRouter, clientInfraRouter } from './index.js';
4
+ import dotenv from 'dotenv';
5
+ import responseMiddleware from './config/response/response.js';
6
+ import errorMiddleware from './config/response/error.js';
7
+ import { connectdb } from './config/database/database.js';
8
+ import pkg from 'body-parser';
9
+ import cors from 'cors';
10
+ const { json, urlencoded } = pkg;
11
+ import fileUpload from 'express-fileupload';
12
+ const env=dotenv.config();
13
+
14
+ const app = express();
15
+ const PORT = process.env.PORT || 3000;
16
+ app.use( fileUpload() );
17
+
18
+ if ( env.error ) {
19
+ logger.error( '.env not found' );
20
+ process.exit( 1 );
21
+ }
22
+ app.use( json( { limit: '500mb' } ) );
23
+ app.use(
24
+ urlencoded( {
25
+ extended: true,
26
+ } ),
27
+ );
28
+ app.use( cors() );
29
+ app.use( responseMiddleware );
30
+ app.use( errorMiddleware );
31
+ app.use( '/infra', infraRouter );
32
+ app.use( '/internalInfra', internalInfraRouter );
33
+ app.use( '/userInfra', userInfraRouter );
34
+ app.use( '/storeInfra', storeInfraRouter );
35
+ app.use( '/clientInfra', clientInfraRouter );
36
+
37
+
38
+ app.listen( PORT, () => {
39
+ console.log( `server is running on port= ${PORT} ` );
40
+ connectdb();
41
+ } );
42
+
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-infra",
3
- "version": "3.0.20-dev",
3
+ "version": "3.0.21-dev",
4
4
  "description": "infra",
5
- "main": "index.js",
5
+ "main": "app.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node index.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node app.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -402,6 +402,7 @@ export async function storeInfraList( req, res ) {
402
402
  {
403
403
  $group: {
404
404
  _id: '$storeId',
405
+ store: { $first: '$_id' },
405
406
  storeId: { $first: '$storeId' },
406
407
  storeName: { $first: '$storeName' },
407
408
  status: { $first: '$status' },