Skip to content

Commit

Permalink
refactor: id > groupId, eventId
Browse files Browse the repository at this point in the history
  • Loading branch information
w8385 committed Apr 17, 2024
1 parent 894c026 commit fbb35bc
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
48 changes: 37 additions & 11 deletions src/event/event.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ import {
import { EventService } from './event.service';
import { CreateEventDto } from './dto/create-event.dto';
import { UpdateEventDto } from './dto/update-event.dto';
import { ApiTags } from '@nestjs/swagger';
import { ApiParam, ApiTags } from '@nestjs/swagger';

@ApiTags('Event')
@Controller('event')
@Controller('group/:groupId/event')
@ApiParam({
name: 'groupId',
required: true,
description: '모임 ID',
})
export class EventController {
constructor(private readonly eventService: EventService) {}

Expand All @@ -27,18 +32,39 @@ export class EventController {
return this.eventService.findAll();
}

@Get(':id')
findOne(@Param('id') id: string) {
return this.eventService.findOne(+id);
@Get(':eventId')
@ApiParam({
name: 'memberId',
required: true,
description: '모임 회원 ID',
})
findOne(
@Param('groupId') groupId: string,
@Param('eventId') eventId: string,
) {
return this.eventService.findOne(groupId, eventId);
}

@Patch(':id')
update(@Param('id') id: string, @Body() updateEventDto: UpdateEventDto) {
return this.eventService.update(+id, updateEventDto);
@Patch(':eventId')
@ApiParam({
name: 'memberId',
required: true,
description: '모임 회원 ID',
})
update(
@Param('eventId') eventId: string,
@Body() updateEventDto: UpdateEventDto,
) {
return this.eventService.update(+eventId, updateEventDto);
}

@Delete(':id')
remove(@Param('id') id: string) {
return this.eventService.remove(+id);
@Delete(':eventId')
@ApiParam({
name: 'memberId',
required: true,
description: '모임 회원 ID',
})
remove(@Param('eventId') eventId: string) {
return this.eventService.remove(+eventId);
}
}
15 changes: 9 additions & 6 deletions src/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ export class EventService {
return `This action returns all event`;
}

findOne(id: number) {
return `This action returns a #${id} event`;
findOne(groupId: string, eventId: string) {
return {
groupId,
eventId,
};
}

update(id: number, updateEventDto: UpdateEventDto) {
return `This action updates a #${id} event` + updateEventDto;
update(eventId: number, updateEventDto: UpdateEventDto) {
return `This action updates a #${eventId} event` + updateEventDto;
}

remove(id: number) {
return `This action removes a #${id} event`;
remove(eventId: number) {
return `This action removes a #${eventId} event`;
}
}

0 comments on commit fbb35bc

Please sign in to comment.