tango-app-api-payment-subscription 3.0.46-dev → 3.0.48-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-payment-subscription",
3
- "version": "3.0.46-dev",
3
+ "version": "3.0.48-dev",
4
4
  "description": "paymentSubscription",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "nodemon": "^3.1.0",
27
27
  "swagger-ui-express": "^5.0.0",
28
28
  "tango-api-schema": "^2.0.103",
29
- "tango-app-api-middleware": "^1.0.60-dev",
29
+ "tango-app-api-middleware": "^1.0.75-dev",
30
30
  "winston": "^3.12.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
32
32
  },
@@ -3049,9 +3049,12 @@ export const invoiceRevised = async ( req, res ) => {
3049
3049
 
3050
3050
  export const clientNotificationList = async ( req, res ) => {
3051
3051
  try {
3052
+ let from = ( req.query.offset - 1 ) * req.query.limit;
3052
3053
  let query;
3053
3054
  if ( req.user.role == 'superadmin' ) {
3054
3055
  query = {
3056
+ from: from,
3057
+ size: req.query.limit,
3055
3058
  query: {
3056
3059
  bool: {
3057
3060
  must: [
@@ -3083,7 +3086,7 @@ export const clientNotificationList = async ( req, res ) => {
3083
3086
  if ( !result || !result.body.hits.hits.length ) {
3084
3087
  return res.sendError( 'no data found', 204 );
3085
3088
  }
3086
- return res.sendSuccess( result.body.hits.hits );
3089
+ return res.sendSuccess( { count: result.body.hits.total.value, result: result.body.hits.hits } );
3087
3090
  } catch ( e ) {
3088
3091
  logger.error( { error: e, function: 'clientNotificationList' } );
3089
3092
  return res.sendError( e, 500 );
@@ -256,3 +256,12 @@ export const validateIdSchema = joi.object( {
256
256
  export const validateId = {
257
257
  params: validateIdSchema,
258
258
  };
259
+
260
+ export const notificationSchema = {
261
+ limit: joi.number().required(),
262
+ offset: joi.number().required(),
263
+ };
264
+
265
+ export const notificationParams = {
266
+ query: notificationSchema,
267
+ };
@@ -160,7 +160,7 @@ paymentSubscriptionRouter.post( '/invoice/create', validateClient, paymentContro
160
160
  paymentSubscriptionRouter.post( '/invoiceGenerate', paymentController.invoiceGenerate );
161
161
  paymentSubscriptionRouter.post( '/dailyPricing/insert', validate( validationDtos.dailyPricingParams ), paymentController.dailyPricingInsert );
162
162
  paymentSubscriptionRouter.get( '/invoiceRevised/:invoiceId', validate( validationDtos.invoiceRevisedParams ), paymentController.invoiceRevised );
163
- paymentSubscriptionRouter.get( '/notificationList', isAllowedSessionHandler, paymentController.clientNotificationList );
163
+ paymentSubscriptionRouter.get( '/notificationList', isAllowedSessionHandler, validate( validationDtos.notificationParams ), paymentController.clientNotificationList );
164
164
  paymentSubscriptionRouter.put( '/notification/update/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updateNotification );
165
165
  paymentSubscriptionRouter.put( '/pushNotification/update/:notificationId', isAllowedSessionHandler, validate( validationDtos.validateId ), paymentController.updatePushNotification );
166
166