MCPcopy Create free account
hub / github.com/TomDoesTech/REST-API-Tutorial-Updated / createProduct

Function createProduct

src/service/product.service.ts:8–22  ·  view source on GitHub ↗
(input: ProductInput)

Source from the content-addressed store, hash-verified

6import { databaseResponseTimeHistogram } from "../utils/metrics";
7
8export 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
24export async function findProduct(
25 query: FilterQuery<ProductDocument>,

Callers 1

createProductHandlerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected