Skip to content

Commit

Permalink
Merge pull request #31 from LocalMingle/dev
Browse files Browse the repository at this point in the history
[작업완료]: 이벤트 참가시 reponse값 수정
  • Loading branch information
kimjonghwa230412 authored Oct 19, 2023
2 parents cf2294e + 3cc6895 commit fa37ff4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/data/data.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/data/interface/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: ['☕맛집/커피', '🏃‍♂️운동/건강', '🐾애완동물', '📕공부/교육'],
Expand Down
12 changes: 6 additions & 6 deletions src/events/events.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ParseIntPipe,
UploadedFile,
UseInterceptors,
Query,
} from '@nestjs/common';
import { EventsService } from './events.service';
import { CreateEventDto } from './dto/create-event.dto';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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};
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/events/events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit fa37ff4

Please sign in to comment.