Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-strapi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 73e1c43a
authored
2024-06-01 12:15:54 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update image query
1 parent
3440fe10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
src/api/experience/controllers/experience.js
src/api/experience/controllers/experience.js
View file @
73e1c43
...
@@ -66,7 +66,7 @@ module.exports = createCoreController("api::experience.experience", () => ({
...
@@ -66,7 +66,7 @@ module.exports = createCoreController("api::experience.experience", () => ({
finalImageArray
=
[...
finalImageArray
,
{
image
:
element
}];
finalImageArray
=
[...
finalImageArray
,
{
image
:
element
}];
}
}
ctx
.
request
.
body
.
data
.
imagesComponent
;
//
ctx.request.body.data.imagesComponent;
// Create Activity
// Create Activity
const
activity
=
await
strapi
.
entityService
.
create
(
const
activity
=
await
strapi
.
entityService
.
create
(
"api::experience.experience"
,
"api::experience.experience"
,
...
@@ -157,7 +157,15 @@ module.exports = createCoreController("api::experience.experience", () => ({
...
@@ -157,7 +157,15 @@ module.exports = createCoreController("api::experience.experience", () => ({
throw
new
ValidationError
(
"Category is a mandatory field"
);
throw
new
ValidationError
(
"Category is a mandatory field"
);
}
}
console
.
log
(
"subcategoyr"
,
ctx
.
params
);
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
const
subCategory
=
await
strapi
.
query
(
"api::sub-categorie.sub-categorie"
)
.
query
(
"api::sub-categorie.sub-categorie"
)
.
findOne
({
.
findOne
({
...
@@ -217,6 +225,7 @@ module.exports = createCoreController("api::experience.experience", () => ({
...
@@ -217,6 +225,7 @@ module.exports = createCoreController("api::experience.experience", () => ({
approved
:
ctx
.
request
.
body
.
data
.
approved
,
approved
:
ctx
.
request
.
body
.
data
.
approved
,
// imagesComponent: ctx.request.body.data.imagesArrayComponent,
// imagesComponent: ctx.request.body.data.imagesArrayComponent,
...
ctx
.
request
.
body
.
data
.
daysBoolean
,
...
ctx
.
request
.
body
.
data
.
daysBoolean
,
imagesComponent
:
finalImageArray
,
},
},
});
});
console
.
log
(
console
.
log
(
...
@@ -229,13 +238,13 @@ module.exports = createCoreController("api::experience.experience", () => ({
...
@@ -229,13 +238,13 @@ module.exports = createCoreController("api::experience.experience", () => ({
// ? ctx.request.body.data.imagesArrayComponent
// ? ctx.request.body.data.imagesArrayComponent
// : [ctx.request.body.data.imagesArrayComponent];
// : [ctx.request.body.data.imagesArrayComponent];
// console.log("imagesComponentData >", imagesComponentData);
// console.log("imagesComponentData >", imagesComponentData);
const
updatedExperienceImageComponent
=
await
strapi
.
entityService
.
update
(
//
const updatedExperienceImageComponent = await strapi.entityService.update(
"api::experience.experience"
,
//
"api::experience.experience",
id
,
//
id,
{
//
{
data
:
{
imagesComponent
:
ctx
.
request
.
body
.
data
.
imagesComponent
},
//
data: { imagesComponent: ctx.request.body.data.imagesComponent },
}
//
}
);
//
);
console
.
log
(
"updatedExperience"
,
updatedExperience
);
console
.
log
(
"updatedExperience"
,
updatedExperience
);
ctx
.
send
({
ctx
.
send
({
success
:
true
,
success
:
true
,
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment