(req: Request, res: Response, next: NextFunction)
| 63 | } |
| 64 | |
| 65 | const updateDataset = async (req: Request, res: Response, next: NextFunction) => { |
| 66 | try { |
| 67 | if (!req.body) { |
| 68 | throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: datasetService.updateDataset - body not provided!`) |
| 69 | } |
| 70 | if (typeof req.params === 'undefined' || !req.params.id) { |
| 71 | throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: datasetService.updateDataset - id not provided!`) |
| 72 | } |
| 73 | const workspaceId = req.user?.activeWorkspaceId |
| 74 | if (!workspaceId) { |
| 75 | throw new InternalFlowiseError( |
| 76 | StatusCodes.NOT_FOUND, |
| 77 | `Error: datasetController.updateDataset - workspace ${workspaceId} not found!` |
| 78 | ) |
| 79 | } |
| 80 | const apiResponse = await datasetService.updateDataset(req.params.id, stripProtectedFields(req.body), workspaceId) |
| 81 | return res.json(apiResponse) |
| 82 | } catch (error) { |
| 83 | next(error) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | const deleteDataset = async (req: Request, res: Response, next: NextFunction) => { |
| 88 | try { |
nothing calls this directly
no test coverage detected