fix: error in changing agent representation type
This commit is contained in:
@@ -599,6 +599,7 @@ module.exports.getOne = [
|
||||
Date.now()
|
||||
)
|
||||
notifyAdmin('updateNewRepresentations')
|
||||
console.log("S")
|
||||
return res.json(representation)
|
||||
} else return res.json(representation)
|
||||
} catch (e) {
|
||||
@@ -871,10 +872,16 @@ module.exports.update_representation_by_admin = [
|
||||
'computer_accessories',
|
||||
'memory_products',
|
||||
'car_audio_video',
|
||||
'home_products'
|
||||
'home_products',
|
||||
]
|
||||
const oldValues = [
|
||||
'verity',
|
||||
'panatech',
|
||||
'both',
|
||||
]
|
||||
if (!Array.isArray(value)) return Promise.reject(new Error('نوع نمایندگی باید به صورت آرایه باشد'))
|
||||
if (value.length === 0) return Promise.reject(new Error('حداقل یک نوع نمایندگی را انتخاب کنید'))
|
||||
value = value.filter(x => !oldValues.includes(x))
|
||||
const isValid = value.every(item => acceptedValues.includes(item))
|
||||
if (!isValid) return Promise.reject(new Error('مقدار نامعتبر برای نوع نمایندگی'))
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user