-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: event module * fix: event module lint
- Loading branch information
Showing
10 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class CreateEventDto {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { PartialType } from '@nestjs/swagger'; | ||
import { CreateEventDto } from './create-event.dto'; | ||
|
||
export class UpdateEventDto extends PartialType(CreateEventDto) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class Event {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { EventController } from './event.controller'; | ||
import { EventService } from './event.service'; | ||
|
||
describe('EventController', () => { | ||
let controller: EventController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [EventController], | ||
providers: [EventService], | ||
}).compile(); | ||
|
||
controller = module.get<EventController>(EventController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { | ||
Body, | ||
Controller, | ||
Delete, | ||
Get, | ||
Param, | ||
Patch, | ||
Post, | ||
} from '@nestjs/common'; | ||
import { EventService } from './event.service'; | ||
import { CreateEventDto } from './dto/create-event.dto'; | ||
import { UpdateEventDto } from './dto/update-event.dto'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
|
||
@ApiTags('Event') | ||
@Controller('event') | ||
export class EventController { | ||
constructor(private readonly eventService: EventService) {} | ||
|
||
@Post() | ||
create(@Body() createEventDto: CreateEventDto) { | ||
return this.eventService.create(createEventDto); | ||
} | ||
|
||
@Get() | ||
findAll() { | ||
return this.eventService.findAll(); | ||
} | ||
|
||
@Get(':id') | ||
findOne(@Param('id') id: string) { | ||
return this.eventService.findOne(+id); | ||
} | ||
|
||
@Patch(':id') | ||
update(@Param('id') id: string, @Body() updateEventDto: UpdateEventDto) { | ||
return this.eventService.update(+id, updateEventDto); | ||
} | ||
|
||
@Delete(':id') | ||
remove(@Param('id') id: string) { | ||
return this.eventService.remove(+id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { EventService } from './event.service'; | ||
import { EventController } from './event.controller'; | ||
|
||
@Module({ | ||
controllers: [EventController], | ||
providers: [EventService], | ||
}) | ||
export class EventModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { EventService } from './event.service'; | ||
|
||
describe('EventService', () => { | ||
let service: EventService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [EventService], | ||
}).compile(); | ||
|
||
service = module.get<EventService>(EventService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { CreateEventDto } from './dto/create-event.dto'; | ||
import { UpdateEventDto } from './dto/update-event.dto'; | ||
|
||
@Injectable() | ||
export class EventService { | ||
create(createEventDto: CreateEventDto) { | ||
return createEventDto; | ||
} | ||
|
||
findAll() { | ||
return `This action returns all event`; | ||
} | ||
|
||
findOne(id: number) { | ||
return `This action returns a #${id} event`; | ||
} | ||
|
||
update(id: number, updateEventDto: UpdateEventDto) { | ||
return `This action updates a #${id} event` + updateEventDto; | ||
} | ||
|
||
remove(id: number) { | ||
return `This action removes a #${id} event`; | ||
} | ||
} |