tango-app-api-store-builder 1.0.0-beta-65 → 1.0.0-beta-67
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
|
@@ -8,12 +8,12 @@ import * as storeFixtureService from '../service/storeFixture.service.js';
|
|
|
8
8
|
import * as fixtureShelfService from '../service/fixtureShelf.service.js';
|
|
9
9
|
import * as planoProductService from '../service/planoProduct.service.js';
|
|
10
10
|
import * as planoMappingService from '../service/planoMapping.service.js';
|
|
11
|
+
import * as planoTaskService from '../service/planoTask.service.js';
|
|
11
12
|
// import * as planoComplianceService from '../service/planoCompliance.service.js';
|
|
12
13
|
// import * as planoTaskComplianceService from '../service/planoTask.service.js';
|
|
13
14
|
// import * as planoQrConversionRequestService from '../service/planoQrConversionRequest.service.js';
|
|
14
15
|
import * as fixtureConfigService from '../service/fixtureConfig.service.js';
|
|
15
16
|
import mongoose from 'mongoose';
|
|
16
|
-
import model from 'tango-api-schema';
|
|
17
17
|
|
|
18
18
|
export async function getStoreNames( req, res ) {
|
|
19
19
|
try {
|
|
@@ -1760,82 +1760,14 @@ export async function getProdTaskData( req, res ) {
|
|
|
1760
1760
|
return res.sendError( 'Unauthorized', 401 );
|
|
1761
1761
|
}
|
|
1762
1762
|
|
|
1763
|
-
const db = mongoose.createConnection( 'mongodb+srv://tango-api-production:5TdxKKSkZiRVtjta@production.qc4rw.mongodb.net/tango-retail?authSource=admin', {
|
|
1764
|
-
useNewUrlParser: true,
|
|
1765
|
-
useUnifiedTopology: true,
|
|
1766
|
-
} );
|
|
1767
|
-
|
|
1768
|
-
const planoModel = db.model( 'planogram', model.planogramModel.schema );
|
|
1769
|
-
|
|
1770
|
-
const planoData = await planoModel.findOne( { storeName: req.body.store } );
|
|
1771
1763
|
|
|
1772
|
-
const
|
|
1764
|
+
const planoData = await planoService.findOne( { storeName: req.body.store } );
|
|
1773
1765
|
|
|
1774
|
-
let fixtureDetails = await
|
|
1766
|
+
let fixtureDetails = await planoTaskService.find( { planoId: planoData.toObject()._id, type: req.body.type } );
|
|
1775
1767
|
if ( !fixtureDetails ) {
|
|
1776
1768
|
return res.sendError( 'No data found', 204 );
|
|
1777
1769
|
}
|
|
1778
1770
|
|
|
1779
|
-
// for ( let i = 0; i < fixtureDetails.length; i++ ) {
|
|
1780
|
-
// const data = await Promise.all( fixtureDetails?.[i].answers.map( async ( ans ) => {
|
|
1781
|
-
// if ( ans?.correctedFixture?.length ) {
|
|
1782
|
-
// for ( let fixture of ans.correctedFixture ) {
|
|
1783
|
-
// if ( fixture.image ) {
|
|
1784
|
-
// let params = {
|
|
1785
|
-
// Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
1786
|
-
// file_path: fixture.image,
|
|
1787
|
-
// };
|
|
1788
|
-
// fixture.image = await signedUrl( params );
|
|
1789
|
-
// }
|
|
1790
|
-
// if ( fixture.video ) {
|
|
1791
|
-
// let params = {
|
|
1792
|
-
// Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
1793
|
-
// file_path: fixture.video,
|
|
1794
|
-
// };
|
|
1795
|
-
// fixture.video = await signedUrl( params );
|
|
1796
|
-
// }
|
|
1797
|
-
// }
|
|
1798
|
-
// }
|
|
1799
|
-
// if ( ans?.newVms?.length ) {
|
|
1800
|
-
// for ( let fixture of ans.newVms ) {
|
|
1801
|
-
// if ( fixture.imageUrl ) {
|
|
1802
|
-
// let params = {
|
|
1803
|
-
// Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
1804
|
-
// file_path: fixture.imageUrl,
|
|
1805
|
-
// };
|
|
1806
|
-
// fixture.imageUrl = await signedUrl( params );
|
|
1807
|
-
// }
|
|
1808
|
-
// if ( fixture.video ) {
|
|
1809
|
-
// let params = {
|
|
1810
|
-
// Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
1811
|
-
// file_path: fixture.video,
|
|
1812
|
-
// };
|
|
1813
|
-
// fixture.video = await signedUrl( params );
|
|
1814
|
-
// }
|
|
1815
|
-
// }
|
|
1816
|
-
// }
|
|
1817
|
-
// if ( ans.image ) {
|
|
1818
|
-
// let params = {
|
|
1819
|
-
// Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
1820
|
-
// file_path: ans.image,
|
|
1821
|
-
// };
|
|
1822
|
-
// let imageUrl = await signedUrl( params );
|
|
1823
|
-
// ans.image = imageUrl;
|
|
1824
|
-
// }
|
|
1825
|
-
// if ( ans.video ) {
|
|
1826
|
-
// let params = {
|
|
1827
|
-
// Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
1828
|
-
// file_path: ans.video,
|
|
1829
|
-
// };
|
|
1830
|
-
// let imageUrl = await signedUrl( params );
|
|
1831
|
-
// ans.video = imageUrl;
|
|
1832
|
-
// }
|
|
1833
|
-
// return ans;
|
|
1834
|
-
// } ) );
|
|
1835
|
-
// fixtureDetails[i].answers = data;
|
|
1836
|
-
// }
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
1771
|
return res.sendSuccess( fixtureDetails );
|
|
1840
1772
|
} catch ( e ) {
|
|
1841
1773
|
logger.error( { functionName: 'getProdTaskData', error: e } );
|
|
@@ -471,7 +471,7 @@ export async function updateAnswers( req, res ) {
|
|
|
471
471
|
type: req.body.type,
|
|
472
472
|
};
|
|
473
473
|
|
|
474
|
-
await planoTaskService.updateOne( { fixtureId: req.body.fixtureId, type: req.body.type }, data );
|
|
474
|
+
await planoTaskService.updateOne( { planoId: req.body.planoId, floorId: req.body.floorId, fixtureId: req.body.fixtureId, type: req.body.type, date_string: dayjs().format( 'YYYY-MM-DD' ) }, data );
|
|
475
475
|
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
476
476
|
} catch ( e ) {
|
|
477
477
|
logger.error( { functionName: 'updateAnswers', error: e } );
|
|
@@ -16,4 +16,4 @@ scriptRouter
|
|
|
16
16
|
.post( '/updateinventory', scriptController.updateInventory )
|
|
17
17
|
.post( '/updateRfidProduct', scriptController.updateRfidProduct )
|
|
18
18
|
.post( '/updateRfidProduct2', scriptController.updateRfidProduct2 )
|
|
19
|
-
.post('/getProdTaskData', scriptController.getProdTaskData );
|
|
19
|
+
.post( '/getProdTaskData', scriptController.getProdTaskData );
|
|
@@ -12,6 +12,10 @@ export async function findOne( query={}, field={} ) {
|
|
|
12
12
|
return model.planoTaskCompliance.findOne( query, field );
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export async function find( query={}, field={} ) {
|
|
16
|
+
return model.planoTaskCompliance.find( query, field );
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
export async function count( data ) {
|
|
16
20
|
return model.planoTaskCompliance.countDocuments( data );
|
|
17
21
|
}
|