2024-08-20 08:50:14 -04:00
|
|
|
import { Body, Controller, HttpCode, HttpStatus, Post } from '@nestjs/common';
|
2024-06-07 11:34:09 -05:00
|
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
|
|
|
import { AuthDto } from 'src/dtos/auth.dto';
|
2024-09-25 12:05:03 -04:00
|
|
|
import { TestEmailResponseDto } from 'src/dtos/notification.dto';
|
2024-06-07 11:34:09 -05:00
|
|
|
import { SystemConfigSmtpDto } from 'src/dtos/system-config.dto';
|
|
|
|
|
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
|
|
|
|
import { NotificationService } from 'src/services/notification.service';
|
|
|
|
|
|
|
|
|
|
@ApiTags('Notifications')
|
|
|
|
|
@Controller('notifications')
|
|
|
|
|
export class NotificationController {
|
|
|
|
|
constructor(private service: NotificationService) {}
|
|
|
|
|
|
|
|
|
|
@Post('test-email')
|
2024-08-20 08:50:14 -04:00
|
|
|
@HttpCode(HttpStatus.OK)
|
2024-06-07 11:34:09 -05:00
|
|
|
@Authenticated({ admin: true })
|
2024-09-25 12:05:03 -04:00
|
|
|
sendTestEmail(@Auth() auth: AuthDto, @Body() dto: SystemConfigSmtpDto): Promise<TestEmailResponseDto> {
|
2024-06-07 11:34:09 -05:00
|
|
|
return this.service.sendTestEmail(auth.user.id, dto);
|
|
|
|
|
}
|
|
|
|
|
}
|