btcpayserver/BTCPayServer.Data/Data/NotificationData.cs

31 lines
947 B
C#
Raw Normal View History

2020-06-28 21:44:35 -05:00
using System;
2020-06-12 00:16:50 -05:00
using System.ComponentModel.DataAnnotations;
2020-05-28 15:15:24 -05:00
using Microsoft.EntityFrameworkCore;
2020-05-28 15:15:24 -05:00
namespace BTCPayServer.Data
{
public class NotificationData
{
2020-06-12 00:16:50 -05:00
[MaxLength(36)]
public string Id { get; set; }
public DateTimeOffset Created { get; set; }
2020-06-12 00:16:50 -05:00
[MaxLength(50)]
2020-06-25 15:43:45 +09:00
[Required]
public string ApplicationUserId { get; set; }
2020-05-28 15:15:24 -05:00
public ApplicationUser ApplicationUser { get; set; }
2020-06-12 00:16:50 -05:00
[MaxLength(100)]
2020-06-25 15:43:45 +09:00
[Required]
public string NotificationType { get; set; }
public bool Seen { get; set; }
public byte[] Blob { get; set; }
2020-05-28 15:15:24 -05:00
internal static void OnModelCreating(ModelBuilder builder)
{
builder.Entity<NotificationData>()
.HasOne(o => o.ApplicationUser)
.WithMany(n => n.Notifications)
2020-06-13 18:45:44 -05:00
.HasForeignKey(k => k.ApplicationUserId).OnDelete(DeleteBehavior.Cascade);
2020-05-28 15:15:24 -05:00
}
}
}