Gestita pagina notifiche

This commit is contained in:
2025-09-11 16:06:19 +02:00
parent 7319378e75
commit 7bfe67a97c
30 changed files with 611 additions and 105 deletions

View File

@@ -0,0 +1,33 @@
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
using IntegryApiClient.Core.Domain.RestClient.Contacts;
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Entity;
using salesbook.Shared.Core.Interface.IntegryApi;
namespace salesbook.Shared.Core.Services;
public class IntegryNotificationRestClient(
IUserSession userSession,
IIntegryApiRestClient integryApiRestClient) : IIntegryNotificationRestClient
{
public Task<List<WtbNotification>> Get()
{
var queryParams = new Dictionary<string, object>
{
{ "mode", "ENABLED" },
{ "forUser", userSession.User.Username }
};
return integryApiRestClient.Get<List<WtbNotification>>("notification", queryParams)!;
}
public Task<WtbNotification> MarkAsRead(long id) =>
integryApiRestClient.Post<WtbNotification>("notification/read",
new ReadNotificationRequestDTO { NotificationId = id, Username = userSession.User.Username })!;
public Task Delete(long id) =>
integryApiRestClient.Delete<object>($"notification/{id}", null);
public Task DeleteAll() =>
integryApiRestClient.Delete<object>($"notification/all/{userSession.User.Username}", null);
}