(req: Request, res: Response, next: NextFunction)
| 43 | } |
| 44 | |
| 45 | const createDataset = async (req: Request, res: Response, next: NextFunction) => { |
| 46 | try { |
| 47 | if (!req.body) { |
| 48 | throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: datasetService.createDataset - body not provided!`) |
| 49 | } |
| 50 | const workspaceId = req.user?.activeWorkspaceId |
| 51 | if (!workspaceId) { |
| 52 | throw new InternalFlowiseError( |
| 53 | StatusCodes.NOT_FOUND, |
| 54 | `Error: datasetController.createDataset - workspace ${workspaceId} not found!` |
| 55 | ) |
| 56 | } |
| 57 | const body = { ...stripProtectedFields(req.body), workspaceId } |
| 58 | const apiResponse = await datasetService.createDataset(body, workspaceId) |
| 59 | return res.json(apiResponse) |
| 60 | } catch (error) { |
| 61 | next(error) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | const updateDataset = async (req: Request, res: Response, next: NextFunction) => { |
| 66 | try { |
nothing calls this directly
no test coverage detected