94 lines
3.0 KiB
TypeScript
94 lines
3.0 KiB
TypeScript
import { Body, Controller, Get, Param, Post, Put } from '@nestjs/common';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import { TenantId } from '../common/tenant-id.decorator';
|
|
import {
|
|
CreateSignatureMaterialDto,
|
|
CreateSmsApplicationDto,
|
|
CreateSmsSignatureDto,
|
|
CreateSmsTemplateDto,
|
|
StatusChangeDto,
|
|
SmsConfigService,
|
|
UpdateSmsTemplateDto,
|
|
} from './sms-config.service';
|
|
|
|
@ApiTags('client-sms-config')
|
|
@Controller('client')
|
|
export class ClientSmsConfigController {
|
|
constructor(private readonly smsConfig: SmsConfigService) {}
|
|
|
|
@Get('applications')
|
|
listApplications(@TenantId() tenantId?: string) {
|
|
return this.smsConfig.listApplications(tenantId);
|
|
}
|
|
|
|
@Post('applications')
|
|
createApplication(@Body() body: CreateSmsApplicationDto) {
|
|
return this.smsConfig.createApplication(body);
|
|
}
|
|
|
|
@Get('applications/:id/cmpp-params')
|
|
getApplicationCmppParams(@Param('id') applicationId: string, @TenantId() tenantId?: string) {
|
|
return this.smsConfig.getApplicationCmppParams(applicationId, tenantId);
|
|
}
|
|
|
|
@Post('applications/:id/secret/reset')
|
|
resetApplicationSecret(@Param('id') applicationId: string, @Body() body: StatusChangeDto) {
|
|
return this.smsConfig.resetApplicationSecret(applicationId, body);
|
|
}
|
|
|
|
@Post('applications/:id/status')
|
|
changeApplicationStatus(@Param('id') applicationId: string, @Body() body: StatusChangeDto) {
|
|
return this.smsConfig.changeApplicationStatus(applicationId, body);
|
|
}
|
|
|
|
@Get('signatures')
|
|
listSignatures(@TenantId() tenantId?: string) {
|
|
return this.smsConfig.listSignatures(tenantId);
|
|
}
|
|
|
|
@Post('signatures')
|
|
createSignature(@Body() body: CreateSmsSignatureDto) {
|
|
return this.smsConfig.createSignature(body);
|
|
}
|
|
|
|
@Post('signatures/:id/materials')
|
|
createSignatureMaterial(@Param('id') signatureId: string, @Body() body: Omit<CreateSignatureMaterialDto, 'signatureId'>) {
|
|
return this.smsConfig.createSignatureMaterial({ ...body, signatureId });
|
|
}
|
|
|
|
@Post('signatures/:id/submit')
|
|
submitSignature(@Param('id') signatureId: string) {
|
|
return this.smsConfig.submitSignature(signatureId);
|
|
}
|
|
|
|
@Post('signatures/:id/status')
|
|
changeSignatureStatus(@Param('id') signatureId: string, @Body() body: StatusChangeDto) {
|
|
return this.smsConfig.changeSignatureStatus(signatureId, body);
|
|
}
|
|
|
|
@Get('templates')
|
|
listTemplates(@TenantId() tenantId?: string) {
|
|
return this.smsConfig.listTemplates(tenantId);
|
|
}
|
|
|
|
@Post('templates')
|
|
createTemplate(@Body() body: CreateSmsTemplateDto) {
|
|
return this.smsConfig.createTemplate(body);
|
|
}
|
|
|
|
@Put('templates/:id')
|
|
updateTemplate(@Param('id') templateId: string, @Body() body: UpdateSmsTemplateDto) {
|
|
return this.smsConfig.updateTemplate(templateId, body);
|
|
}
|
|
|
|
@Post('templates/:id/submit')
|
|
submitTemplate(@Param('id') templateId: string) {
|
|
return this.smsConfig.submitTemplate(templateId);
|
|
}
|
|
|
|
@Post('templates/:id/status')
|
|
changeTemplateStatus(@Param('id') templateId: string, @Body() body: StatusChangeDto) {
|
|
return this.smsConfig.changeTemplateStatus(templateId, body);
|
|
}
|
|
}
|