Limiting Notification string fields

This commit is contained in:
rockstardev
2020-06-12 00:16:50 -05:00
parent 0c170fc399
commit 2f4967a23a
3 changed files with 31 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,10 +10,13 @@ namespace BTCPayServer.Data
{ {
public class NotificationData public class NotificationData
{ {
[MaxLength(36)]
public string Id { get; set; } public string Id { get; set; }
public DateTimeOffset Created { get; set; } public DateTimeOffset Created { get; set; }
[MaxLength(50)]
public string ApplicationUserId { get; set; } public string ApplicationUserId { get; set; }
public ApplicationUser ApplicationUser { get; set; } public ApplicationUser ApplicationUser { get; set; }
[MaxLength(100)]
public string NotificationType { get; set; } public string NotificationType { get; set; }
public bool Seen { get; set; } public bool Seen { get; set; }
public byte[] Blob { get; set; } public byte[] Blob { get; set; }

View File

@@ -0,0 +1,21 @@
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20200612051342_LimitingNotificationStringFields")]
public class LimitingNotificationStringFields : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -246,10 +246,12 @@ namespace BTCPayServer.Migrations
modelBuilder.Entity("BTCPayServer.Data.NotificationData", b => modelBuilder.Entity("BTCPayServer.Data.NotificationData", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("TEXT"); .HasColumnType("TEXT")
.HasMaxLength(36);
b.Property<string>("ApplicationUserId") b.Property<string>("ApplicationUserId")
.HasColumnType("TEXT"); .HasColumnType("TEXT")
.HasMaxLength(50);
b.Property<byte[]>("Blob") b.Property<byte[]>("Blob")
.HasColumnType("BLOB"); .HasColumnType("BLOB");
@@ -258,7 +260,8 @@ namespace BTCPayServer.Migrations
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("NotificationType") b.Property<string>("NotificationType")
.HasColumnType("TEXT"); .HasColumnType("TEXT")
.HasMaxLength(100);
b.Property<bool>("Seen") b.Property<bool>("Seen")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");