feat: implement project settings management with CRUD operations and caching
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { Controller, Inject, Post, UseGuards } from "@nestjs/common";
|
||||
import { Controller, Inject, Post, Req, UseGuards } from "@nestjs/common";
|
||||
import { ApiTokenGuard } from "src/api/guards/api-token.guard";
|
||||
import { FunctionService } from "./function.service";
|
||||
import { Token } from "src/api/entities/token.entity";
|
||||
|
||||
@Controller("functions")
|
||||
@UseGuards(ApiTokenGuard)
|
||||
@ -11,12 +12,19 @@ export class FunctionController {
|
||||
) {}
|
||||
|
||||
@Post("create")
|
||||
async createFunction(projectId: string, name: string, source: string) {
|
||||
return this.functionService.create(projectId, name, source);
|
||||
async createFunction(
|
||||
@Req() req: Request & { apiToken: Token },
|
||||
name: string,
|
||||
source: string
|
||||
) {
|
||||
return this.functionService.create(req.apiToken.project.id, name, source);
|
||||
}
|
||||
|
||||
@Post("delete")
|
||||
async deleteFunction(projectId: string, name: string) {
|
||||
return this.functionService.deleteFunction(projectId, name);
|
||||
async deleteFunction(
|
||||
@Req() req: Request & { apiToken: Token },
|
||||
name: string
|
||||
) {
|
||||
return this.functionService.deleteFunction(req.apiToken.project.id, name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user