修复迁移后错误
This commit is contained in:
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user