feat(admin,sms): add dynamic sms settings management and live tester in admin panel

This commit is contained in:
parsa aghaei committed 2026-08-16 11:48:40 +03:30
1 parent 8992060cb7
commit 09fd339e89
7 files changed
+755 -40

No files matched your search

+35 -1
View File
@@ -1,6 +1,7 @@
import {
Controller,
Get,
Post,
Patch,
Put,
Delete,
@@ -20,7 +21,7 @@ import {
ApiOkResponse,
} from '@nestjs/swagger';
@ApiTags('Settings - تنظیمات متون پویا، تنظیمات سئو، مالی و سیستم')
@ApiTags('Settings - تنظیمات متون پویا، تنظیمات سئو، مالی، سیستم و پیامک')
@Controller('settings')
export class SettingsController {
constructor(private readonly settingsService: SettingsService) {}
@@ -125,4 +126,37 @@ export class SettingsController {
updateSystemSettings(@Body() body: Prisma.InputJsonValue) {
return this.settingsService.updateCategorySetting('system', body);
}
// SMS Gateway Settings
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('Admin')
@ApiBearerAuth()
@Get('sms')
@ApiOperation({ summary: 'دریافت تنظیمات درگاه پیامک و کدهای پترن' })
getSmsSettings() {
return this.settingsService.getSmsSettings();
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('Admin')
@ApiBearerAuth()
@Patch('sms')
@ApiOperation({ summary: 'به‌روزرسانی تنظیمات درگاه پیامک و کدهای پترن' })
updateSmsSettings(@Body() body: Prisma.InputJsonValue) {
return this.settingsService.updateSmsSettings(body);
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('Admin')
@ApiBearerAuth()
@Post('sms/test')
@ApiOperation({ summary: 'ارسال پیامک آزمایشی پترن به شماره دلخواه' })
testSms(
@Body('phone') phone: string,
@Body('patternId') patternId?: number,
@Body('args') args?: string[],
) {
return this.settingsService.testSms(phone, patternId, args);
}
}