From 33fb088b1efbb99e10e0ba4ee544f0f2561ba2fa Mon Sep 17 00:00:00 2001 From: kim jong hwa Date: Wed, 8 Nov 2023 21:00:30 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=88=98=EC=A0=95=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/events/events.controller.ts | 4 ++-- src/events/events.service.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/events/events.controller.ts b/src/events/events.controller.ts index 7b51d00..356cd80 100644 --- a/src/events/events.controller.ts +++ b/src/events/events.controller.ts @@ -59,8 +59,8 @@ export class EventsController { @Get() @ApiOperation({ summary: 'Event 전체 조회' }) @ApiOkResponse({ type: EventEntity, isArray: true }) - async findAll(@Query('lastPage', ParseIntPipe) lastPage: number) { - const events = await this.eventsService.findAll(lastPage); + async findAll(@Query('page', ParseIntPipe) page: number) { + const events = await this.eventsService.findAll(page); // 전체 조회 시 이벤트 호스트와 참가자 수 반환 const event = events.map((item) => { diff --git a/src/events/events.service.ts b/src/events/events.service.ts index 9b04350..f14cbaf 100644 --- a/src/events/events.service.ts +++ b/src/events/events.service.ts @@ -42,7 +42,7 @@ export class EventsService { } // 2. 이벤트 전체 조회 - async findAll(lastPage: number) { + async findAll(page: number) { const cachedEvents: any = await this.cacheManager.get('events'); const cachedData = cachedEvents ? JSON.parse(cachedEvents) : null; if (cachedData) { @@ -50,8 +50,8 @@ export class EventsService { } else { const events = await this.prisma.event.findMany({ take: 4, - skip: 0, - ...(lastPage && { cursor: { eventId: lastPage } }), + skip: page, + // ...(lastPage && { cursor: { eventId: lastPage } }), where: { isDeleted: false, }, @@ -77,7 +77,6 @@ export class EventsService { }, }); await this.cacheManager.set('events', JSON.stringify(events)); - console.log('events', events); return events; } } From bd1e9b7b50857811093f8ef6976d090602232dc2 Mon Sep 17 00:00:00 2001 From: kim jong hwa Date: Wed, 8 Nov 2023 21:01:24 +0900 Subject: [PATCH 2/2] pull dev branch --- src/events/events.service.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/events/events.service.ts b/src/events/events.service.ts index f14cbaf..861189b 100644 --- a/src/events/events.service.ts +++ b/src/events/events.service.ts @@ -51,7 +51,6 @@ export class EventsService { const events = await this.prisma.event.findMany({ take: 4, skip: page, - // ...(lastPage && { cursor: { eventId: lastPage } }), where: { isDeleted: false, },