(requestBody: any)
| 11 | import { getRunningExpressApp } from '../../utils/getRunningExpressApp' |
| 12 | |
| 13 | const createCredential = async (requestBody: any) => { |
| 14 | try { |
| 15 | const appServer = getRunningExpressApp() |
| 16 | const newCredential = await transformToCredentialEntity(requestBody) |
| 17 | |
| 18 | if (requestBody.id) { |
| 19 | newCredential.id = requestBody.id |
| 20 | } |
| 21 | |
| 22 | const credential = await appServer.AppDataSource.getRepository(Credential).create(newCredential) |
| 23 | const dbResponse = await appServer.AppDataSource.getRepository(Credential).save(credential) |
| 24 | return dbResponse |
| 25 | } catch (error) { |
| 26 | throw new InternalFlowiseError( |
| 27 | StatusCodes.INTERNAL_SERVER_ERROR, |
| 28 | `Error: credentialsService.createCredential - ${getErrorMessage(error)}` |
| 29 | ) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // Delete all credentials from chatflowid |
| 34 | const deleteCredentials = async (credentialId: string, workspaceId: string): Promise<any> => { |
nothing calls this directly
no test coverage detected