|
@@ -6,25 +6,25 @@ import { Request } from 'express'
|
|
@Controller('post')
|
|
@Controller('post')
|
|
export class PostController {
|
|
export class PostController {
|
|
constructor(private readonly postService: PostService) {}
|
|
constructor(private readonly postService: PostService) {}
|
|
- @Get('post')
|
|
|
|
- async getpost(@Query('id') id: number) {
|
|
|
|
- return await this.postService.getpost(id)
|
|
|
|
- }
|
|
|
|
- @Get('delete')
|
|
|
|
- async delete(@Query('postid') postid: number) {
|
|
|
|
- return await this.postService.delete(postid)
|
|
|
|
|
|
+ @Get('platelist')
|
|
|
|
+ async getpostlist(@Query('plateid') plateid: number) {
|
|
|
|
+ return await this.postService.getpostlist(+plateid)
|
|
}
|
|
}
|
|
- @Get('updated')
|
|
|
|
- async updated(@Body() { postid, title, content, plateId }) {
|
|
|
|
- return await this.postService.updated(postid, { title, content, plateId })
|
|
|
|
|
|
+ @Get()
|
|
|
|
+ async getpost(@Query('id') id: number) {
|
|
|
|
+ return await this.postService.getpost(+id)
|
|
}
|
|
}
|
|
- @Post('post')
|
|
|
|
|
|
+ @Post()
|
|
@UseGuards(AuthGuard('jwt'))
|
|
@UseGuards(AuthGuard('jwt'))
|
|
async post(@Req() req: Request, @Body() { title, content, plateid }) {
|
|
async post(@Req() req: Request, @Body() { title, content, plateid }) {
|
|
return await this.postService.post(req.user as number, plateid, { title, content })
|
|
return await this.postService.post(req.user as number, plateid, { title, content })
|
|
}
|
|
}
|
|
- @Get('platelist')
|
|
|
|
- async getpostlist(@Query('plateid') plateid: number) {
|
|
|
|
- return await this.postService.getpostlist(plateid)
|
|
|
|
|
|
+ @Delete()
|
|
|
|
+ async delete(@Query('postid') postid: number) {
|
|
|
|
+ return await this.postService.delete(+postid)
|
|
|
|
+ }
|
|
|
|
+ @Put()
|
|
|
|
+ async updated(@Body() { postid, title, content, plateId }) {
|
|
|
|
+ return await this.postService.updated(+postid, { title, content, plateId })
|
|
}
|
|
}
|
|
}
|
|
}
|