tango-app-api-store-builder 1.0.0-beta-64 → 1.0.0-beta-65
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
|
@@ -13,7 +13,7 @@ import * as planoMappingService from '../service/planoMapping.service.js';
|
|
|
13
13
|
// import * as planoQrConversionRequestService from '../service/planoQrConversionRequest.service.js';
|
|
14
14
|
import * as fixtureConfigService from '../service/fixtureConfig.service.js';
|
|
15
15
|
import mongoose from 'mongoose';
|
|
16
|
-
|
|
16
|
+
import model from 'tango-api-schema';
|
|
17
17
|
|
|
18
18
|
export async function getStoreNames( req, res ) {
|
|
19
19
|
try {
|
|
@@ -151,9 +151,9 @@ export async function createPlano( req, res ) {
|
|
|
151
151
|
scanType: 'qr',
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
-
await planoService.create( planoInsertData );
|
|
155
|
-
|
|
156
154
|
console.log( planoInsertData );
|
|
155
|
+
|
|
156
|
+
await planoService.create( planoInsertData );
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
return res.sendSuccess( { message: 'Plano data inserted successfully', length: storeNamesArray.length } );
|
|
@@ -1753,3 +1753,92 @@ export async function updateRfidProduct2( req, res ) {
|
|
|
1753
1753
|
return res.sendError( e.message || 'Internal Server Error', 500 );
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
+
|
|
1757
|
+
export async function getProdTaskData( req, res ) {
|
|
1758
|
+
try {
|
|
1759
|
+
if ( req?.headers?.authorization?.split( ' ' )[1] !== 'hwjXfCD6TgMvc82cuSGZ9bNv9MuXsaiQ6uvx' ) {
|
|
1760
|
+
return res.sendError( 'Unauthorized', 401 );
|
|
1761
|
+
}
|
|
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
|
+
|
|
1772
|
+
const planoTaskModel = db.model( 'planotaskcompliance', model.planoTaskCompliance.schema );
|
|
1773
|
+
|
|
1774
|
+
let fixtureDetails = await planoTaskModel.find( { planoId: planoData.toObject()._id, type: req.body.type } );
|
|
1775
|
+
if ( !fixtureDetails ) {
|
|
1776
|
+
return res.sendError( 'No data found', 204 );
|
|
1777
|
+
}
|
|
1778
|
+
|
|
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
|
+
return res.sendSuccess( fixtureDetails );
|
|
1840
|
+
} catch ( e ) {
|
|
1841
|
+
logger.error( { functionName: 'getProdTaskData', error: e } );
|
|
1842
|
+
return res.sendError( e.message || 'Internal Server Error', 500 );
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
@@ -15,4 +15,5 @@ scriptRouter
|
|
|
15
15
|
.post( '/lk98lK1993Update', scriptController.lk98lK1993Update )
|
|
16
16
|
.post( '/updateinventory', scriptController.updateInventory )
|
|
17
17
|
.post( '/updateRfidProduct', scriptController.updateRfidProduct )
|
|
18
|
-
.post( '/updateRfidProduct2', scriptController.updateRfidProduct2 )
|
|
18
|
+
.post( '/updateRfidProduct2', scriptController.updateRfidProduct2 )
|
|
19
|
+
.post('/getProdTaskData', scriptController.getProdTaskData );
|