From 792426e32ed341f5aa0f8f3a82a2752a14b14f69 Mon Sep 17 00:00:00 2001 From: Shiorin Date: Wed, 8 Dec 2021 16:05:40 +0700 Subject: [PATCH] =?UTF-8?q?=20[API]=20=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=E0=B9=83=E0=B8=AB=E0=B9=89=E0=B8=8B=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=99=20story=20=E0=B9=83=E0=B8=99=20/main/content/search?= =?UTF-8?q?=20#385?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/controllers/MainPageController.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api-spanboon/src/api/controllers/MainPageController.ts b/api-spanboon/src/api/controllers/MainPageController.ts index 5afccdd0b..32845c989 100644 --- a/api-spanboon/src/api/controllers/MainPageController.ts +++ b/api-spanboon/src/api/controllers/MainPageController.ts @@ -665,7 +665,7 @@ export class MainPageController { * HTTP/1.1 500 Internal Server Error */ @Post('/content/search') - public async searchContentAll(@Body({ validate: true }) data: ContentSearchRequest, @Res() res: any, @Req() req: any): Promise { + public async searchContentAll(@Body({ validate: true }) data: ContentSearchRequest, @QueryParam('isHideStory') isHideStory: boolean, @Res() res: any, @Req() req: any): Promise { try { const uId = req.headers.userid; let search: any = {}; @@ -1211,6 +1211,18 @@ export class MainPageController { } } + searchResults.map((dataMap) => { + const story = dataMap.post.story; + + if (isHideStory === true) { + if (story !== null && story !== undefined) { + dataMap.post.story = {}; + } else { + dataMap.post.story = null; + } + } + }); + search = searchResults; if (search !== null && search !== undefined && Object.keys(search).length > 0) {