tango-app-api-task 3.2.1-beta-6 → 3.2.1-beta-8
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 +46 -0
- package/package.json +3 -3
- package/src/controllers/task.controller.js +5 -5
package/app.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { taskRouter, taskDashboardRouter, taskActionCenterRouter } from './index.js';
|
|
3
|
+
|
|
4
|
+
import dotenv from 'dotenv';
|
|
5
|
+
import pkg from 'body-parser';
|
|
6
|
+
const { json, urlencoded } = pkg;
|
|
7
|
+
import fileupload from 'express-fileupload';
|
|
8
|
+
import { logger } from 'tango-app-api-middleware';
|
|
9
|
+
import { connectdb } from './config/database/database.js';
|
|
10
|
+
import responseMiddleware from './config/response/response.js';
|
|
11
|
+
import errorMiddleware from './config/response/error.js';
|
|
12
|
+
import cors from 'cors';
|
|
13
|
+
|
|
14
|
+
const env=dotenv.config();
|
|
15
|
+
|
|
16
|
+
const app = express();
|
|
17
|
+
const PORT = process.env.PORT || 3000;
|
|
18
|
+
app.use( cors() );
|
|
19
|
+
|
|
20
|
+
app.use( fileupload() );
|
|
21
|
+
|
|
22
|
+
if ( env.error ) {
|
|
23
|
+
logger.error( '.env not found' );
|
|
24
|
+
process.exit( 1 );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
app.use( json( { limit: '500mb' } ) );
|
|
28
|
+
app.use(
|
|
29
|
+
urlencoded( {
|
|
30
|
+
extended: true,
|
|
31
|
+
} ),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
app.use( responseMiddleware );
|
|
35
|
+
app.use( errorMiddleware );
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
app.use( '/task', taskRouter );
|
|
39
|
+
app.use( '/task/dashboard', taskDashboardRouter );
|
|
40
|
+
app.use( '/task/actionCenter', taskActionCenterRouter );
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
app.listen( PORT, () => {
|
|
44
|
+
console.log( `server is running on port= ${PORT} ` );
|
|
45
|
+
connectdb();
|
|
46
|
+
} );
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-task",
|
|
3
|
-
"version": "3.2.1-beta-
|
|
3
|
+
"version": "3.2.1-beta-8",
|
|
4
4
|
"description": "Task",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "app.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -1389,7 +1389,7 @@ export async function createChecklistTask( req, res ) {
|
|
|
1389
1389
|
return res.sendError( 'section is not found', 400 );
|
|
1390
1390
|
}
|
|
1391
1391
|
let data = { ...question[sectionIndex].questions[req.body.qno - 1], taskId: response?._id, task: true };
|
|
1392
|
-
|
|
1392
|
+
|
|
1393
1393
|
question[sectionIndex].questions[req.body.qno - 1] = data;
|
|
1394
1394
|
taskDetails.questionAnswers = question;
|
|
1395
1395
|
let updateData = {
|
|
@@ -1410,7 +1410,7 @@ export async function createChecklistTask( req, res ) {
|
|
|
1410
1410
|
taskDate: dayjs( response.scheduleDate ).format( 'YYYY-MM-DD' ),
|
|
1411
1411
|
},
|
|
1412
1412
|
};
|
|
1413
|
-
|
|
1413
|
+
|
|
1414
1414
|
const requestOptions = {
|
|
1415
1415
|
method: 'POST',
|
|
1416
1416
|
headers: {
|
|
@@ -2320,6 +2320,7 @@ export async function createAiTask( req, res ) {
|
|
|
2320
2320
|
return res.sendError( 'Store Not Found', 500 );
|
|
2321
2321
|
}
|
|
2322
2322
|
let finduser= await checklistassignconfigModel.findOne( { checkListId: new mongoose.Types.ObjectId( '66b06fe789807eafd9e9c0f9' ), store_id: storeDetails.storeId } );
|
|
2323
|
+
console.log( finduser );
|
|
2323
2324
|
if ( !finduser ) {
|
|
2324
2325
|
return res.sendError( 'No user Found For this store', 500 );
|
|
2325
2326
|
}
|
|
@@ -2423,7 +2424,7 @@ export async function createAiTask( req, res ) {
|
|
|
2423
2424
|
'descriptivetype': 'text',
|
|
2424
2425
|
},
|
|
2425
2426
|
];
|
|
2426
|
-
|
|
2427
|
+
|
|
2427
2428
|
|
|
2428
2429
|
if ( req.files&& req.files.referenceImage&&req.files.referenceImage.length ) {
|
|
2429
2430
|
let images = [];
|
|
@@ -2439,7 +2440,6 @@ export async function createAiTask( req, res ) {
|
|
|
2439
2440
|
}
|
|
2440
2441
|
question[0].questionReferenceImage = images;
|
|
2441
2442
|
}
|
|
2442
|
-
console.log( '----->', answer );
|
|
2443
2443
|
if ( inputBody?.answerType === 'image'||inputBody?.answerType === 'descriptiveImage'||inputBody?.answerType === 'multipleImage' ) {
|
|
2444
2444
|
answer[0].referenceImage = question[0].questionReferenceImage;
|
|
2445
2445
|
}
|
|
@@ -2481,7 +2481,7 @@ async function findAnswer( type ) {
|
|
|
2481
2481
|
let answer = [];
|
|
2482
2482
|
|
|
2483
2483
|
switch ( type ) {
|
|
2484
|
-
case 'yes/
|
|
2484
|
+
case 'yes/no':
|
|
2485
2485
|
answer = [
|
|
2486
2486
|
{
|
|
2487
2487
|
'answer': 'Yes',
|