@@ -19,11 +19,13 @@ export class AdminInvoicesController {
|
||||
@Get()
|
||||
list(
|
||||
@Query('status') status?: string,
|
||||
@Query('invoiceNo') invoiceNo?: string,
|
||||
@Query('page') page = '1',
|
||||
@Query('pageSize') pageSize = '20',
|
||||
) {
|
||||
return this.tradeService.adminListInvoices({
|
||||
status,
|
||||
invoiceNo,
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
});
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import type { UpdateWecomPushTemplateRequest } from '@dukang/shared-types';
|
||||
import { HqAuthGuard } from '../../common/guards/hq-auth.guard';
|
||||
import {
|
||||
HqPermissionGuard,
|
||||
RequireHqPermissions,
|
||||
} from '../../common/guards/hq-permission.guard';
|
||||
import { HqOperation } from '../../common/hq-operation/hq-operation.decorator';
|
||||
import { HqOperationAction } from '../../common/hq-operation/hq-operation.constants';
|
||||
import { WecomMessagePushService } from '../../integrations/wecom/wecom-message-push.service';
|
||||
|
||||
@Controller('admin/wecom-push-templates')
|
||||
@UseGuards(HqAuthGuard, HqPermissionGuard)
|
||||
@RequireHqPermissions('wecom_bots')
|
||||
export class AdminWecomPushTemplatesController {
|
||||
constructor(private readonly wecomPush: WecomMessagePushService) {}
|
||||
|
||||
@Get()
|
||||
list() {
|
||||
return this.wecomPush.listTemplates();
|
||||
}
|
||||
|
||||
@Get(':eventKey')
|
||||
detail(@Param('eventKey') eventKey: string) {
|
||||
return this.wecomPush.getTemplate(eventKey);
|
||||
}
|
||||
|
||||
@Put(':eventKey')
|
||||
@HqOperation({
|
||||
action: HqOperationAction.WECOM_MESSAGE_PUSH_UPDATE,
|
||||
refType: 'WECOM_PUSH_TEMPLATE',
|
||||
refIdField: 'eventKey',
|
||||
includeBody: true,
|
||||
})
|
||||
update(@Param('eventKey') eventKey: string, @Body() body: UpdateWecomPushTemplateRequest) {
|
||||
return this.wecomPush.updateTemplate(eventKey, body);
|
||||
}
|
||||
|
||||
@Post(':eventKey/reset')
|
||||
@HqOperation({
|
||||
action: HqOperationAction.WECOM_MESSAGE_PUSH_UPDATE,
|
||||
refType: 'WECOM_PUSH_TEMPLATE',
|
||||
refIdField: 'eventKey',
|
||||
})
|
||||
reset(@Param('eventKey') eventKey: string) {
|
||||
return this.wecomPush.resetTemplate(eventKey);
|
||||
}
|
||||
|
||||
@Post(':eventKey/test')
|
||||
@HqOperation({
|
||||
action: HqOperationAction.WECOM_MESSAGE_PUSH_TEST,
|
||||
refType: 'WECOM_PUSH_TEMPLATE',
|
||||
refIdField: 'eventKey',
|
||||
})
|
||||
async test(@Param('eventKey') eventKey: string) {
|
||||
const result = await this.wecomPush.testTemplate(eventKey);
|
||||
if (!result.ok) throw new BadRequestException(result.message);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@ import { AdminWecomBotsController } from './admin-wecom-bots.controller';
|
||||
import { AdminWecomBotsService } from './admin-wecom-bots.service';
|
||||
import { AdminWecomMessagePushesController } from './admin-wecom-message-pushes.controller';
|
||||
import { AdminWecomMessagePushesService } from './admin-wecom-message-pushes.service';
|
||||
import { AdminWecomPushTemplatesController } from './admin-wecom-push-templates.controller';
|
||||
import { AdminWecomBotLogsController } from './admin-wecom-bot-logs.controller';
|
||||
import { AdminWecomBotLogsService } from './admin-wecom-bot-logs.service';
|
||||
import { AdminLlmConfigsController } from './admin-llm-configs.controller';
|
||||
@@ -124,6 +125,7 @@ import { AdminTestWhitelistController } from './admin-test-whitelist.controller'
|
||||
AdminSystemConfigController,
|
||||
AdminWecomBotsController,
|
||||
AdminWecomMessagePushesController,
|
||||
AdminWecomPushTemplatesController,
|
||||
AdminWecomBotLogsController,
|
||||
AdminLlmConfigsController,
|
||||
AdminKnowledgeBasesController,
|
||||
|
||||
Reference in New Issue
Block a user