Commit 73e1c43a by jaymehta

update image query

1 parent 3440fe10
......@@ -66,7 +66,7 @@ module.exports = createCoreController("api::experience.experience", () => ({
finalImageArray = [...finalImageArray, { image: element }];
}
ctx.request.body.data.imagesComponent;
// ctx.request.body.data.imagesComponent;
// Create Activity
const activity = await strapi.entityService.create(
"api::experience.experience",
......@@ -157,7 +157,15 @@ module.exports = createCoreController("api::experience.experience", () => ({
throw new ValidationError("Category is a mandatory field");
}
console.log("subcategoyr", ctx.params);
let finalImageArray = [];
for (
let index = 0;
index < ctx.request.body.data.imagesComponent.length;
index++
) {
const element = ctx.request.body.data.imagesComponent[index];
finalImageArray = [...finalImageArray, { image: element }];
}
const subCategory = await strapi
.query("api::sub-categorie.sub-categorie")
.findOne({
......@@ -217,6 +225,7 @@ module.exports = createCoreController("api::experience.experience", () => ({
approved: ctx.request.body.data.approved,
// imagesComponent: ctx.request.body.data.imagesArrayComponent,
...ctx.request.body.data.daysBoolean,
imagesComponent: finalImageArray,
},
});
console.log(
......@@ -229,13 +238,13 @@ module.exports = createCoreController("api::experience.experience", () => ({
// ? ctx.request.body.data.imagesArrayComponent
// : [ctx.request.body.data.imagesArrayComponent];
// console.log("imagesComponentData >", imagesComponentData);
const updatedExperienceImageComponent = await strapi.entityService.update(
"api::experience.experience",
id,
{
data: { imagesComponent: ctx.request.body.data.imagesComponent },
}
);
// const updatedExperienceImageComponent = await strapi.entityService.update(
// "api::experience.experience",
// id,
// {
// data: { imagesComponent: ctx.request.body.data.imagesComponent },
// }
// );
console.log("updatedExperience", updatedExperience);
ctx.send({
success: true,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!