diff --git a/src/data/data.controller.ts b/src/data/data.controller.ts index c669712..9a376cb 100644 --- a/src/data/data.controller.ts +++ b/src/data/data.controller.ts @@ -50,7 +50,7 @@ export class DataController { return this.dataService.filteredEventByCategory(query); } - @Get('filter/verifiy') + @Get('filter/verify') @ApiOperation({ summary: '이벤트 필터링(위치인증)' }) @ApiQuery({ name: 'verify', type: String, required: true }) filteredEventByVerify(@Query() query: Verify) { diff --git a/src/data/interface/verify.ts b/src/data/interface/verify.ts index 3e10eb5..df8c1fd 100644 --- a/src/data/interface/verify.ts +++ b/src/data/interface/verify.ts @@ -2,7 +2,7 @@ export interface Verify { verify: string; } -const verifies: Verify[] = [{ verify: 'yes' }, { verify: 'no' }]; +const verifies: Verify[] = [{ verify: '🙋‍♀️아무나' }, { verify: '🏡동네만' }]; export const toss = { category: ['☕맛집/커피', '🏃‍♂️운동/건강', '🐾애완동물', '📕공부/교육'], diff --git a/src/events/events.controller.ts b/src/events/events.controller.ts index b120949..e8850bf 100644 --- a/src/events/events.controller.ts +++ b/src/events/events.controller.ts @@ -13,6 +13,7 @@ import { ParseIntPipe, UploadedFile, UseInterceptors, + Query, } from '@nestjs/common'; import { EventsService } from './events.service'; import { CreateEventDto } from './dto/create-event.dto'; @@ -91,9 +92,8 @@ export class EventsController { @Get() @ApiOperation({ summary: 'Event 전체 조회' }) @ApiOkResponse({ type: EventEntity, isArray: true }) - async findAll() { - const events = await this.eventsService.findAll(); - console.log(events) + async findAll(@Query('lastPage', ParseIntPipe) lastPage:number) { + const events = await this.eventsService.findAll(lastPage); const event = events.map((item) => { const { GuestEvents, HostEvents, ...rest } = item; const hostUser = item.HostEvents[0].User.UserDetail; @@ -143,14 +143,14 @@ export class EventsController { const { userId } = req.user; const isJoin = await this.eventsService.isJoin(eventId, userId); if (!isJoin) { - this.eventsService.join(+eventId, userId); + this.eventsService.join(eventId, userId); this.eventsService.createRsvpLog(eventId, userId, 'applied'); // 로그 생성 - return `${eventId}번 모임 참석 신청!`; + return {userId, eventId}; } if (isJoin) { this.eventsService.cancelJoin(isJoin.guestEventId); this.eventsService.createRsvpLog(eventId, userId, 'canceled'); // 로그 생성 - return `${eventId}번 모임 신청 취소!`; + return {userId, eventId}; } } diff --git a/src/events/events.service.ts b/src/events/events.service.ts index e4937a9..58244d0 100644 --- a/src/events/events.service.ts +++ b/src/events/events.service.ts @@ -36,8 +36,11 @@ export class EventsService { return file.path } - findAll() { + findAll(lastPage: number) { return this.prisma.event.findMany({ + take: 10, + skip: lastPage ? 1 : 0, + ...(lastPage && {cursor: {eventId: lastPage}}), where: { isDeleted: false, },