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() 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, 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, };