Commit a455c312 by jaymehta

.

1 parent 0574f7ae
......@@ -83,6 +83,18 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
console.log("should be here");
} else {
console.log("but is here");
let final;
let str = ctx.request.body.data.name
// console.log()
let newStr = str.replace(/ /g,'').toUpperCase().replace(/[^a-zA-Z ]/g, "")
if (newStr.length >= 4) {
final = newStr.slice(0, 4);
console.log(final+String(Math.floor(Math.random() * 90000) + 10000))
} else {
final = newStr
console.log(final+String(Math.floor(Math.random() * 90000) + 10000))
}
ctx.request.body.data.user = currentUser.id;
const response = await strapi.entityService.create("api::vendor.vendor", {
......@@ -90,6 +102,7 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
...ctx.request.body.data,
phone: ctx.request.body.data.mobileNo,
publishedAt: date,
uniqueVendorId: str
},
});
console.log("response", response);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!