forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit-template.controller.ts
More file actions
35 lines (30 loc) · 864 Bytes
/
Copy pathsplit-template.controller.ts
File metadata and controls
35 lines (30 loc) · 864 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
import {
Body,
Controller,
Get,
Param,
Post,
Req,
} from "@nestjs/common";
import { Request } from "express";
import { SplitTemplateService } from "./split-template.service";
import { CreateSplitTemplateDto } from "./dto/create-split-from-template.dto";
interface RequestWithUser extends Request {
user: { wallet: string };
}
@Controller("split-templates")
export class SplitTemplateController {
constructor(private readonly service: SplitTemplateService) {}
@Post()
create(@Req() req: RequestWithUser, @Body() dto: CreateSplitTemplateDto) {
return this.service.create(req.user.wallet, dto);
}
@Get()
findAll(@Req() req: RequestWithUser) {
return this.service.findAllForUser(req.user.wallet);
}
@Post(":id/create-split")
createSplit(@Param("id") id: string) {
return this.service.createSplitFromTemplate(id);
}
}