Skip to content

Commit

Permalink
Post ingestion fixed (#4090)
Browse files Browse the repository at this point in the history
* post ingestion fixed

* version bump
  • Loading branch information
hero101 authored Jun 12, 2024
1 parent a72f572 commit 196ed32
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 67 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-server",
"version": "0.79.0",
"version": "0.79.1",
"description": "Alkemio server, responsible for managing the shared Alkemio platform",
"author": "Alkemio Foundation",
"private": false,
Expand Down
67 changes: 3 additions & 64 deletions src/services/api/search/v2/ingest/search.ingest.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,14 +860,14 @@ export class SearchIngestService {
take: limit,
})
.then(spaces => {
const spaceLevel0Posts: any[] = [];
const posts: any[] = [];
spaces.forEach(space =>
space?.collaboration?.callouts?.forEach(callout =>
callout?.contributions?.forEach(contribution => {
if (!contribution.post) {
return;
}
spaceLevel0Posts.push({
posts.push({
...contribution.post,
type: SearchEntityTypes.POST,
license: {
Expand All @@ -886,69 +886,8 @@ export class SearchIngestService {
})
)
);
const spaceLevel1Posts: any[] = [];
spaces.forEach(space =>
space?.subspaces?.forEach(subspace =>
subspace?.collaboration?.callouts?.forEach(callout =>
callout?.contributions?.forEach(contribution => {
if (!contribution.post) {
return;
}
spaceLevel1Posts.push({
...contribution.post,
type: SearchEntityTypes.POST,
license: {
visibility:
space?.account?.license?.visibility ?? EMPTY_VALUE,
},
spaceID: space.id,
challengeID: subspace.id,
calloutID: callout.id,
collaborationID: space?.collaboration?.id ?? EMPTY_VALUE,
profile: {
...contribution.post.profile,
tagsets: undefined,
tags: processTagsets(contribution.post?.profile?.tagsets),
},
});
})
)
)
);
const spaceLevel2Posts: any[] = [];
spaces.forEach(space =>
space?.subspaces?.forEach(subspace =>
subspace?.subspaces?.forEach(subsubspace =>
subsubspace?.collaboration?.callouts?.forEach(callout =>
callout?.contributions?.forEach(contribution => {
if (!contribution.post) {
return;
}
spaceLevel2Posts.push({
...contribution.post,
type: SearchEntityTypes.POST,
license: {
visibility:
space?.account?.license?.visibility ?? EMPTY_VALUE,
},
spaceID: space.id,
challengeID: subspace.id,
opportunityID: subsubspace.id,
calloutID: callout.id,
collaborationID: space?.collaboration?.id ?? EMPTY_VALUE,
profile: {
...contribution.post.profile,
tagsets: undefined,
tags: processTagsets(contribution.post?.profile?.tagsets),
},
});
})
)
)
)
);

return [...spaceLevel0Posts, ...spaceLevel1Posts, ...spaceLevel2Posts];
return posts;
});
}
}
Expand Down
1 change: 1 addition & 0 deletions src/services/task/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class TaskService {
const task = await this.getOrFail(id);

task.status = status;
task.end = new Date().getTime();

await this.cacheManager.set(task.id, task, {
ttl: TTL,
Expand Down

0 comments on commit 196ed32

Please sign in to comment.