From d1fb69fcc34b638c632cf4553a0596b08a1618bc Mon Sep 17 00:00:00 2001 From: koomin1227 Date: Sat, 23 Dec 2023 16:59:30 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[BE]=20Feat=20:=20=EC=BF=BC=EB=A6=AC=20?= =?UTF-8?q?=ED=8C=8C=EB=9E=8C=EC=9D=98=20page=EB=A5=BC=20cursorId=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/post/dto/postList.dto.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/src/post/dto/postList.dto.ts b/BE/src/post/dto/postList.dto.ts index 46ee25f..5281548 100644 --- a/BE/src/post/dto/postList.dto.ts +++ b/BE/src/post/dto/postList.dto.ts @@ -5,7 +5,7 @@ export class PostListDto { @IsNumber() @IsOptional() @Type(() => Number) - page: number; + cursorId: number; @IsNumber() @IsOptional() From bc2ca813b038599e4ff9049a82e22c5c9ac2fbaa Mon Sep 17 00:00:00 2001 From: koomin1227 Date: Sat, 23 Dec 2023 16:59:52 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[BE]=20Feat=20:=20=EC=9D=91=EB=8B=B5=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/post/post.repository.ts | 5 ++--- BE/src/post/post.service.ts | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/BE/src/post/post.repository.ts b/BE/src/post/post.repository.ts index 8429a5c..a502af9 100644 --- a/BE/src/post/post.repository.ts +++ b/BE/src/post/post.repository.ts @@ -26,7 +26,6 @@ export class PostRepository extends Repository { 'bu', 'bu.blocker = :blocker AND bu.blocked_user = post.user_hash', ) - .leftJoinAndSelect('post.post_images', 'pi', 'pi.post_id = post.id') .where('bp.blocked_post IS NULL') .andWhere('bu.blocked_user IS NULL') .andWhere(this.createOption(options)) @@ -65,9 +64,9 @@ export class PostRepository extends Repository { createOption(options: PostListDto) { let option = - options.page === undefined + options.cursorId === undefined ? 'post.id > -1 AND ' - : `post.id < ${options.page} AND `; + : `post.id < ${options.cursorId} AND `; if (options.requestFilter !== undefined) { option += `post.is_request = ${options.requestFilter} AND `; } diff --git a/BE/src/post/post.service.ts b/BE/src/post/post.service.ts index d7b26b2..bf52e24 100644 --- a/BE/src/post/post.service.ts +++ b/BE/src/post/post.service.ts @@ -22,13 +22,10 @@ export class PostService { return { title: filteredPost.title, price: filteredPost.price, - description: filteredPost.description, post_id: filteredPost.id, user_id: filteredPost.user_hash, is_request: filteredPost.is_request, - images: filteredPost.post_images.map( - (post_image) => post_image.image_url, - ), + post_image: filteredPost.thumbnail, start_date: filteredPost.start_date, end_date: filteredPost.end_date, }; From fabdeed4247fa521ab2d78d3c21b5d77e336ad81 Mon Sep 17 00:00:00 2001 From: koomin1227 Date: Sat, 23 Dec 2023 17:00:21 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[BE]=20Test=20:=20page=20->=20cursorId?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/post/post.repository.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BE/src/post/post.repository.spec.ts b/BE/src/post/post.repository.spec.ts index 222e505..df777ba 100644 --- a/BE/src/post/post.repository.spec.ts +++ b/BE/src/post/post.repository.spec.ts @@ -27,7 +27,7 @@ describe('', () => { describe('createPost()', () => { it('should success (nothing)', async function () { const res = repository.createOption({ - page: undefined, + cursorId: undefined, requestFilter: undefined, writer: undefined, searchKeyword: undefined, @@ -36,7 +36,7 @@ describe('', () => { }); it('should success (page)', async function () { const res = repository.createOption({ - page: 1, + cursorId: 1, requestFilter: undefined, writer: undefined, searchKeyword: undefined, @@ -45,7 +45,7 @@ describe('', () => { }); it('should success (more than two options)', async function () { const res = repository.createOption({ - page: 1, + cursorId: 1, requestFilter: undefined, writer: 'user', searchKeyword: undefined,