(id: string, body: any, workspaceId: string)
| 68 | |
| 69 | // Update Evaluator |
| 70 | const updateEvaluator = async (id: string, body: any, workspaceId: string) => { |
| 71 | try { |
| 72 | const appServer = getRunningExpressApp() |
| 73 | const evaluator = await appServer.AppDataSource.getRepository(Evaluator).findOneBy({ |
| 74 | id: id, |
| 75 | workspaceId: workspaceId |
| 76 | }) |
| 77 | |
| 78 | if (!evaluator) throw new Error(`Evaluator ${id} not found`) |
| 79 | |
| 80 | const updateEvaluator = EvaluatorDTO.toEntity(body) |
| 81 | updateEvaluator.id = id |
| 82 | updateEvaluator.workspaceId = workspaceId |
| 83 | appServer.AppDataSource.getRepository(Evaluator).merge(evaluator, updateEvaluator) |
| 84 | const result = await appServer.AppDataSource.getRepository(Evaluator).save(evaluator) |
| 85 | return EvaluatorDTO.fromEntity(result) |
| 86 | } catch (error) { |
| 87 | throw new InternalFlowiseError( |
| 88 | StatusCodes.INTERNAL_SERVER_ERROR, |
| 89 | `Error: evaluatorService.updateEvaluator - ${getErrorMessage(error)}` |
| 90 | ) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // Delete Evaluator via id |
| 95 | const deleteEvaluator = async (id: string, workspaceId: string) => { |
nothing calls this directly
no test coverage detected