(input: ProductInput)
| 6 | import { databaseResponseTimeHistogram } from "../utils/metrics"; |
| 7 | |
| 8 | export async function createProduct(input: ProductInput) { |
| 9 | const metricsLabels = { |
| 10 | operation: "createProduct", |
| 11 | }; |
| 12 | |
| 13 | const timer = databaseResponseTimeHistogram.startTimer(); |
| 14 | try { |
| 15 | const result = await ProductModel.create(input); |
| 16 | timer({ ...metricsLabels, success: "true" }); |
| 17 | return result; |
| 18 | } catch (e) { |
| 19 | timer({ ...metricsLabels, success: "false" }); |
| 20 | throw e; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | export async function findProduct( |
| 25 | query: FilterQuery<ProductDocument>, |
no outgoing calls
no test coverage detected