Skip to content

Commit

Permalink
Merge pull request #128 from LocalMingle/jonghwa
Browse files Browse the repository at this point in the history
[작업완료]: 배포 전 콘솔로그 제거
  • Loading branch information
kimjonghwa230412 authored Nov 3, 2023
2 parents 55541b1 + 8a69eb4 commit 8c02d44
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 110 deletions.
92 changes: 0 additions & 92 deletions .github/workflows/nest_lm copy 2.yml

This file was deleted.

2 changes: 2 additions & 0 deletions src/events/dto/update-event.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Min,
MaxLength,
IsNotEmpty,
Max,
} from 'class-validator';

export class UpdateEventDto {
Expand All @@ -18,6 +19,7 @@ export class UpdateEventDto {
@IsNotEmpty()
@ApiProperty()
@Min(1)
@Max(50)
maxSize: number;

@IsNotEmpty()
Expand Down
24 changes: 12 additions & 12 deletions src/events/events.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class EventsController {
// 전체 조회 시 이벤트 호스트와 참가자 수 반환
const event = events.map((item) => {
const { GuestEvents, HostEvents, ...rest } = item;
const hostUser = HostEvents[0]?.User?.UserDetail || null
const hostUser = HostEvents[0].User.UserDetail;

return {
event: rest,
Expand Down Expand Up @@ -95,7 +95,7 @@ export class EventsController {
const { GuestEvents, HostEvents, ...rest } = event;

// 조회수 로그 생성
await this.eventsService.createViewLog(eventId);
await this.eventsService.createViewLog(eventId, userId);

return {
event: rest,
Expand Down Expand Up @@ -126,18 +126,18 @@ export class EventsController {
return {
message: `참가인원은 최대${event.maxSize}명 입니다`,
};
}
}

this.eventsService.join(eventId, userId);
this.eventsService.createRsvpLog(eventId, userId, 'applied'); // 참가 신청 로그 생성
return {
message: `${eventId}번 모임 참가 신청`,
confirm: true
}
confirm: true,
};
} else {
return {
message: '이미 참석한 이벤트입니다'
}
message: '이미 참석한 이벤트입니다',
};
}
}
// 4-1. 이벤트 참가 취소
Expand All @@ -158,13 +158,13 @@ export class EventsController {
this.eventsService.createRsvpLog(eventId, userId, 'canceled');
} else {
return {
message: '참석한 이벤트만 취소할 수 있습니다'
}
message: '참석한 이벤트만 취소할 수 있습니다',
};
}
return {
message: `${eventId}번 모임 참가 취소`,
confirm: false
}
confirm: false,
};
}

// 5. 이벤트 수정
Expand Down
4 changes: 2 additions & 2 deletions src/events/events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ export class EventsService {
}

// 3-1. 이벤트 조회수 로거
async createViewLog(eventId: number) {
async createViewLog(eventId: number, userId: number) {
await this.prisma.viewlog.create({
data: {
EventId: eventId,
UserId: 1,
UserId: userId,
},
});
}
Expand Down
6 changes: 2 additions & 4 deletions src/searches/searches.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export class SearchesController {

@Get()
@ApiOperation({ summary: '키워드 검색, 카테고리, 지역, 위치인증 필터링' })
async searchByLocation(@Query() searchesDto: SearchesDto) {
async searchBy(@Query() searchesDto: SearchesDto) {

const events = await this.searchesService.search(searchesDto);

const event = events.map((item) => {
const { GuestEvents, HostEvents, ...rest } = item;
const hostUser = HostEvents[0].User.UserDetail;
const hostUser = HostEvents[0]?.User?.UserDetail || null

return {
event: rest,
Expand All @@ -26,7 +26,5 @@ export class SearchesController {
};
});
return event;

}

}

0 comments on commit 8c02d44

Please sign in to comment.