67 lines
1.4 KiB
TypeScript
67 lines
1.4 KiB
TypeScript
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));
|
|
}
|
|
}
|
|
|