Neo platform - First Version
This commit is contained in:
69
backend/src/app-builder/setup-app.controller.ts
Normal file
69
backend/src/app-builder/setup-app.controller.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Param,
|
||||
Body,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AppBuilderService } from './app-builder.service';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { TenantId } from '../tenant/tenant.decorator';
|
||||
|
||||
@Controller('setup/apps')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class SetupAppController {
|
||||
constructor(private appBuilderService: AppBuilderService) {}
|
||||
|
||||
@Get()
|
||||
async getAllApps(@TenantId() tenantId: string) {
|
||||
return this.appBuilderService.getAllApps(tenantId);
|
||||
}
|
||||
|
||||
@Get(':appSlug')
|
||||
async getApp(
|
||||
@TenantId() tenantId: string,
|
||||
@Param('appSlug') appSlug: string,
|
||||
) {
|
||||
return this.appBuilderService.getAppForSetup(tenantId, appSlug);
|
||||
}
|
||||
|
||||
@Post()
|
||||
async createApp(@TenantId() tenantId: string, @Body() data: any) {
|
||||
return this.appBuilderService.createApp(tenantId, data);
|
||||
}
|
||||
|
||||
@Put(':appSlug')
|
||||
async updateApp(
|
||||
@TenantId() tenantId: string,
|
||||
@Param('appSlug') appSlug: string,
|
||||
@Body() data: any,
|
||||
) {
|
||||
return this.appBuilderService.updateApp(tenantId, appSlug, data);
|
||||
}
|
||||
|
||||
@Post(':appSlug/pages')
|
||||
async createPage(
|
||||
@TenantId() tenantId: string,
|
||||
@Param('appSlug') appSlug: string,
|
||||
@Body() data: any,
|
||||
) {
|
||||
return this.appBuilderService.createPage(tenantId, appSlug, data);
|
||||
}
|
||||
|
||||
@Put(':appSlug/pages/:pageSlug')
|
||||
async updatePage(
|
||||
@TenantId() tenantId: string,
|
||||
@Param('appSlug') appSlug: string,
|
||||
@Param('pageSlug') pageSlug: string,
|
||||
@Body() data: any,
|
||||
) {
|
||||
return this.appBuilderService.updatePage(
|
||||
tenantId,
|
||||
appSlug,
|
||||
pageSlug,
|
||||
data,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user