diff --git a/apps/api/src/api.controller.ts b/apps/api/src/api.controller.ts index 12f80997..98fd5e2f 100644 --- a/apps/api/src/api.controller.ts +++ b/apps/api/src/api.controller.ts @@ -270,8 +270,8 @@ export class ApiController { user: comment.publisher.name, userId: comment.publisher.id, userImage: comment.publisher.image, - countLikes: comment.numberOfLikes, - countDislikes: comment.numberOfDislikes, + countLikes: comment.likes.length, + countDislikes: comment.dislikes.length, userLiked: comment.likes.includes(credentials.userId), userDisliked: comment.dislikes.includes(credentials.userId), body: comment.content, @@ -384,7 +384,7 @@ export class ApiController { ) { this.algolia('clickedObjectIDs', { eventName: 'Course Clicked', - index: 'course', + index: 'courses', userToken: credentials.userId, objectIDs: [id], }); diff --git a/apps/api/src/instructor/infrastructure/queries/get-instructor-by-id.query.ts b/apps/api/src/instructor/infrastructure/queries/get-instructor-by-id.query.ts index d28dae29..53e2e99d 100644 --- a/apps/api/src/instructor/infrastructure/queries/get-instructor-by-id.query.ts +++ b/apps/api/src/instructor/infrastructure/queries/get-instructor-by-id.query.ts @@ -27,7 +27,7 @@ export class GetInstructorByIdQuery { return { id: instructor.id, name: instructor.name, - followers: instructor.followerCount, + followers: instructor.followers.length, userFollow: instructor.followers.includes(credentials.userId), location: `${instructor.city}, ${instructor.country}`, image: instructor.image, diff --git a/apps/datasync/src/projectors/blog/algolia-blog.projector.ts b/apps/datasync/src/projectors/blog/algolia-blog.projector.ts index 3182887a..705b549f 100644 --- a/apps/datasync/src/projectors/blog/algolia-blog.projector.ts +++ b/apps/datasync/src/projectors/blog/algolia-blog.projector.ts @@ -22,7 +22,7 @@ export class AlgoliaBlogProjector implements Projector, OnModuleInit { @InjectModel(MongoBlog.name) private readonly blogModel: Model, ) { - this.index = this.algolia.initIndex('blog'); + this.index = this.algolia.initIndex('blogs'); } private index: SearchIndex; diff --git a/apps/datasync/src/projectors/course/algolia-course.projector.ts b/apps/datasync/src/projectors/course/algolia-course.projector.ts index 240d79b8..875bec20 100644 --- a/apps/datasync/src/projectors/course/algolia-course.projector.ts +++ b/apps/datasync/src/projectors/course/algolia-course.projector.ts @@ -24,7 +24,7 @@ export class AlgoliaCourseProjector @InjectModel(MongoCourse.name) private readonly courseModel: Model, ) { - this.index = this.algolia.initIndex('course'); + this.index = this.algolia.initIndex('courses'); } private index: SearchIndex; diff --git a/apps/datasync/src/projectors/events/algolia-events.projector.ts b/apps/datasync/src/projectors/events/algolia-events.projector.ts index b9f0031d..ecec5d4f 100644 --- a/apps/datasync/src/projectors/events/algolia-events.projector.ts +++ b/apps/datasync/src/projectors/events/algolia-events.projector.ts @@ -25,7 +25,7 @@ export class AlgoliaEventsProjector implements Projector { ) { this.algolia('convertedObjectIDs', { eventName: 'Course Started', - index: 'course', + index: 'courses', userToken: event.context.user, objectIDs: [event.dispatcherId], }); @@ -41,7 +41,7 @@ export class AlgoliaEventsProjector implements Projector { ) { this.algolia('convertedObjectIDs', { eventName: 'Course Watched', - index: 'course', + index: 'courses', userToken: event.context.user, objectIDs: [event.dispatcherId], }); @@ -54,7 +54,7 @@ export class AlgoliaEventsProjector implements Projector { ) { this.algolia('convertedObjectIDs', { eventName: 'Course Completed', - index: 'course', + index: 'courses', userToken: event.context.user, objectIDs: [event.dispatcherId], }); diff --git a/libs/core/src/infrastructure/search/providers/algolia-facets.service.ts b/libs/core/src/infrastructure/search/providers/algolia-facets.service.ts index aaa0dd12..c010efa2 100644 --- a/libs/core/src/infrastructure/search/providers/algolia-facets.service.ts +++ b/libs/core/src/infrastructure/search/providers/algolia-facets.service.ts @@ -15,8 +15,8 @@ export class GetPopularAlgoliaFacetsService implements Service { @InjectAlgolia() private readonly algolia: SearchClient, ) { - this.blogIndex = this.algolia.initIndex('blog'); - this.courseIndex = this.algolia.initIndex('course'); + this.blogIndex = this.algolia.initIndex('blogs'); + this.courseIndex = this.algolia.initIndex('courses'); } private blogIndex: SearchIndex; diff --git a/libs/core/src/infrastructure/search/providers/search-blogs/algolia/algolia-search-blogs.service.ts b/libs/core/src/infrastructure/search/providers/search-blogs/algolia/algolia-search-blogs.service.ts index f7833ba7..0c34f89b 100644 --- a/libs/core/src/infrastructure/search/providers/search-blogs/algolia/algolia-search-blogs.service.ts +++ b/libs/core/src/infrastructure/search/providers/search-blogs/algolia/algolia-search-blogs.service.ts @@ -23,7 +23,7 @@ export class AlgoliaSearchBlogsService implements Service { @InjectAlgolia() private readonly algolia: SearchClient, ) { - this.index = this.algolia.initIndex('blog'); + this.index = this.algolia.initIndex('blogs'); } private index: SearchIndex; diff --git a/libs/core/src/infrastructure/search/providers/search-courses/algolia/algolia-search-courses.service.ts b/libs/core/src/infrastructure/search/providers/search-courses/algolia/algolia-search-courses.service.ts index 2ad882c7..310144df 100644 --- a/libs/core/src/infrastructure/search/providers/search-courses/algolia/algolia-search-courses.service.ts +++ b/libs/core/src/infrastructure/search/providers/search-courses/algolia/algolia-search-courses.service.ts @@ -25,7 +25,7 @@ export class AlgoliaSearchCoursesService @InjectAlgolia() private readonly algolia: SearchClient, ) { - this.index = this.algolia.initIndex('course'); + this.index = this.algolia.initIndex('courses'); } private index: SearchIndex;