From f82dabc7ed4f90340d269461d9efe3285fee7854 Mon Sep 17 00:00:00 2001 From: Shiorin Date: Thu, 9 Dec 2021 08:14:45 +0700 Subject: [PATCH 1/4] =?UTF-8?q?=20[API]=20=E0=B9=80=E0=B8=A1=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=AD=E0=B8=99=E0=B8=B8=E0=B8=A1=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=E0=B9=82=E0=B8=9E=E0=B8=AA=E0=B9=80=E0=B8=95?= =?UTF-8?q?=E0=B8=B4=E0=B8=A1=E0=B9=80=E0=B8=95=E0=B9=87=E0=B8=A1=20?= =?UTF-8?q?=E0=B9=81=E0=B8=A5=E0=B9=89=E0=B8=A7=E0=B8=88=E0=B8=B3=E0=B8=99?= =?UTF-8?q?=E0=B8=A7=E0=B8=99=20repost=20=E0=B9=84=E0=B8=A1=E0=B9=88?= =?UTF-8?q?=E0=B8=82=E0=B8=B6=E0=B9=89=E0=B8=99=20#382?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api-spanboon/src/api/controllers/FulfillmentCaseController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-spanboon/src/api/controllers/FulfillmentCaseController.ts b/api-spanboon/src/api/controllers/FulfillmentCaseController.ts index fd852f0b7..b2a1f6ff1 100644 --- a/api-spanboon/src/api/controllers/FulfillmentCaseController.ts +++ b/api-spanboon/src/api/controllers/FulfillmentCaseController.ts @@ -3072,7 +3072,7 @@ export class FulfillmentController { postPage.deleted = false; postPage.ownerUser = new ObjectID(userId); postPage.commentCount = 0; - postPage.repostCount = 0; + postPage.repostCount = 1; // set to 1 because we auto repost for user at the end of method. postPage.shareCount = 0; postPage.likeCount = 0; postPage.viewCount = 0; From 8997e535cce8a2f336f0340f1ccb8c2ffdc9eeae Mon Sep 17 00:00:00 2001 From: Shiorin Date: Thu, 9 Dec 2021 09:43:17 +0700 Subject: [PATCH 2/4] fix isRepost flag display not correct. --- api-spanboon/src/api/controllers/PagePostController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-spanboon/src/api/controllers/PagePostController.ts b/api-spanboon/src/api/controllers/PagePostController.ts index 13d1c5fc2..86e19de9b 100644 --- a/api-spanboon/src/api/controllers/PagePostController.ts +++ b/api-spanboon/src/api/controllers/PagePostController.ts @@ -1269,9 +1269,9 @@ export class PagePostController { const pageId = posts.pageId; const referencePost = posts.referencePost; if (pageId !== null && pageId !== undefined && pageId !== '') { - postsMap[pageId + ':' + referencePost + ':' + uId] = posts; + postsMap[pageId + ':' + referencePost + ':' + posts.postAsPage] = posts; } else { - postsMap[referencePost + ':' + uId] = posts; + postsMap[referencePost + ':' + posts.ownerUser] = posts; } } } From a771c7e90f097580a9da35feaa5206a9f4fab45b Mon Sep 17 00:00:00 2001 From: Shiorin Date: Thu, 9 Dec 2021 11:35:37 +0700 Subject: [PATCH 3/4] remove fulfillment type from main page --- .../src/api/processors/UserFollowSectionProcessor.ts | 4 ++++ .../src/api/processors/UserRecommendSectionProcessor.ts | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts b/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts index 033385c8c..4fd4bcb2a 100644 --- a/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts +++ b/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts @@ -19,6 +19,7 @@ import { S3Service } from '../services/S3Service'; import { ObjectID } from 'mongodb'; import moment from 'moment'; import { PLATFORM_NAME_TH } from '../../constants/SystemConfig'; +import { POST_TYPE } from '../../constants/PostType'; export class UserFollowSectionProcessor extends AbstractSectionModelProcessor { @@ -131,6 +132,9 @@ export class UserFollowSectionProcessor extends AbstractSectionModelProcessor { lastestFilter.whereConditions.deleted = false; lastestFilter.whereConditions.hidden = false; lastestFilter.whereConditions.startDateTime = { $lte: today }; + lastestFilter.whereConditions.type= { + $nin: [POST_TYPE.FULFILLMENT] + }; // remove fulfillment post type comment this for showing all post type. // overide start datetime const dateTimeAndArray = []; diff --git a/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts b/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts index 35c19c514..52b62e617 100644 --- a/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts +++ b/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts @@ -16,6 +16,7 @@ import moment from 'moment'; import { PLATFORM_NAME_TH } from '../../constants/SystemConfig'; import { ObjectID } from 'mongodb'; import { S3Service } from '../services/S3Service'; +import { POST_TYPE } from '../../constants/PostType'; export class UserRecommendSectionProcessor extends AbstractSectionModelProcessor { @@ -90,8 +91,11 @@ export class UserRecommendSectionProcessor extends AbstractSectionModelProcessor const matchStmt: any = { isDraft: false, deleted: false, - hidden: false - }; + hidden: false, + type: { + $nin: [POST_TYPE.FULFILLMENT] // remove fulfillment post type comment this for showing all post type. + } + }; if (userId !== undefined && userId !== '') { // ! impl } else if (clientId !== undefined) { From c5e95d3327421b4704efe9052d6cc80e33f355c2 Mon Sep 17 00:00:00 2001 From: Shiorin Date: Thu, 9 Dec 2021 13:40:42 +0700 Subject: [PATCH 4/4] package json --- api-spanboon/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/api-spanboon/package.json b/api-spanboon/package.json index 7a631c7d2..9ac315c77 100755 --- a/api-spanboon/package.json +++ b/api-spanboon/package.json @@ -79,6 +79,7 @@ "graphql": "15.4.0", "helmet": "^4.2.0", "imagemagick": "^0.1.3", + "jsdom": "^17.0.0", "jsonfile": "6.1.0", "jsonwebtoken": "^8.5.1", "lodash": "^4.17.21",