mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
27 lines
868 B
TypeScript
27 lines
868 B
TypeScript
import { Controller, Param, Post, Put, Request, UseGuards } from '@nestjs/common';
|
|
import { decamelizeKeys } from 'humps';
|
|
import { JwtAuthGuard } from '../../src/modules/auth/jwt-auth.guard';
|
|
import { FolderAppsService } from '../services/folder_apps.service';
|
|
|
|
@Controller('folder_apps')
|
|
export class FolderAppsController {
|
|
constructor(private folderAppsService: FolderAppsService) {}
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
@Post()
|
|
async create(@Request() req) {
|
|
const folderId = req.body.folder_id;
|
|
const appId = req.body.app_id;
|
|
|
|
const folder = await this.folderAppsService.create(folderId, appId);
|
|
return decamelizeKeys(folder);
|
|
}
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
@Put('/:folderId')
|
|
async remove(@Request() req, @Param('folderId') folderId: string) {
|
|
const appId = req.body.app_id;
|
|
|
|
await this.folderAppsService.remove(folderId, appId);
|
|
}
|
|
}
|