tango-app-api-payment-subscription 3.0.57-dev → 3.0.58-dev
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
|
@@ -3063,14 +3063,14 @@ export const dailyPricingInsert = async ( req, res ) => {
|
|
|
3063
3063
|
productDetails = stepProductDetails[stepProductDetails.length - 1];
|
|
3064
3064
|
}
|
|
3065
3065
|
}
|
|
3066
|
-
let productStatus = getClient.planDetails.product.find( ( item ) => item.productName == getStore[storeIndex].product[storeProductIndex] );
|
|
3066
|
+
// let productStatus = getClient.planDetails.product.find( ( item ) => item.productName == getStore[storeIndex].product[storeProductIndex] );
|
|
3067
3067
|
if ( productDetails ) {
|
|
3068
3068
|
let newObject = {
|
|
3069
3069
|
productName: productDetails.productName,
|
|
3070
|
-
status: productStatus ? productStatus.status : '',
|
|
3071
|
-
price: productStatus ? [ 'trial', 'free' ].includes( productStatus.status ) ? 0 : productDetails.negotiatePrice : 0,
|
|
3072
|
-
featureStoreCount: storeIndex + 1,
|
|
3073
|
-
basePrice: productDetails.negotiatePrice,
|
|
3070
|
+
// status: productStatus ? productStatus.status : '',
|
|
3071
|
+
// price: productStatus ? [ 'trial', 'free' ].includes( productStatus.status ) ? 0 : productDetails.negotiatePrice : 0,
|
|
3072
|
+
// featureStoreCount: storeIndex + 1,
|
|
3073
|
+
// basePrice: productDetails.negotiatePrice,
|
|
3074
3074
|
...( getClient.priceType == 'step' ? { storeRange: productDetails.storeRange } : { storeRange: 'standard' } ),
|
|
3075
3075
|
};
|
|
3076
3076
|
productList.push( newObject );
|
|
@@ -3094,6 +3094,7 @@ export const dailyPricingInsert = async ( req, res ) => {
|
|
|
3094
3094
|
{
|
|
3095
3095
|
$project: {
|
|
3096
3096
|
'stores.daysDifference': 1,
|
|
3097
|
+
'dateString': 1,
|
|
3097
3098
|
},
|
|
3098
3099
|
},
|
|
3099
3100
|
{
|
|
@@ -3110,12 +3111,12 @@ export const dailyPricingInsert = async ( req, res ) => {
|
|
|
3110
3111
|
storeId: getStore[storeIndex].storeId,
|
|
3111
3112
|
store: getStore[storeIndex]._id,
|
|
3112
3113
|
storeName: getStore[storeIndex].storeName,
|
|
3113
|
-
|
|
3114
|
-
|
|
3114
|
+
status: getStore[storeIndex]?.status,
|
|
3115
|
+
firstFile: getStore[storeIndex]?.edge?.firstFile || false,
|
|
3115
3116
|
edgefirstFileDate: getStore[storeIndex]?.edge?.firstFileDate || null,
|
|
3116
3117
|
date: new Date( requestData.date ),
|
|
3117
3118
|
processfirstFileDate: processedFileDate?.date_iso || null,
|
|
3118
|
-
daysDifference: getStore[storeIndex]?.status == 'active' ? ( dailyData.length && dailyData[0]?.stores?.daysDifference ) ? ( dailyData[0]?.stores?.daysDifference + 1 ) : 1 : dailyData[0]?.stores?.daysDifference ? dailyData[0]?.stores?.daysDifference : 0,
|
|
3119
|
+
daysDifference: ( getStore[storeIndex]?.status == 'active' && dailyData[0]?.dateString != dayjs( requestData.date, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) ) ? ( dailyData.length && dailyData[0]?.stores?.daysDifference ) ? ( dailyData[0]?.stores?.daysDifference + 1 ) : 1 : dailyData[0]?.stores?.daysDifference ? dailyData[0]?.stores?.daysDifference : 0,
|
|
3119
3120
|
products: productList,
|
|
3120
3121
|
camera: cameraDetails.map( ( item ) => item.streamName ),
|
|
3121
3122
|
cameraCount: cameraDetails.length,
|
|
@@ -3127,13 +3128,13 @@ export const dailyPricingInsert = async ( req, res ) => {
|
|
|
3127
3128
|
stores: storeList,
|
|
3128
3129
|
dateISO: new Date( requestData.date ),
|
|
3129
3130
|
accountType: getClient?.planDetails?.subscriptionType,
|
|
3130
|
-
|
|
3131
|
+
status: getClient?.status,
|
|
3131
3132
|
activeStores: getStore?.length,
|
|
3132
3133
|
brandName: getClient?.clientName,
|
|
3133
3134
|
proRate: getClient?.paymentInvoice?.proRate,
|
|
3134
3135
|
dateString: dayjs( requestData.date, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ),
|
|
3135
3136
|
};
|
|
3136
|
-
await dailyPriceService.
|
|
3137
|
+
await dailyPriceService.updateOne( { clientId: requestClient[clientIndex], dateString: params.dateString }, params, { upsert: true } );
|
|
3137
3138
|
}
|
|
3138
3139
|
} ).catch( ( error ) => {
|
|
3139
3140
|
logger.error( { error: error, function: 'old processedDayData' } );
|
|
@@ -16,7 +16,7 @@ export const create = ( record ) => {
|
|
|
16
16
|
return model.dailyPricingModel.create( record );
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const updateOne = ( query, record ) => {
|
|
20
|
-
return model.dailyPricingModel.updateOne( query, { $set: record } );
|
|
19
|
+
export const updateOne = ( query, record, option = {} ) => {
|
|
20
|
+
return model.dailyPricingModel.updateOne( query, { $set: record }, option );
|
|
21
21
|
};
|
|
22
22
|
|