(id: string, body: any)
| 319 | |
| 320 | // Update row for a dataset |
| 321 | const updateDatasetRow = async (id: string, body: any) => { |
| 322 | try { |
| 323 | const appServer = getRunningExpressApp() |
| 324 | const item = await appServer.AppDataSource.getRepository(DatasetRow).findOneBy({ |
| 325 | id: id |
| 326 | }) |
| 327 | if (!item) throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Dataset Row ${id} not found`) |
| 328 | |
| 329 | const dataset = await appServer.AppDataSource.getRepository(Dataset).findOneBy({ |
| 330 | id: item.datasetId, |
| 331 | workspaceId: body.workspaceId |
| 332 | }) |
| 333 | if (!dataset) throw new InternalFlowiseError(StatusCodes.NOT_FOUND, `Dataset Row ${id} not found`) |
| 334 | |
| 335 | item.input = body.input |
| 336 | item.output = body.output |
| 337 | const result = await appServer.AppDataSource.getRepository(DatasetRow).save(item) |
| 338 | await changeUpdateOnDataset(item.datasetId, body.workspaceId) |
| 339 | return result |
| 340 | } catch (error) { |
| 341 | throw new InternalFlowiseError( |
| 342 | StatusCodes.INTERNAL_SERVER_ERROR, |
| 343 | `Error: datasetService.updateDatasetRow - ${getErrorMessage(error)}` |
| 344 | ) |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | // Delete dataset row via id |
| 349 | const deleteDatasetRow = async (id: string, workspaceId: string) => { |
nothing calls this directly
no test coverage detected