Commit 9ac2ea61 by jaymehta

fix

1 parent d211e8ac
...@@ -106,9 +106,10 @@ module.exports = createCoreController("api::experience.experience", () => ({ ...@@ -106,9 +106,10 @@ module.exports = createCoreController("api::experience.experience", () => ({
}, },
async update(ctx) { async update(ctx) {
if (!ctx.request.body.data.vendor) { // if (!ctx.request.body.data.vendor) {
throw new ValidationError("Vendor is a mandatory field."); // throw new ValidationError("Vendor is a mandatory field.");
} // }
console.log("ctx>", ctx.request.body);
if (!ctx.request.body.data.pincode) { if (!ctx.request.body.data.pincode) {
throw new ValidationError("Pincode is a mandatory field."); throw new ValidationError("Pincode is a mandatory field.");
} }
...@@ -118,6 +119,8 @@ module.exports = createCoreController("api::experience.experience", () => ({ ...@@ -118,6 +119,8 @@ module.exports = createCoreController("api::experience.experience", () => ({
if (!ctx.request.body.data.category) { if (!ctx.request.body.data.category) {
throw new ValidationError("Category is a mandatory field"); throw new ValidationError("Category is a mandatory field");
} }
console.log("subcategoyr", ctx.request.body.data.subCategory);
const subCategory = await strapi const subCategory = await strapi
.query("api::sub-categorie.sub-categorie") .query("api::sub-categorie.sub-categorie")
.findOne({ .findOne({
...@@ -127,7 +130,6 @@ module.exports = createCoreController("api::experience.experience", () => ({ ...@@ -127,7 +130,6 @@ module.exports = createCoreController("api::experience.experience", () => ({
}, },
}, },
}); });
const category = await strapi.query("api::categorie.categorie").findOne({ const category = await strapi.query("api::categorie.categorie").findOne({
where: { where: {
name: { name: {
...@@ -157,7 +159,7 @@ module.exports = createCoreController("api::experience.experience", () => ({ ...@@ -157,7 +159,7 @@ module.exports = createCoreController("api::experience.experience", () => ({
activityType: ctx.request.body.data.activityType, activityType: ctx.request.body.data.activityType,
link: ctx.request.body.data.link, link: ctx.request.body.data.link,
cancellationPolicy: ctx.request.body.data.cancellationPolicy, cancellationPolicy: ctx.request.body.data.cancellationPolicy,
vendor: ctx.request.body.data.vendor.id, // vendor: ctx.request.body.data.vendor.id,
subCategory: subCategory.id, subCategory: subCategory.id,
category: category.id, category: category.id,
giftSomeone: ctx.request.body.data.giftSomeone, giftSomeone: ctx.request.body.data.giftSomeone,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!