修复迁移后错误
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { JwtAuthGuard } from '../../../auth/guards/JwtAuthGuard';
|
||||
import { RolesGuard } from '../../../auth/guards/RolesGuard';
|
||||
import { AddonDevelopService } from '../../services/admin/AddonDevelopService';
|
||||
|
||||
@Controller('adminapi/addon/develop')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
export class AddonDevelopController {
|
||||
constructor(private readonly addonDevelopService: AddonDevelopService) {}
|
||||
|
||||
/**
|
||||
* 开发插件列表
|
||||
*/
|
||||
@Get('lists')
|
||||
async lists(@Query() query: any) {
|
||||
return this.addonDevelopService.getPage(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开发插件信息
|
||||
*/
|
||||
@Get('info/:addon_id')
|
||||
async info(@Param('addon_id') addon_id: string) {
|
||||
return this.addonDevelopService.getInfo(parseInt(addon_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建开发插件
|
||||
*/
|
||||
@Post('create')
|
||||
async create(@Body() data: {
|
||||
addon_name: string;
|
||||
addon_key: string;
|
||||
addon_desc?: string;
|
||||
addon_version?: string;
|
||||
addon_author?: string;
|
||||
addon_config?: any;
|
||||
}) {
|
||||
return this.addonDevelopService.create(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑开发插件
|
||||
*/
|
||||
@Put('edit/:addon_id')
|
||||
async edit(
|
||||
@Param('addon_id') addon_id: string,
|
||||
@Body() data: {
|
||||
addon_name?: string;
|
||||
addon_key?: string;
|
||||
addon_desc?: string;
|
||||
addon_version?: string;
|
||||
addon_author?: string;
|
||||
addon_config?: any;
|
||||
},
|
||||
) {
|
||||
return this.addonDevelopService.edit(parseInt(addon_id), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除开发插件
|
||||
*/
|
||||
@Delete('delete/:addon_id')
|
||||
async delete(@Param('addon_id') addon_id: string) {
|
||||
return this.addonDevelopService.delete(parseInt(addon_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建插件
|
||||
*/
|
||||
@Post('build/:addon_id')
|
||||
async build(@Param('addon_id') addon_id: string) {
|
||||
return this.addonDevelopService.build(parseInt(addon_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载插件
|
||||
*/
|
||||
@Get('download/:addon_id')
|
||||
async download(@Param('addon_id') addon_id: string) {
|
||||
return this.addonDevelopService.download(parseInt(addon_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件模板
|
||||
*/
|
||||
@Get('templates')
|
||||
async getTemplates() {
|
||||
return this.addonDevelopService.getTemplates();
|
||||
}
|
||||
}
|
||||
111
wwjcloud/src/common/addon/controllers/adminapi/AppController.ts
Normal file
111
wwjcloud/src/common/addon/controllers/adminapi/AppController.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { JwtAuthGuard } from '../../../auth/guards/JwtAuthGuard';
|
||||
import { RolesGuard } from '../../../auth/guards/RolesGuard';
|
||||
import { AddonAppService } from '../../services/admin/AddonAppService';
|
||||
|
||||
@Controller('adminapi/addon/app')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
export class AppController {
|
||||
constructor(private readonly addonAppService: AddonAppService) {}
|
||||
|
||||
/**
|
||||
* 插件应用列表
|
||||
*/
|
||||
@Get('lists')
|
||||
async lists(@Query() query: any) {
|
||||
return this.addonAppService.getPage(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件应用信息
|
||||
*/
|
||||
@Get('info/:app_id')
|
||||
async info(@Param('app_id') app_id: string) {
|
||||
return this.addonAppService.getInfo(parseInt(app_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加插件应用
|
||||
*/
|
||||
@Post('add')
|
||||
async add(@Body() data: {
|
||||
app_name: string;
|
||||
app_key: string;
|
||||
app_desc?: string;
|
||||
app_version?: string;
|
||||
app_author?: string;
|
||||
app_config?: any;
|
||||
status?: number;
|
||||
}) {
|
||||
return this.addonAppService.add(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑插件应用
|
||||
*/
|
||||
@Put('edit/:app_id')
|
||||
async edit(
|
||||
@Param('app_id') app_id: string,
|
||||
@Body() data: {
|
||||
app_name?: string;
|
||||
app_key?: string;
|
||||
app_desc?: string;
|
||||
app_version?: string;
|
||||
app_author?: string;
|
||||
app_config?: any;
|
||||
status?: number;
|
||||
},
|
||||
) {
|
||||
return this.addonAppService.edit(parseInt(app_id), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除插件应用
|
||||
*/
|
||||
@Delete('delete/:app_id')
|
||||
async delete(@Param('app_id') app_id: string) {
|
||||
return this.addonAppService.delete(parseInt(app_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装插件应用
|
||||
*/
|
||||
@Post('install/:app_id')
|
||||
async install(@Param('app_id') app_id: string) {
|
||||
return this.addonAppService.install(parseInt(app_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载插件应用
|
||||
*/
|
||||
@Post('uninstall/:app_id')
|
||||
async uninstall(@Param('app_id') app_id: string) {
|
||||
return this.addonAppService.uninstall(parseInt(app_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用插件应用
|
||||
*/
|
||||
@Post('enable/:app_id')
|
||||
async enable(@Param('app_id') app_id: string) {
|
||||
return this.addonAppService.enable(parseInt(app_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用插件应用
|
||||
*/
|
||||
@Post('disable/:app_id')
|
||||
async disable(@Param('app_id') app_id: string) {
|
||||
return this.addonAppService.disable(parseInt(app_id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { JwtAuthGuard } from '../../../auth/guards/JwtAuthGuard';
|
||||
import { RolesGuard } from '../../../auth/guards/RolesGuard';
|
||||
import { BackupService } from '../../services/admin/BackupService';
|
||||
|
||||
@Controller('adminapi/addon/backup')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
export class BackupController {
|
||||
constructor(private readonly backupService: BackupService) {}
|
||||
|
||||
/**
|
||||
* 备份记录列表
|
||||
*/
|
||||
@Get('lists')
|
||||
async lists(@Query() query: any) {
|
||||
return this.backupService.getPage(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 备份记录信息
|
||||
*/
|
||||
@Get('info/:backup_id')
|
||||
async info(@Param('backup_id') backup_id: string) {
|
||||
return this.backupService.getInfo(parseInt(backup_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建备份
|
||||
*/
|
||||
@Post('create')
|
||||
async create(@Body() data: {
|
||||
backup_name: string;
|
||||
backup_type: string;
|
||||
backup_config?: any;
|
||||
description?: string;
|
||||
}) {
|
||||
return this.backupService.create(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除备份记录
|
||||
*/
|
||||
@Delete('delete/:backup_id')
|
||||
async delete(@Param('backup_id') backup_id: string) {
|
||||
return this.backupService.delete(parseInt(backup_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复备份
|
||||
*/
|
||||
@Post('restore/:backup_id')
|
||||
async restore(@Param('backup_id') backup_id: string) {
|
||||
return this.backupService.restore(parseInt(backup_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载备份
|
||||
*/
|
||||
@Get('download/:backup_id')
|
||||
async download(@Param('backup_id') backup_id: string) {
|
||||
return this.backupService.download(parseInt(backup_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取正在进行的备份任务
|
||||
*/
|
||||
@Get('running')
|
||||
async getRunning() {
|
||||
return this.backupService.getRunning();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取正在进行的恢复任务
|
||||
*/
|
||||
@Get('restoring')
|
||||
async getRestoring() {
|
||||
return this.backupService.getRestoring();
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动备份
|
||||
*/
|
||||
@Post('manual')
|
||||
async manualBackup(@Body() data: { backup_name: string }) {
|
||||
return this.backupService.manualBackup(data.backup_name);
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,7 @@ export class UpgradeController {
|
||||
|
||||
@Delete('records')
|
||||
async delRecords(@Body() dto: { ids: string }) {
|
||||
return this.addonService.delUpgradeRecords(dto.ids);
|
||||
const ids = Array.isArray(dto.ids) ? dto.ids.map(id => parseInt(id)) : [parseInt(dto.ids)];
|
||||
return this.addonService.delUpgradeRecords(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
Param,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { JwtAuthGuard } from '../../../auth/guards/JwtAuthGuard';
|
||||
import { AddonApiService } from '../../services/api/AddonApiService';
|
||||
|
||||
@Controller('api/addon')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class AddonApiController {
|
||||
constructor(private readonly addonApiService: AddonApiService) {}
|
||||
|
||||
/**
|
||||
* 获取插件列表
|
||||
*/
|
||||
@Get('lists')
|
||||
async lists(@Query() query: any) {
|
||||
return this.addonApiService.getPage(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件信息
|
||||
*/
|
||||
@Get('info/:addon_id')
|
||||
async info(@Param('addon_id') addon_id: string) {
|
||||
return this.addonApiService.getInfo(parseInt(addon_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用插件
|
||||
*/
|
||||
@Get('available')
|
||||
async getAvailable(@Query() query: any) {
|
||||
return this.addonApiService.getAvailable(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件配置
|
||||
*/
|
||||
@Get('config/:addon_id')
|
||||
async getConfig(@Param('addon_id') addon_id: string) {
|
||||
return this.addonApiService.getConfig(parseInt(addon_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件状态
|
||||
*/
|
||||
@Get('status/:addon_id')
|
||||
async getStatus(@Param('addon_id') addon_id: string) {
|
||||
return this.addonApiService.getStatus(parseInt(addon_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件统计
|
||||
*/
|
||||
@Get('statistics/:addon_id')
|
||||
async getStatistics(@Param('addon_id') addon_id: string) {
|
||||
return this.addonApiService.getStatistics(parseInt(addon_id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user