(params: HealthCheckParams, orm: DataSource)
| 17 | * @returns {Promise<void>} - A promise that resolves when the health check is updated |
| 18 | */ |
| 19 | export default async function updateHealthCheck(params: HealthCheckParams, orm: DataSource) { |
| 20 | const { modelId, providerId, isAvailable, status, latency } = params; |
| 21 | const updateData = { isAvailable, status, latency }; |
| 22 | |
| 23 | // TODO: @typescript-eslint/no-unused-vars |
| 24 | // const healthCheckObj = await orm |
| 25 | // .getRepository(ModelHealthCheck) |
| 26 | // .findOne({ where: { modelId: modelId, providerId: providerId } }); |
| 27 | |
| 28 | await orm |
| 29 | .getRepository(ModelHealthCheck) |
| 30 | .create({ modelId, providerId, ...updateData }) |
| 31 | .save(); |
| 32 | } |
no outgoing calls
no test coverage detected