1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-08 07:00:04 +00:00

feat: created api endpoint for adding empty folder in drive

This commit is contained in:
2022-07-20 16:43:43 +05:00
parent 177675bc89
commit 941917e508
4 changed files with 134 additions and 25 deletions

View File

@@ -11,6 +11,7 @@ import {
extractName,
fileBodyValidation,
fileParamValidation,
folderBodyValidation,
folderParamValidation,
isZipFile
} from '../../utils'
@@ -190,6 +191,19 @@ driveRouter.post(
}
)
driveRouter.post('/folder', async (req, res) => {
const { error, value: body } = folderBodyValidation(req.body)
if (error) return res.status(400).send(error.details[0].message)
try {
const response = await controller.addFolder(body)
res.send(response)
} catch (err: any) {
res.status(403).send(err.toString())
}
})
driveRouter.patch(
'/file',
(...arg) => multerSingle('file', arg),