tango-app-api-store-builder 1.0.0-beta-35 → 1.0.0-beta-36
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
|
|
|
@@ -1901,10 +1908,17 @@ export const uploadImage = async ( req, res ) => {
|
|
|
1901
1908
|
|
|
1902
1909
|
export async function storeFixturesTask( req, res ) {
|
|
1903
1910
|
try {
|
|
1904
|
-
const planoIds = req.body.id
|
|
1911
|
+
const planoIds = req.body.id
|
|
1912
|
+
.filter( ( id ) => mongoose.Types.ObjectId.isValid( id ) )
|
|
1913
|
+
.map( ( id ) => new mongoose.Types.ObjectId( id ) );
|
|
1905
1914
|
|
|
1906
1915
|
const planograms = await planoService.find(
|
|
1907
|
-
{
|
|
1916
|
+
{
|
|
1917
|
+
$or: [
|
|
1918
|
+
{ _id: { $in: planoIds } },
|
|
1919
|
+
{ storeId: { $in: req.body.id } },
|
|
1920
|
+
],
|
|
1921
|
+
},
|
|
1908
1922
|
{ storeId: 1, storeName: 1, planoId: '$_id', productResolutionLevel: 1, scanType: 1 },
|
|
1909
1923
|
);
|
|
1910
1924
|
|
|
@@ -2106,7 +2120,7 @@ export const qrFileUpload = async ( req, res ) => {
|
|
|
2106
2120
|
let uploadPath;
|
|
2107
2121
|
|
|
2108
2122
|
if ( type === 'video' ) {
|
|
2109
|
-
uploadPath = `
|
|
2123
|
+
uploadPath = `planoQrFixtureVideos/${dayjs().format( 'YYYY-MM-DD' )}/${fixture.toObject().storeId}`;
|
|
2110
2124
|
} else if ( type === 'image' ) {
|
|
2111
2125
|
uploadPath = `planoQrFixtureImages/${dayjs().format( 'YYYY-MM-DD' )}/${fixture.toObject().storeId}`;
|
|
2112
2126
|
}
|
|
@@ -2121,7 +2135,13 @@ export const qrFileUpload = async ( req, res ) => {
|
|
|
2121
2135
|
|
|
2122
2136
|
const fileUrl = await fileUpload( params );
|
|
2123
2137
|
|
|
2124
|
-
|
|
2138
|
+
const signedParams = {
|
|
2139
|
+
Bucket: bucket.storeBuilder,
|
|
2140
|
+
file_path: fileUrl.Key,
|
|
2141
|
+
};
|
|
2142
|
+
const signedKey = await signedUrl( signedParams );
|
|
2143
|
+
|
|
2144
|
+
res.sendSuccess( signedKey );
|
|
2125
2145
|
} catch ( error ) {
|
|
2126
2146
|
logger.error( 'fixtureQrUpdate =>', error );
|
|
2127
2147
|
return res.sendError( { message: 'Internal Server Error' }, 500 );
|
|
@@ -2179,15 +2199,16 @@ export const updateQrCvProcessRequest = async ( req, res ) => {
|
|
|
2179
2199
|
date: currentDate,
|
|
2180
2200
|
status: 'initiated',
|
|
2181
2201
|
fixtureImage: {
|
|
2182
|
-
filePath: imagePath,
|
|
2202
|
+
filePath: imagePath ? imagePath.match( /planoQrFixtureImages\/[^?]+/ )?.[0] : undefined,
|
|
2183
2203
|
comment: imageComment,
|
|
2184
2204
|
},
|
|
2185
2205
|
fixtureVideo: {
|
|
2186
|
-
filePath: videoPath,
|
|
2206
|
+
filePath: videoPath ? videoPath.match( /planoQrFixtureVideos\/[^?]+/ )?.[0] : undefined,
|
|
2187
2207
|
comment: videoComment,
|
|
2188
2208
|
},
|
|
2189
2209
|
};
|
|
2190
2210
|
|
|
2211
|
+
|
|
2191
2212
|
await planoQrConversionRequestService.upsertOne( { fixtureId: fixtureData?._id, date: currentDate }, data );
|
|
2192
2213
|
|
|
2193
2214
|
return res.sendSuccess( { message: 'Updated successfully', data } );
|