ToolJet/server/src/controllers/library_apps.controller.ts

41 lines
1.4 KiB
TypeScript
Raw Normal View History

import { Controller, Post, UseGuards, Get, ForbiddenException, Body } from '@nestjs/common';
import { LibraryAppCreationService } from '@services/library_app_creation.service';
import { User } from 'src/decorators/user.decorator';
import { App } from 'src/entities/app.entity';
import { AppsAbilityFactory } from 'src/modules/casl/abilities/apps-ability.factory';
import { JwtAuthGuard } from '../../src/modules/auth/jwt-auth.guard';
import { TemplateAppManifests } from '../../templates';
@Controller('library_apps')
export class LibraryAppsController {
constructor(
private libraryAppCreationService: LibraryAppCreationService,
private appsAbilityFactory: AppsAbilityFactory
) {}
@Post()
@UseGuards(JwtAuthGuard)
async create(@User() user, @Body('identifier') identifier, @Body('appName') appName) {
const ability = await this.appsAbilityFactory.appsActions(user);
if (!ability.can('createApp', App)) {
throw new ForbiddenException('You do not have permissions to perform this action');
}
const newApp = await this.libraryAppCreationService.perform(user, identifier, appName);
return newApp;
}
Release Platform v17 (v2.39.0) (#9502) * bump version * Sample data source (#9501) * Added sample data populating script * added expand-collapse in add data soure menu * Sample database * Design changes * Added CTA to buttons and added design changes * Added code sanity fix for some services * changed configration for create sampke db and code sanity fix * Removed logs * Added xlsx in dependency * added migration for sample db * Added loggin for testing * Added await in migration * Replace excel sheet with JSON files * reverted package-lock file * Fixed issues * dependecy deletion * Added schedular * Added changes for bug fixes and typeorm query for creating sample db * Removed color.scss file import * Add logo in sample application * add documentation link for sample db * fixed migration issue for data queries creation * removed sample db intergration * bump version * Remove .env file and code sanity * deleted migration file --------- Co-authored-by: Kritagya <kriks.iitk@.com> Co-authored-by: Kritagya Kumar <kritagyakumar@192.168.1.6> Co-authored-by: kriks7raptor <kritagya@raptorx.ai> Co-authored-by: gsmithun4 <gsmithun4@gmail.com> * Add data-cy for drag drop empty canvas card (#9513) * Add sample db condition on all components (#9516) * Add sample db condition on all components * Changed empty state for container * Condiiton on sample data source --------- Co-authored-by: kriks7raptor <kritagya@raptorx.ai> * Release fix: subpath (#9535) * Add sample db condition on all components * Changed empty state for container * Condiiton on sample data source * fixed subpath issue for workspace setting and folders * Folder change handler in subpath --------- Co-authored-by: kriks7raptor <kritagya@raptorx.ai> * fixed version * fixed version * fixed version * update server version * Bump version to v2.39.0 --------- Co-authored-by: kriks7iitk <34170719+kriks7iitk@users.noreply.github.com> Co-authored-by: Kritagya <kriks.iitk@.com> Co-authored-by: Kritagya Kumar <kritagyakumar@192.168.1.6> Co-authored-by: kriks7raptor <kritagya@raptorx.ai> Co-authored-by: Ajith KV <ajith.jaban@gmail.com> Co-authored-by: kriks7iitk <kriks.iitk@gmail.com> Co-authored-by: Adish M <44204658+adishM98@users.noreply.github.com> Co-authored-by: Muhsin Shah <muhsinshah21@gmail.com>
2024-04-30 16:19:37 +00:00
@Get('sample-app')
@UseGuards(JwtAuthGuard)
async createSampleApp(@User() user) {
return await this.libraryAppCreationService.createSampleApp(user);
}
@Get()
@UseGuards(JwtAuthGuard)
async index() {
return { template_app_manifests: TemplateAppManifests };
}
}