ef15fd6247
Full backend implementation: - Multi-tenant cafe/restaurant management (menus, orders, tables, staff) - POS order flow with ZarinPal and Snappfood payment integration - OTP authentication via Kavenegar SMS - QR digital menu with public discover/finder endpoints - Customer loyalty, coupons, CRM - PostgreSQL via EF Core, Redis for caching/sessions - Background jobs, webhook handlers - Full migration history Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Meezi.API.Models.Notifications;
|
|
using Meezi.API.Services;
|
|
using Meezi.Core.Interfaces;
|
|
using Meezi.Shared;
|
|
|
|
namespace Meezi.API.Controllers;
|
|
|
|
[Route("api/cafes/{cafeId}/notifications")]
|
|
public class NotificationsController : CafeApiControllerBase
|
|
{
|
|
private readonly INotificationInboxService _inbox;
|
|
|
|
public NotificationsController(INotificationInboxService inbox)
|
|
{
|
|
_inbox = inbox;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> List(
|
|
string cafeId,
|
|
ITenantContext tenant,
|
|
[FromQuery] bool unreadOnly = false,
|
|
[FromQuery] int limit = 40,
|
|
CancellationToken ct = default)
|
|
{
|
|
if (EnsureCafeAccess(cafeId, tenant) is { } denied) return denied;
|
|
var data = await _inbox.ListAsync(cafeId, unreadOnly, limit, ct);
|
|
return Ok(new ApiResponse<NotificationListDto>(true, data));
|
|
}
|
|
|
|
[HttpGet("unread-count")]
|
|
public async Task<IActionResult> UnreadCount(string cafeId, ITenantContext tenant, CancellationToken ct = default)
|
|
{
|
|
if (EnsureCafeAccess(cafeId, tenant) is { } denied) return denied;
|
|
var count = await _inbox.GetUnreadCountAsync(cafeId, ct);
|
|
return Ok(new ApiResponse<object>(true, new { count }));
|
|
}
|
|
|
|
[HttpPost("read")]
|
|
public async Task<IActionResult> MarkRead(
|
|
string cafeId,
|
|
[FromBody] MarkNotificationsReadRequest request,
|
|
ITenantContext tenant,
|
|
CancellationToken ct = default)
|
|
{
|
|
if (EnsureCafeAccess(cafeId, tenant) is { } denied) return denied;
|
|
await _inbox.MarkReadAsync(cafeId, request, ct);
|
|
return Ok(new ApiResponse<object>(true, new { read = true }));
|
|
}
|
|
}
|