mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-02 19:25:51 +00:00
Delete array/brackets in /v2/secrets DELETE route
This commit is contained in:
@@ -137,24 +137,22 @@ router.patch(
|
|||||||
|
|
||||||
router.delete(
|
router.delete(
|
||||||
'/',
|
'/',
|
||||||
[
|
body('secretIds')
|
||||||
body('secretIds')
|
.exists()
|
||||||
.exists()
|
.custom((value) => {
|
||||||
.custom((value) => {
|
// case: delete 1 secret
|
||||||
// case: delete 1 secret
|
if (typeof value === 'string') return true;
|
||||||
if (typeof value === 'string') return true;
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
if (Array.isArray(value)) {
|
// case: delete multiple secrets
|
||||||
// case: delete multiple secrets
|
if (value.length === 0) throw new Error('secrets cannot be an empty array');
|
||||||
if (value.length === 0) throw new Error('secrets cannot be an empty array');
|
return value.every((id: string) => typeof id === 'string')
|
||||||
return value.every((id: string) => typeof id === 'string')
|
}
|
||||||
}
|
|
||||||
|
throw new Error('secretIds must be a string or an array of strings');
|
||||||
throw new Error('secretIds must be a string or an array of strings');
|
})
|
||||||
})
|
.not()
|
||||||
.not()
|
.isEmpty(),
|
||||||
.isEmpty()
|
|
||||||
],
|
|
||||||
validateRequest,
|
validateRequest,
|
||||||
requireAuth({
|
requireAuth({
|
||||||
acceptedAuthModes: ['jwt']
|
acceptedAuthModes: ['jwt']
|
||||||
|
|||||||
Reference in New Issue
Block a user