From cc72432a375f9c0a5beab1c50ebda149f8095433 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 22 May 2019 12:35:24 +0200 Subject: [PATCH] accessType refactor #1460 --- modules/agency/back/methods/agency/getAgenciesWithWarehouse.js | 1 - modules/agency/back/methods/agency/getFirstShipped.js | 1 - modules/agency/back/methods/agency/landsThatDay.js | 1 - modules/agency/back/methods/zone-calendar/removeByDate.js | 2 +- modules/agency/back/methods/zone-geo/getLeaves.js | 1 - modules/agency/back/methods/zone-included/toggleIsIncluded.js | 1 - modules/claim/back/methods/claim/createFromSales.js | 1 - modules/item/back/methods/item/getVisibleAvailable.js | 1 - modules/order/back/methods/order-row/removes.js | 2 +- modules/ticket/back/methods/sale/removes.js | 2 +- modules/ticket/back/methods/sale/reserve.js | 2 +- modules/ticket/back/methods/sale/updateDiscount.js | 2 +- modules/ticket/back/methods/sale/updatePrice.js | 2 +- modules/ticket/back/methods/sale/updateQuantity.js | 2 +- modules/ticket/back/methods/ticket/deleted.js | 2 +- modules/ticket/back/methods/ticket/threeLastActive.js | 2 +- modules/worker/back/methods/department/getLeaves.js | 1 - modules/worker/back/methods/department/nodeAdd.js | 2 +- modules/worker/back/methods/department/nodeDelete.js | 2 +- modules/worker/back/methods/holiday/getByWarehouse.js | 1 - modules/worker/back/methods/worker-calendar/absences.js | 3 --- 21 files changed, 11 insertions(+), 23 deletions(-) diff --git a/modules/agency/back/methods/agency/getAgenciesWithWarehouse.js b/modules/agency/back/methods/agency/getAgenciesWithWarehouse.js index 385cbe9a7..bed6024fd 100644 --- a/modules/agency/back/methods/agency/getAgenciesWithWarehouse.js +++ b/modules/agency/back/methods/agency/getAgenciesWithWarehouse.js @@ -1,7 +1,6 @@ module.exports = Self => { Self.remoteMethod('getAgenciesWithWarehouse', { description: 'Returns a list of agencies that can land a shipment on a day for an address and a warehouse', - accessType: '', accepts: [{ arg: 'filter', type: 'object', diff --git a/modules/agency/back/methods/agency/getFirstShipped.js b/modules/agency/back/methods/agency/getFirstShipped.js index 15d831209..3eaba8786 100644 --- a/modules/agency/back/methods/agency/getFirstShipped.js +++ b/modules/agency/back/methods/agency/getFirstShipped.js @@ -1,7 +1,6 @@ module.exports = Self => { Self.remoteMethod('getFirstShipped', { description: 'Returns the first shipped and landed possible for params', - accessType: '', accepts: [{ arg: 'params', type: 'object', diff --git a/modules/agency/back/methods/agency/landsThatDay.js b/modules/agency/back/methods/agency/landsThatDay.js index 00184f32f..25a4b34a4 100644 --- a/modules/agency/back/methods/agency/landsThatDay.js +++ b/modules/agency/back/methods/agency/landsThatDay.js @@ -1,7 +1,6 @@ module.exports = Self => { Self.remoteMethod('landsThatDay', { description: 'Returns a list of agencies that can land a shipment on a day for an address', - accessType: '', accepts: [{ arg: 'filter', type: 'object', diff --git a/modules/agency/back/methods/zone-calendar/removeByDate.js b/modules/agency/back/methods/zone-calendar/removeByDate.js index c4e78a716..f7871502e 100644 --- a/modules/agency/back/methods/zone-calendar/removeByDate.js +++ b/modules/agency/back/methods/zone-calendar/removeByDate.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethod('removeByDate', { description: 'Removes one or more delivery dates for a zone', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'zoneFk', type: 'Number', diff --git a/modules/agency/back/methods/zone-geo/getLeaves.js b/modules/agency/back/methods/zone-geo/getLeaves.js index 7209f5268..3923d0366 100644 --- a/modules/agency/back/methods/zone-geo/getLeaves.js +++ b/modules/agency/back/methods/zone-geo/getLeaves.js @@ -4,7 +4,6 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { Self.remoteMethod('getLeaves', { description: 'Returns the first shipped and landed possible for params', - accessType: '', accepts: [{ arg: 'zoneFk', type: 'Number', diff --git a/modules/agency/back/methods/zone-included/toggleIsIncluded.js b/modules/agency/back/methods/zone-included/toggleIsIncluded.js index 0b15a7171..ed4605296 100644 --- a/modules/agency/back/methods/zone-included/toggleIsIncluded.js +++ b/modules/agency/back/methods/zone-included/toggleIsIncluded.js @@ -1,7 +1,6 @@ module.exports = Self => { Self.remoteMethod('toggleIsIncluded', { description: 'Toggle include to delivery', - accessType: '', accepts: [{ arg: 'zoneFk', type: 'Number', diff --git a/modules/claim/back/methods/claim/createFromSales.js b/modules/claim/back/methods/claim/createFromSales.js index 4b658ab33..f3f4171af 100644 --- a/modules/claim/back/methods/claim/createFromSales.js +++ b/modules/claim/back/methods/claim/createFromSales.js @@ -1,7 +1,6 @@ module.exports = Self => { Self.remoteMethodCtx('createFromSales', { description: 'Create a claim', - accessType: '', accepts: [{ arg: 'claim', type: 'object', diff --git a/modules/item/back/methods/item/getVisibleAvailable.js b/modules/item/back/methods/item/getVisibleAvailable.js index dd60a069e..b35ca5fb7 100644 --- a/modules/item/back/methods/item/getVisibleAvailable.js +++ b/modules/item/back/methods/item/getVisibleAvailable.js @@ -1,7 +1,6 @@ module.exports = Self => { Self.remoteMethod('getVisibleAvailable', { description: 'Returns visible and available for params', - accessType: '', accepts: [ { arg: 'id', diff --git a/modules/order/back/methods/order-row/removes.js b/modules/order/back/methods/order-row/removes.js index 1b66a4c33..86f0e70d7 100644 --- a/modules/order/back/methods/order-row/removes.js +++ b/modules/order/back/methods/order-row/removes.js @@ -3,7 +3,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('removes', { description: 'Delete an Order Row', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'params', type: 'object', diff --git a/modules/ticket/back/methods/sale/removes.js b/modules/ticket/back/methods/sale/removes.js index 71768af4b..ecf1e2e1c 100644 --- a/modules/ticket/back/methods/sale/removes.js +++ b/modules/ticket/back/methods/sale/removes.js @@ -3,7 +3,7 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('removes', { description: 'Change the state of a ticket', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'params', type: 'object', diff --git a/modules/ticket/back/methods/sale/reserve.js b/modules/ticket/back/methods/sale/reserve.js index 69cd54224..7114bffc1 100644 --- a/modules/ticket/back/methods/sale/reserve.js +++ b/modules/ticket/back/methods/sale/reserve.js @@ -4,7 +4,7 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('reserve', { description: 'Change the state of a ticket', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'params', type: 'object', diff --git a/modules/ticket/back/methods/sale/updateDiscount.js b/modules/ticket/back/methods/sale/updateDiscount.js index 6eaf2cb12..641182076 100644 --- a/modules/ticket/back/methods/sale/updateDiscount.js +++ b/modules/ticket/back/methods/sale/updateDiscount.js @@ -3,7 +3,7 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('updateDiscount', { description: 'Changes the discount of a sale', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'params', type: 'object', diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js index a49d194e4..aa4df9d28 100644 --- a/modules/ticket/back/methods/sale/updatePrice.js +++ b/modules/ticket/back/methods/sale/updatePrice.js @@ -3,7 +3,7 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('updatePrice', { description: 'Changes the discount of a sale', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'params', type: 'object', diff --git a/modules/ticket/back/methods/sale/updateQuantity.js b/modules/ticket/back/methods/sale/updateQuantity.js index 8553c7ae7..c25aa9007 100644 --- a/modules/ticket/back/methods/sale/updateQuantity.js +++ b/modules/ticket/back/methods/sale/updateQuantity.js @@ -3,7 +3,7 @@ let UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('updateQuantity', { description: 'Changes the quantity of a sale', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'id', type: 'number', diff --git a/modules/ticket/back/methods/ticket/deleted.js b/modules/ticket/back/methods/ticket/deleted.js index 0736be90a..a7fa29a50 100644 --- a/modules/ticket/back/methods/ticket/deleted.js +++ b/modules/ticket/back/methods/ticket/deleted.js @@ -3,7 +3,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('deleted', { description: 'Sets the isDeleted value of a ticket to 1', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'ticketFk', type: 'Object', diff --git a/modules/ticket/back/methods/ticket/threeLastActive.js b/modules/ticket/back/methods/ticket/threeLastActive.js index 3539efb4f..2966514a4 100644 --- a/modules/ticket/back/methods/ticket/threeLastActive.js +++ b/modules/ticket/back/methods/ticket/threeLastActive.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethod('threeLastActive', { description: 'Returns the last three tickets of a client that have the alertLevel at 0 and the shiped day is gt today', - accessType: '', + accessType: 'READ', accepts: [{ arg: 'filter', type: 'object', diff --git a/modules/worker/back/methods/department/getLeaves.js b/modules/worker/back/methods/department/getLeaves.js index a97dc4f1d..34b776cf0 100644 --- a/modules/worker/back/methods/department/getLeaves.js +++ b/modules/worker/back/methods/department/getLeaves.js @@ -4,7 +4,6 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { Self.remoteMethod('getLeaves', { description: 'Returns the first shipped and landed possible for params', - accessType: '', accepts: [{ arg: 'parentFk', type: 'Number', diff --git a/modules/worker/back/methods/department/nodeAdd.js b/modules/worker/back/methods/department/nodeAdd.js index 58c50f0bd..93a6f81c0 100644 --- a/modules/worker/back/methods/department/nodeAdd.js +++ b/modules/worker/back/methods/department/nodeAdd.js @@ -4,7 +4,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { Self.remoteMethod('nodeAdd', { description: 'Returns the first shipped and landed possible for params', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'parentFk', type: 'Number', diff --git a/modules/worker/back/methods/department/nodeDelete.js b/modules/worker/back/methods/department/nodeDelete.js index 22cf5312c..92b354ee5 100644 --- a/modules/worker/back/methods/department/nodeDelete.js +++ b/modules/worker/back/methods/department/nodeDelete.js @@ -4,7 +4,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { Self.remoteMethod('nodeDelete', { description: 'Returns the first shipped and landed possible for params', - accessType: '', + accessType: 'WRITE', accepts: [{ arg: 'parentFk', type: 'Number', diff --git a/modules/worker/back/methods/holiday/getByWarehouse.js b/modules/worker/back/methods/holiday/getByWarehouse.js index 3ebb5f5b2..a56b5166e 100644 --- a/modules/worker/back/methods/holiday/getByWarehouse.js +++ b/modules/worker/back/methods/holiday/getByWarehouse.js @@ -1,7 +1,6 @@ module.exports = Self => { Self.remoteMethod('getByWarehouse', { description: 'Returns an array of labour holidays from an specified warehouse', - accessType: '', accepts: [{ arg: 'warehouseFk', type: 'Number', diff --git a/modules/worker/back/methods/worker-calendar/absences.js b/modules/worker/back/methods/worker-calendar/absences.js index b6eae8a13..7c1a74084 100644 --- a/modules/worker/back/methods/worker-calendar/absences.js +++ b/modules/worker/back/methods/worker-calendar/absences.js @@ -1,11 +1,8 @@ - -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('absences', { description: 'Returns an array of absences from an specified worker', - accessType: '', accepts: [{ arg: 'workerFk', type: 'Number',