mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Moving Notification to dedicated Service namespace
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Models.NotificationViewModels;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BTCPayServer.Services.Notifications.Blobs
|
||||
{
|
||||
// Make sure to keep all NotificationEventBase classes in same namespace
|
||||
// because of dependent initialization and parsing to view models logic
|
||||
// IndexViewModel.cs#32
|
||||
internal abstract class NotificationBase
|
||||
{
|
||||
internal virtual string NotificationType { get { return GetType().Name; } }
|
||||
|
||||
public NotificationData ToData(string applicationUserId)
|
||||
{
|
||||
var obj = JsonConvert.SerializeObject(this);
|
||||
|
||||
var data = new NotificationData
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
ApplicationUserId = applicationUserId,
|
||||
NotificationType = NotificationType,
|
||||
Blob = ZipUtils.Zip(obj),
|
||||
Seen = false
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
public abstract void FillViewModel(NotificationViewModel data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user