Providing overridable NotificationType property, direct mapping

This commit is contained in:
rockstardev 2020-06-11 18:04:49 -05:00
parent 294dad01c3
commit 1f35534dfb

View file

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BTCPayServer.Data;
using BTCPayServer.Models.NotificationViewModels;
using ExchangeSharp;
@ -12,6 +8,8 @@ namespace BTCPayServer.Events.Notifications
{
public abstract class NotificationEventBase
{
public virtual string NotificationType { get { return GetType().Name; } }
public NotificationData ToData()
{
var obj = JsonConvert.SerializeObject(this);
@ -19,7 +17,7 @@ namespace BTCPayServer.Events.Notifications
var data = new NotificationData
{
Created = DateTimeOffset.UtcNow,
NotificationType = GetType().Name,
NotificationType = NotificationType,
Blob = obj.ToBytesUTF8(),
Seen = false
};