Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 3x 3x 1x 2x 2x 1x 3x 3x 1x 2x 2x 1x 8x 8x 8x 8x 8x 8x 8x 8x 1x 7x 1x 6x 1x 5x 1x 4x 1x 3x 1x 2x 1x 3x 3x 3x 1x | import APIError from '../helpers/error'; import { t } from '../helpers/i18n'; import StorageAddressSizeInformation from '../source/storageAddressSizes/information'; import AddressInformation from '../source/storageAddresses/information'; async function validStorageAddressSizeId(req) { const addressSizeId = req.body.addressSizeId || req.query.addressSizeId; if (!addressSizeId) { throw new APIError('INVALID_ADDRESS_SIZE_ID'); } else { const exist = await StorageAddressSizeInformation.getStorageAddressSize({ id: addressSizeId, }); if (!exist) { throw new APIError( 'NOT_EXIST_STORAGE_ADDRESS_SIZE_ID', t( 'BEE1598', { 0: addressSizeId } /* Tamanho de endereço %{0} não localizada */ ) ); } } } async function validStorageAddressSizeCode(req) { const code = req.body.code || req.query.code; if (!code) { throw new APIError('INVALID_ADDRESS_SIZE_CODE'); } else { const exist = await StorageAddressSizeInformation.getStorageAddressSize({ code, }); if (exist) { throw new APIError( 'EXIST_STORAGE_ADDRESS_SIZE_CODE', t('BEE262' /* O código informado já existe! */) ); } } } function validStorageAddressSize(req) { const name = req.body.name || req.query.name; const height = req.body.height || req.query.height; const width = req.body.width || req.query.width; const length = req.body.length || req.query.length; const capacityVolume = req.body.capacityVolume || req.query.capacityVolume; const capacityWeight = req.body.capacityWeight || req.query.capacityWeight; const curve = req.body.curve || req.query.curve; if (!name) { throw new APIError( 'INVALID_STORAGE_ADDRESS_SIZE_NAME', t('BEE1591' /* Nome não preenchido */) ); } if (!height) { throw new APIError( 'INVALID_STORAGE_ADDRESS_SIZE_HEIGHT', t('BEE1592' /* Altura não preenchido */) ); } if (!width) { throw new APIError( 'INVALID_STORAGE_ADDRESS_SIZE_WIDTH', t('BEE1593' /* Largura não preenchido */) ); } if (!length) { throw new APIError( 'INVALID_STORAGE_ADDRESS_SIZE_LENGTH', t('BEE1594' /* Comprimento não preenchido */) ); } if (!capacityVolume) { throw new APIError( 'INVALID_STORAGE_ADDRESS_SIZE_CAPACITY_VALUME', t('BEE1595' /* Capacidade (Volume) não preenchido */) ); } if (!capacityWeight) { throw new APIError( 'INVALID_STORAGE_ADDRESS_SIZE_CAPACITY_WEIGHT', t('BEE1596' /* Capacidade (Peso) não preenchido */) ); } if (!curve) { throw new APIError( 'INVALID_STORAGE_ADDRESS_SIZE_CURVE', t('BEE1597' /* Curva não preenchido */) ); } } async function validDeleteHasAssociatedAddress(req) { const addressSizeId = req.body.addressSizeId || req.query.addressSizeId; const addressData = await AddressInformation.getStorageAddress({ size: addressSizeId, }); if (addressData) { throw new APIError( '', t( 'BEE4235' /* Não é possível excluir esta classificação, pois ela está vinculada a outros registros no sistema */ ) ); } } export default { validStorageAddressSizeId, validStorageAddressSizeCode, validStorageAddressSize, validDeleteHasAssociatedAddress, }; |