tango-app-api-trax 3.7.13-qid-halfshutter-9 → 3.7.13-qid-halfshutter-11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.7.13-qid-halfshutter-9",
3
+ "version": "3.7.13-qid-halfshutter-11",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "mongodb": "^6.8.0",
28
28
  "nodemon": "^3.1.4",
29
29
  "path": "^0.12.7",
30
- "tango-api-schema": "^2.4.11",
30
+ "tango-api-schema": "^2.4.15",
31
31
  "tango-app-api-middleware": "^3.5.2",
32
32
  "url": "^0.11.4",
33
33
  "winston": "^3.13.1",
@@ -2652,14 +2652,26 @@ export async function getRunAIList( req, res ) {
2652
2652
 
2653
2653
  export async function updateChecklistConfig( req, res ) {
2654
2654
  try {
2655
- let checklistDetails = await CLconfig.findOne( { _id: req.body.id } );
2656
- if ( !checklistDetails ) {
2657
- return res.sendError( 'No data found', 204 );
2658
- }
2659
- await CLconfig.updateOne( { _id: req.body.id }, req.body.data );
2655
+ if ( req.body.type == 'checklist' ) {
2656
+ let checklistDetails = await CLconfig.findOne( { _id: req.body.id } );
2657
+ if ( !checklistDetails ) {
2658
+ return res.sendError( 'No data found', 204 );
2659
+ }
2660
+ await CLconfig.updateOne( { _id: req.body.id }, req.body.data );
2661
+
2662
+ if ( req.body?.updateStore ) {
2663
+ await processedchecklist.updateMany( { date_string: dayjs().format( 'YYYY-MM-DD' ), sourceCheckList_id: req.body.id, ...( req.body.store?.length && { storeName: { $in: req.body.store } } ) }, req.body.data );
2664
+ }
2665
+ } else {
2666
+ let taskDetails = await taskService.findOne( { _id: req.body.id } );
2667
+ if ( !taskDetails ) {
2668
+ return res.sendError( 'No data found', 204 );
2669
+ }
2670
+ await taskService.updateOne( { _id: req.body.id }, req.body.data );
2660
2671
 
2661
- if ( req.body?.updateStore ) {
2662
- await processedchecklist.updateMany( { date_string: dayjs().format( 'YYYY-MM-DD' ), sourceCheckList_id: req.body.id, ...( req.body.store?.length && { storeName: { $in: req.body.store } } ) }, req.body.data );
2672
+ if ( req.body?.updateStore ) {
2673
+ await processedTaskService.updateMany( { date_string: dayjs().format( 'YYYY-MM-DD' ), sourceCheckList_id: req.body.id, ...( req.body.store?.length && { storeName: { $in: req.body.store } } ) }, req.body.data );
2674
+ }
2663
2675
  }
2664
2676
  return res.sendSuccess( 'updated successfully' );
2665
2677
  } catch ( e ) {