btcpayserver/BTCPayServer.Data/Data/AppData.cs
d11n 9428347cb6
Crowdfund finetuning (#3488)
* Update crowdfund defaults

* Crowdfund: Move sound, animation and discussion into additional options

* Update sound URLs

Fixes #3745.

* Update featured image URL label

* Improve the recurring goal section

* Crowdfund: Goal section finetuning
2022-06-28 12:03:13 +09:00

38 lines
1.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace BTCPayServer.Data
{
public class AppData
{
public string Id { get; set; }
public string Name { get; set; }
public string StoreDataId { get; set; }
public string AppType { get; set; }
public StoreData StoreData { get; set; }
public DateTimeOffset Created { get; set; }
public bool TagAllInvoices { get; set; }
public string Settings { get; set; }
internal static void OnModelCreating(ModelBuilder builder)
{
builder.Entity<AppData>()
.HasOne(o => o.StoreData)
.WithMany(i => i.Apps).OnDelete(DeleteBehavior.Cascade);
builder.Entity<AppData>()
.HasOne(a => a.StoreData);
}
// utility methods
public T GetSettings<T>() where T : class, new()
{
return string.IsNullOrEmpty(Settings) ? new T() : JsonConvert.DeserializeObject<T>(Settings);
}
public void SetSettings(object value)
{
Settings = value == null ? null : JsonConvert.SerializeObject(value);
}
}
}