forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit-comments.controller.ts
More file actions
38 lines (34 loc) · 1007 Bytes
/
Copy pathsplit-comments.controller.ts
File metadata and controls
38 lines (34 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {
Controller,
Post,
Get,
Delete,
Body,
Param,
Query,
Req,
} from '@nestjs/common';
import { SplitCommentService } from './provider/provider.service';
import { CreateSplitCommentDto } from './dto/split-comment.dto';
@Controller('split-comments')
export class SplitCommentsController {
constructor(private readonly splitCommentService: SplitCommentService) {}
@Post()
async create(@Body() dto: CreateSplitCommentDto, @Req() req: any) {
const userId = req.user?.id ?? 'test-user';
return this.splitCommentService.createComment(userId, dto);
}
@Get(':splitId')
async list(
@Param('splitId') splitId: string,
@Query('page') page = 1,
@Query('limit') limit = 10,
) {
return this.splitCommentService.listComments(splitId, Number(page), Number(limit));
}
@Delete(':id')
async delete(@Param('id') id: string, @Req() req: any) {
const userId = req.user?.id ?? 'test-user';
return this.splitCommentService.deleteComment(id, userId);
}
}