tango-app-api-store-builder 1.0.0-beta-35 → 1.0.0-beta-37
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
|
@@ -541,10 +541,17 @@ export async function storeFixtures( req, res ) {
|
|
|
541
541
|
|
|
542
542
|
export async function storeFixturesv1( req, res ) {
|
|
543
543
|
try {
|
|
544
|
-
const planoIds = req.body.id
|
|
544
|
+
const planoIds = req.body.id
|
|
545
|
+
.filter( ( id ) => mongoose.Types.ObjectId.isValid( id ) )
|
|
546
|
+
.map( ( id ) => new mongoose.Types.ObjectId( id ) );
|
|
545
547
|
|
|
546
548
|
const planograms = await planoService.find(
|
|
547
|
-
{
|
|
549
|
+
{
|
|
550
|
+
$or: [
|
|
551
|
+
{ _id: { $in: planoIds } },
|
|
552
|
+
{ storeId: { $in: req.body.id } },
|
|
553
|
+
],
|
|
554
|
+
},
|
|
548
555
|
{ storeId: 1, storeName: 1, planoId: '$_id', productResolutionLevel: 1, scanType: 1 },
|
|
549
556
|
);
|
|
550
557
|
|
|
@@ -607,9 +614,19 @@ export async function storeFixturesv1( req, res ) {
|
|
|
607
614
|
} ),
|
|
608
615
|
);
|
|
609
616
|
|
|
617
|
+
let fixtureStatus;
|
|
618
|
+
|
|
619
|
+
const cvProcessStatus = await planoQrConversionRequestService.count( { fixtureId: fixture._id, date: currentDate, status: 'initiated' } );
|
|
620
|
+
|
|
621
|
+
if ( cvProcessStatus ) {
|
|
622
|
+
fixtureStatus = 'inprogress';
|
|
623
|
+
} else {
|
|
624
|
+
fixtureStatus = complianceCount === 0 ? '' : complianceCount === productCount ? 'complete' : 'incomplete';
|
|
625
|
+
}
|
|
626
|
+
|
|
610
627
|
return {
|
|
611
628
|
...fixture.toObject(),
|
|
612
|
-
status:
|
|
629
|
+
status: fixtureStatus,
|
|
613
630
|
shelfCount: shelves.length,
|
|
614
631
|
productCount: productCount,
|
|
615
632
|
vmCount: vmCount,
|
|
@@ -675,9 +692,19 @@ export async function storeFixturesv1( req, res ) {
|
|
|
675
692
|
} ),
|
|
676
693
|
);
|
|
677
694
|
|
|
695
|
+
let fixtureStatus;
|
|
696
|
+
|
|
697
|
+
const cvProcessStatus = await planoQrConversionRequestService.count( { fixtureId: fixture._id, date: currentDate, status: 'initiated' } );
|
|
698
|
+
|
|
699
|
+
if ( cvProcessStatus ) {
|
|
700
|
+
fixtureStatus = 'inprogress';
|
|
701
|
+
} else {
|
|
702
|
+
fixtureStatus = complianceCount === 0 ? '' : complianceCount === productCount ? 'complete' : 'incomplete';
|
|
703
|
+
}
|
|
704
|
+
|
|
678
705
|
return {
|
|
679
706
|
...fixture.toObject(),
|
|
680
|
-
status:
|
|
707
|
+
status: fixtureStatus,
|
|
681
708
|
shelfCount: shelves.shelves,
|
|
682
709
|
productCount: productCount,
|
|
683
710
|
vmCount: vmCount,
|
|
@@ -1901,10 +1928,17 @@ export const uploadImage = async ( req, res ) => {
|
|
|
1901
1928
|
|
|
1902
1929
|
export async function storeFixturesTask( req, res ) {
|
|
1903
1930
|
try {
|
|
1904
|
-
const planoIds = req.body.id
|
|
1931
|
+
const planoIds = req.body.id
|
|
1932
|
+
.filter( ( id ) => mongoose.Types.ObjectId.isValid( id ) )
|
|
1933
|
+
.map( ( id ) => new mongoose.Types.ObjectId( id ) );
|
|
1905
1934
|
|
|
1906
1935
|
const planograms = await planoService.find(
|
|
1907
|
-
{
|
|
1936
|
+
{
|
|
1937
|
+
$or: [
|
|
1938
|
+
{ _id: { $in: planoIds } },
|
|
1939
|
+
{ storeId: { $in: req.body.id } },
|
|
1940
|
+
],
|
|
1941
|
+
},
|
|
1908
1942
|
{ storeId: 1, storeName: 1, planoId: '$_id', productResolutionLevel: 1, scanType: 1 },
|
|
1909
1943
|
);
|
|
1910
1944
|
|
|
@@ -2106,7 +2140,7 @@ export const qrFileUpload = async ( req, res ) => {
|
|
|
2106
2140
|
let uploadPath;
|
|
2107
2141
|
|
|
2108
2142
|
if ( type === 'video' ) {
|
|
2109
|
-
uploadPath = `
|
|
2143
|
+
uploadPath = `planoQrFixtureVideos/${dayjs().format( 'YYYY-MM-DD' )}/${fixture.toObject().storeId}`;
|
|
2110
2144
|
} else if ( type === 'image' ) {
|
|
2111
2145
|
uploadPath = `planoQrFixtureImages/${dayjs().format( 'YYYY-MM-DD' )}/${fixture.toObject().storeId}`;
|
|
2112
2146
|
}
|
|
@@ -2121,7 +2155,13 @@ export const qrFileUpload = async ( req, res ) => {
|
|
|
2121
2155
|
|
|
2122
2156
|
const fileUrl = await fileUpload( params );
|
|
2123
2157
|
|
|
2124
|
-
|
|
2158
|
+
const signedParams = {
|
|
2159
|
+
Bucket: bucket.storeBuilder,
|
|
2160
|
+
file_path: fileUrl.Key,
|
|
2161
|
+
};
|
|
2162
|
+
const signedKey = await signedUrl( signedParams );
|
|
2163
|
+
|
|
2164
|
+
res.sendSuccess( signedKey );
|
|
2125
2165
|
} catch ( error ) {
|
|
2126
2166
|
logger.error( 'fixtureQrUpdate =>', error );
|
|
2127
2167
|
return res.sendError( { message: 'Internal Server Error' }, 500 );
|
|
@@ -2179,11 +2219,11 @@ export const updateQrCvProcessRequest = async ( req, res ) => {
|
|
|
2179
2219
|
date: currentDate,
|
|
2180
2220
|
status: 'initiated',
|
|
2181
2221
|
fixtureImage: {
|
|
2182
|
-
filePath: imagePath,
|
|
2222
|
+
filePath: imagePath ? imagePath.match( /planoQrFixtureImages\/[^?]+/ )?.[0] : undefined,
|
|
2183
2223
|
comment: imageComment,
|
|
2184
2224
|
},
|
|
2185
2225
|
fixtureVideo: {
|
|
2186
|
-
filePath: videoPath,
|
|
2226
|
+
filePath: videoPath ? videoPath.match( /planoQrFixtureVideos\/[^?]+/ )?.[0] : undefined,
|
|
2187
2227
|
comment: videoComment,
|
|
2188
2228
|
},
|
|
2189
2229
|
};
|