init studio admin backend
This commit is contained in:
@@ -0,0 +1,261 @@
|
||||
import { IsBoolean, IsIn, IsInt, IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
|
||||
export class CreateLauncherVersionDto {
|
||||
@IsString()
|
||||
version!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
minimumVersion?: string;
|
||||
|
||||
@IsString()
|
||||
artifact!: string;
|
||||
|
||||
@IsString()
|
||||
downloadUrl!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
releaseNotes?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
repository?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
branch?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
commitSha?: string;
|
||||
}
|
||||
|
||||
export class UpdateLauncherSourceDto {
|
||||
@IsString()
|
||||
repository!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
branch?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
commitSha?: string;
|
||||
}
|
||||
|
||||
export class LinkLauncherVersionSourceDto {
|
||||
@IsString()
|
||||
repository!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
branch?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
commitSha?: string;
|
||||
}
|
||||
|
||||
|
||||
export class CreateLauncherBuildJobDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
target?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
repository?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
branch?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
commitSha?: string;
|
||||
|
||||
@IsString()
|
||||
version!: string;
|
||||
|
||||
@IsString()
|
||||
artifact!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
uploadPath?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
downloadUrl?: string;
|
||||
}
|
||||
|
||||
|
||||
export class CreateLauncherAppLinkDto {
|
||||
@IsUUID()
|
||||
appId!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
releaseId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
displayOrder?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
displayName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
subtitle?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
detailUrl?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
videoPath?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
iconKey?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
launchUrl?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
devAppPath?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
execPath?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
artifact?: string;
|
||||
}
|
||||
|
||||
export class UpdateLauncherAppLinkDto {
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
releaseId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
displayOrder?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isEnabled?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
displayName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
subtitle?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
detailUrl?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
videoPath?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
iconKey?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
launchUrl?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
devAppPath?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
execPath?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
artifact?: string;
|
||||
}
|
||||
|
||||
export class MoveLauncherAppLinkDto {
|
||||
@IsIn(['up', 'down'])
|
||||
direction!: 'up' | 'down';
|
||||
}
|
||||
|
||||
|
||||
export class CreateLauncherCommonSettingDto {
|
||||
@IsString()
|
||||
key!: string;
|
||||
|
||||
@IsString()
|
||||
name!: string;
|
||||
|
||||
@IsString()
|
||||
type!: string;
|
||||
|
||||
@IsString()
|
||||
value!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isSecret?: boolean;
|
||||
}
|
||||
|
||||
export class UpdateLauncherCommonSettingDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
key?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
type?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
value?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isSecret?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
|
||||
|
||||
import { CreateLauncherAppLinkDto, CreateLauncherBuildJobDto, CreateLauncherCommonSettingDto, CreateLauncherVersionDto, UpdateLauncherSourceDto, LinkLauncherVersionSourceDto, MoveLauncherAppLinkDto, UpdateLauncherAppLinkDto, UpdateLauncherCommonSettingDto } from './dto';
|
||||
import { LauncherService } from './launcher.service';
|
||||
|
||||
@Controller('launcher')
|
||||
export class LauncherController {
|
||||
constructor(private readonly launcherService: LauncherService) {}
|
||||
|
||||
@Get('versions')
|
||||
listVersions() {
|
||||
return this.launcherService.listVersions();
|
||||
}
|
||||
|
||||
@Post('versions')
|
||||
createVersion(@Body() body: CreateLauncherVersionDto) {
|
||||
return this.launcherService.createVersion(body);
|
||||
}
|
||||
|
||||
@Get('source')
|
||||
getSource() {
|
||||
return this.launcherService.getSource();
|
||||
}
|
||||
|
||||
@Patch('source')
|
||||
updateSource(@Body() body: UpdateLauncherSourceDto) {
|
||||
return this.launcherService.updateSource(body);
|
||||
}
|
||||
|
||||
@Get('builds')
|
||||
listBuildJobs() {
|
||||
return this.launcherService.listBuildJobs();
|
||||
}
|
||||
|
||||
@Post('builds')
|
||||
createBuildJob(@Body() body: CreateLauncherBuildJobDto) {
|
||||
return this.launcherService.createBuildJob(body);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Get('common-settings')
|
||||
listCommonSettings() {
|
||||
return this.launcherService.listCommonSettings();
|
||||
}
|
||||
|
||||
@Post('common-settings')
|
||||
createCommonSetting(@Body() body: CreateLauncherCommonSettingDto) {
|
||||
return this.launcherService.createCommonSetting(body);
|
||||
}
|
||||
|
||||
@Patch('common-settings/:id')
|
||||
updateCommonSetting(
|
||||
@Param('id') id: string,
|
||||
@Body() body: UpdateLauncherCommonSettingDto,
|
||||
) {
|
||||
return this.launcherService.updateCommonSetting(id, body);
|
||||
}
|
||||
|
||||
@Delete('common-settings/:id')
|
||||
deleteCommonSetting(@Param('id') id: string) {
|
||||
return this.launcherService.deleteCommonSetting(id);
|
||||
}
|
||||
|
||||
@Get('app-links')
|
||||
listAppLinks() {
|
||||
return this.launcherService.listAppLinks();
|
||||
}
|
||||
|
||||
@Post('app-links')
|
||||
createAppLink(@Body() body: CreateLauncherAppLinkDto) {
|
||||
return this.launcherService.createAppLink(body);
|
||||
}
|
||||
|
||||
@Post('app-links/sync-admin-apps')
|
||||
syncAdminAppsFromLauncher() {
|
||||
return this.launcherService.syncAdminAppsFromLauncher();
|
||||
}
|
||||
|
||||
@Patch('app-links/:id')
|
||||
updateAppLink(
|
||||
@Param('id') id: string,
|
||||
@Body() body: UpdateLauncherAppLinkDto,
|
||||
) {
|
||||
return this.launcherService.updateAppLink(id, body);
|
||||
}
|
||||
|
||||
@Patch('app-links/:id/move')
|
||||
moveAppLink(
|
||||
@Param('id') id: string,
|
||||
@Body() body: MoveLauncherAppLinkDto,
|
||||
) {
|
||||
return this.launcherService.moveAppLink(id, body.direction);
|
||||
}
|
||||
|
||||
@Delete('app-links/:id')
|
||||
deleteAppLink(@Param('id') id: string) {
|
||||
return this.launcherService.deleteAppLink(id);
|
||||
}
|
||||
|
||||
@Patch('versions/:id/source')
|
||||
linkVersionSource(
|
||||
@Param('id') id: string,
|
||||
@Body() body: LinkLauncherVersionSourceDto,
|
||||
) {
|
||||
return this.launcherService.linkVersionSource(id, body);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { PrismaModule } from '../prisma/prisma.module';
|
||||
import { LauncherPrismaModule } from '../launcher-prisma/launcher-prisma.module';
|
||||
import { LauncherController } from './launcher.controller';
|
||||
import { LauncherService } from './launcher.service';
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule, LauncherPrismaModule],
|
||||
controllers: [LauncherController],
|
||||
providers: [LauncherService],
|
||||
exports: [LauncherService],
|
||||
})
|
||||
export class LauncherModule {}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user