Skip to content

Commit d9a61e3

Browse files
committed
Use native randomUUID for product order IDs
1 parent 5f7bc58 commit d9a61e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

product/src/controllers/productController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Product = require("../models/product");
22
const messageBroker = require("../utils/messageBroker");
33
const config = require("../config");
4-
const uuid = require("uuid");
4+
const { randomUUID } = require("crypto");
55

66
/**
77
* Class to hold the API implementation for the product services
@@ -47,7 +47,7 @@ class ProductController {
4747
const { ids } = req.body;
4848
const products = await Product.find({ _id: { $in: ids } });
4949

50-
const orderId = uuid.v4(); // Generate a unique order ID
50+
const orderId = randomUUID(); // Generate a unique order ID
5151
this.ordersMap.set(orderId, {
5252
status: "pending",
5353
products,

0 commit comments

Comments
 (0)