(req: Request, res: Response, next: NextFunction)
| 104 | } |
| 105 | |
| 106 | const addDatasetRow = async (req: Request, res: Response, next: NextFunction) => { |
| 107 | try { |
| 108 | if (!req.body) { |
| 109 | throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: datasetService.addDatasetRow - body not provided!`) |
| 110 | } |
| 111 | if (!req.body.datasetId) { |
| 112 | throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: datasetService.addDatasetRow - datasetId not provided!`) |
| 113 | } |
| 114 | const workspaceId = req.user?.activeWorkspaceId |
| 115 | if (!workspaceId) { |
| 116 | throw new InternalFlowiseError( |
| 117 | StatusCodes.NOT_FOUND, |
| 118 | `Error: datasetController.addDatasetRow - workspace ${workspaceId} not found!` |
| 119 | ) |
| 120 | } |
| 121 | const body = { ...stripProtectedFields(req.body), workspaceId } |
| 122 | const apiResponse = await datasetService.addDatasetRow(body) |
| 123 | return res.json(apiResponse) |
| 124 | } catch (error) { |
| 125 | next(error) |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | const updateDatasetRow = async (req: Request, res: Response, next: NextFunction) => { |
| 130 | try { |
nothing calls this directly
no test coverage detected