(req: Request, res: Response, next: NextFunction)
| 7 | import { getRunningExpressApp } from '../../utils/getRunningExpressApp' |
| 8 | |
| 9 | const getAllFiles = async (req: Request, res: Response, next: NextFunction) => { |
| 10 | try { |
| 11 | const activeOrganizationId = req.user?.activeOrganizationId |
| 12 | if (!activeOrganizationId) { |
| 13 | throw new InternalFlowiseError( |
| 14 | StatusCodes.NOT_FOUND, |
| 15 | `Error: filesController.getAllFiles - organization ${activeOrganizationId} not found!` |
| 16 | ) |
| 17 | } |
| 18 | const apiResponse = await getFilesListFromStorage(activeOrganizationId) |
| 19 | const filesList = apiResponse.map((file: any) => ({ |
| 20 | ...file, |
| 21 | // replace org id because we don't want to expose it |
| 22 | path: file.path.replace(getStoragePath(), '').replace(`${path.sep}${activeOrganizationId}${path.sep}`, '') |
| 23 | })) |
| 24 | return res.json(filesList) |
| 25 | } catch (error) { |
| 26 | next(error) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | const deleteFile = async (req: Request, res: Response, next: NextFunction) => { |
| 31 | try { |
nothing calls this directly
no test coverage detected