32 lines
891 B
TypeScript
32 lines
891 B
TypeScript
import { Body, Controller, Get, Param, Post, Query, UseGuards } from '@nestjs/common';
|
|
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
|
import { EventService } from './event.service';
|
|
import { EventListQueryDto, EventTimelineQueryDto } from './dto/common-query.dto';
|
|
import { CreateEventDto } from './dto/common-mutate.dto';
|
|
|
|
@Controller('common/events')
|
|
@UseGuards(JwtAuthGuard)
|
|
export class EventController {
|
|
constructor(private readonly service: EventService) {}
|
|
|
|
@Post()
|
|
create(@Body() dto: CreateEventDto) {
|
|
return this.service.create(dto);
|
|
}
|
|
|
|
@Get()
|
|
list(@Query() query: EventListQueryDto) {
|
|
return this.service.list(query);
|
|
}
|
|
|
|
@Get('timeline')
|
|
timeline(@Query() query: EventTimelineQueryDto) {
|
|
return this.service.timeline(query);
|
|
}
|
|
|
|
@Get(':id')
|
|
detail(@Param('id') id: string) {
|
|
return this.service.detail(BigInt(id));
|
|
}
|
|
}
|