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;
|
2023-02-21 15:06:34 +09:00
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
2020-05-27 18:41:00 -05:00
|
|
|
|
2020-05-28 15:15:24 -05:00
|
|
|
namespace BTCPayServer.Data
|
2020-05-27 18:41:00 -05:00
|
|
|
{
|
2023-02-21 15:06:34 +09:00
|
|
|
public class NotificationData : IHasBlobUntyped
|
2020-05-27 18:41:00 -05:00
|
|
|
{
|
2020-06-12 00:16:50 -05:00
|
|
|
[MaxLength(36)]
|
2020-05-27 18:41:00 -05:00
|
|
|
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]
|
2020-05-27 18:41:00 -05:00
|
|
|
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]
|
2020-05-27 18:41:00 -05:00
|
|
|
public string NotificationType { get; set; }
|
|
|
|
public bool Seen { get; set; }
|
2023-02-21 15:06:34 +09:00
|
|
|
[Obsolete("Use Blob2 instead")]
|
2020-05-27 18:41:00 -05:00
|
|
|
public byte[] Blob { get; set; }
|
2023-02-21 15:06:34 +09:00
|
|
|
public string Blob2 { get; set; }
|
2020-05-28 15:15:24 -05:00
|
|
|
|
2023-04-10 11:07:03 +09:00
|
|
|
internal static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
|
|
|
|
{
|
2020-05-28 15:15:24 -05:00
|
|
|
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);
|
2024-04-15 19:08:25 +09:00
|
|
|
builder.Entity<NotificationData>()
|
|
|
|
.Property(o => o.Blob2)
|
|
|
|
.HasColumnType("JSONB");
|
2020-05-28 15:15:24 -05:00
|
|
|
}
|
2020-05-27 18:41:00 -05:00
|
|
|
}
|
|
|
|
}
|