Replace polling with push-based Telegram notification queue
Deploy Staging / deploy (push) Successful in 1m11s
Deploy Staging / deploy (push) Successful in 1m11s
This commit is contained in:
@@ -3,12 +3,13 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using RazorPagesMovie.Api.V1.Contact;
|
||||
using RazorPagesMovie.Data;
|
||||
using RazorPagesMovie.Models;
|
||||
using RazorPagesMovie.Services;
|
||||
|
||||
namespace RazorPagesMovie.Controllers.Api.V1;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class ContactController(RazorPagesMovieContext context) : ControllerBase
|
||||
public class ContactController(RazorPagesMovieContext context, IContactMessageNotificationQueue notificationQueue) : ControllerBase
|
||||
{
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Post(ContactDto request)
|
||||
@@ -31,6 +32,8 @@ public class ContactController(RazorPagesMovieContext context) : ControllerBase
|
||||
context.ContactMessage.Add(contactMessage);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
notificationQueue.Enqueue(contactMessage.Id);
|
||||
|
||||
return Ok(new { success = true });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user