init studio admin backend
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common';
|
||||
|
||||
import { LinkComponentSourceDto } from '../gitea/dto';
|
||||
import { AppsService } from './apps.service';
|
||||
import {
|
||||
CreateAppComponentDto,
|
||||
CreateAppDto,
|
||||
CreateAppReleaseDto,
|
||||
CreateBuildJobDto,
|
||||
CreateDeploymentJobDto,
|
||||
CreateMigrationJobDto,
|
||||
CreateRuntimeEnvProfileDto,
|
||||
CreateRuntimeEnvVariableDto,
|
||||
CreateRuntimeIngressRuleDto,
|
||||
EnsureRuntimeNamespaceDto,
|
||||
} from './dto';
|
||||
|
||||
@Controller('apps')
|
||||
export class AppsController {
|
||||
constructor(private readonly appsService: AppsService) {}
|
||||
|
||||
@Get()
|
||||
listApps() {
|
||||
return this.appsService.listApps();
|
||||
}
|
||||
|
||||
@Post()
|
||||
createApp(@Body() body: CreateAppDto) {
|
||||
return this.appsService.createApp(body);
|
||||
}
|
||||
|
||||
@Delete(':appId')
|
||||
deleteApp(@Param('appId') appId: string) {
|
||||
return this.appsService.deleteApp(appId);
|
||||
}
|
||||
|
||||
@Post(':appId/components')
|
||||
createComponent(
|
||||
@Param('appId') appId: string,
|
||||
@Body() body: CreateAppComponentDto,
|
||||
) {
|
||||
return this.appsService.createComponent(appId, body);
|
||||
}
|
||||
|
||||
@Patch('components/:componentId')
|
||||
updateComponent(
|
||||
@Param('componentId') componentId: string,
|
||||
@Body() body: CreateAppComponentDto,
|
||||
) {
|
||||
return this.appsService.updateComponent(componentId, body);
|
||||
}
|
||||
|
||||
@Delete('components/:componentId')
|
||||
deleteComponent(@Param('componentId') componentId: string) {
|
||||
return this.appsService.deleteComponent(componentId);
|
||||
}
|
||||
|
||||
@Get('sources')
|
||||
listSources() {
|
||||
return this.appsService.listSources();
|
||||
}
|
||||
|
||||
@Get('builds')
|
||||
listBuildJobs(@Query('appKey') appKey?: string) {
|
||||
return this.appsService.listBuildJobs(appKey);
|
||||
}
|
||||
|
||||
@Post('builds')
|
||||
createBuildJob(@Body() body: CreateBuildJobDto) {
|
||||
return this.appsService.createBuildJob(body);
|
||||
}
|
||||
|
||||
@Patch('builds/:buildJobId/cancel')
|
||||
cancelBuildJob(@Param('buildJobId') buildJobId: string) {
|
||||
return this.appsService.cancelBuildJob(buildJobId);
|
||||
}
|
||||
|
||||
@Delete('builds/:buildJobId')
|
||||
deleteBuildJob(@Param('buildJobId') buildJobId: string) {
|
||||
return this.appsService.deleteBuildJob(buildJobId);
|
||||
}
|
||||
|
||||
@Patch('components/:componentId/source')
|
||||
linkComponentSource(
|
||||
@Param('componentId') componentId: string,
|
||||
@Body() body: LinkComponentSourceDto,
|
||||
) {
|
||||
return this.appsService.linkComponentSource(componentId, body);
|
||||
}
|
||||
|
||||
@Get('releases')
|
||||
listReleases(@Query('appKey') appKey?: string) {
|
||||
return this.appsService.listReleases(appKey);
|
||||
}
|
||||
|
||||
@Post('releases')
|
||||
createRelease(@Body() body: CreateAppReleaseDto) {
|
||||
return this.appsService.createRelease(body);
|
||||
}
|
||||
|
||||
@Get('deployments')
|
||||
listDeployments(@Query('appKey') appKey?: string) {
|
||||
return this.appsService.listDeployments(appKey);
|
||||
}
|
||||
|
||||
@Post('deployments')
|
||||
createDeploymentJob(@Body() body: CreateDeploymentJobDto) {
|
||||
return this.appsService.createDeploymentJob(body);
|
||||
}
|
||||
|
||||
@Get('migrations')
|
||||
listMigrationJobs() {
|
||||
return this.appsService.listMigrationJobs();
|
||||
}
|
||||
|
||||
@Post('migrations')
|
||||
createMigrationJob(@Body() body: CreateMigrationJobDto) {
|
||||
return this.appsService.createMigrationJob(body);
|
||||
}
|
||||
|
||||
@Get('runtime-namespaces/:namespace')
|
||||
checkRuntimeNamespace(@Param('namespace') namespace: string) {
|
||||
return this.appsService.checkRuntimeNamespace(namespace);
|
||||
}
|
||||
|
||||
@Get('runtime-namespaces/:namespace/resources')
|
||||
listRuntimeResources(@Param('namespace') namespace: string) {
|
||||
return this.appsService.listRuntimeResources(namespace);
|
||||
}
|
||||
|
||||
@Post('runtime-namespaces')
|
||||
ensureRuntimeNamespace(@Body() body: EnsureRuntimeNamespaceDto) {
|
||||
return this.appsService.ensureRuntimeNamespace(body);
|
||||
}
|
||||
|
||||
@Patch('runtime-deployments/:namespace/:deploymentName/restart')
|
||||
restartRuntimeDeployment(
|
||||
@Param('namespace') namespace: string,
|
||||
@Param('deploymentName') deploymentName: string,
|
||||
) {
|
||||
return this.appsService.restartRuntimeDeployment(namespace, deploymentName);
|
||||
}
|
||||
|
||||
@Get('runtime-profiles')
|
||||
listRuntimeProfiles(@Query('appId') appId?: string) {
|
||||
return this.appsService.listRuntimeProfiles(appId);
|
||||
}
|
||||
|
||||
@Post('runtime-profiles')
|
||||
createRuntimeProfile(@Body() body: CreateRuntimeEnvProfileDto) {
|
||||
return this.appsService.createRuntimeProfile(body);
|
||||
}
|
||||
|
||||
@Post('runtime-profiles/:profileId/variables')
|
||||
createRuntimeVariable(
|
||||
@Param('profileId') profileId: string,
|
||||
@Body() body: CreateRuntimeEnvVariableDto,
|
||||
) {
|
||||
return this.appsService.createRuntimeVariable(profileId, body);
|
||||
}
|
||||
|
||||
@Post('runtime-profiles/:profileId/ingress-rules')
|
||||
createRuntimeIngressRule(
|
||||
@Param('profileId') profileId: string,
|
||||
@Body() body: CreateRuntimeIngressRuleDto,
|
||||
) {
|
||||
return this.appsService.createRuntimeIngressRule(profileId, body);
|
||||
}
|
||||
|
||||
@Delete('runtime-profiles/:profileId/ingress-rules/:ruleId')
|
||||
deleteRuntimeIngressRule(
|
||||
@Param('profileId') profileId: string,
|
||||
@Param('ruleId') ruleId: string,
|
||||
) {
|
||||
return this.appsService.deleteRuntimeIngressRule(profileId, ruleId);
|
||||
}
|
||||
|
||||
@Delete('runtime-profiles/:profileId/variables/:variableId')
|
||||
deleteRuntimeVariable(
|
||||
@Param('profileId') profileId: string,
|
||||
@Param('variableId') variableId: string,
|
||||
) {
|
||||
return this.appsService.deleteRuntimeVariable(profileId, variableId);
|
||||
}
|
||||
|
||||
@Patch('runtime-profiles/:profileId/apply')
|
||||
applyRuntimeProfile(@Param('profileId') profileId: string) {
|
||||
return this.appsService.applyRuntimeProfile(profileId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user