mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
* Custom Forms * Update BTCPayServer.Data/Migrations/20230125085242_AddForms.cs * Cleanups * Explain public form * Add store branding * Add form name to POS form * add tests * fix migration * Minor cleanups * Code improvements * Add form validation Closes #4317. * Adapt form validation for Bootstrap 5 * update logic for forms * pr changes * Minor code cleanup * Remove unused parameters * Refactor Form data handling to avoid O(n3) issues * Rename Hidden to Constant * Pre-populate FormView from the query string params * Fix test --------- Co-authored-by: d11n <mail@dennisreimann.de> Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
31 lines
993 B
C#
31 lines
993 B
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
|
|
namespace BTCPayServer.Data.Data;
|
|
|
|
public class FormData
|
|
{
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public string Id { get; set; }
|
|
public string Name { get; set; }
|
|
public string StoreId { get; set; }
|
|
public StoreData Store { get; set; }
|
|
public string Config { get; set; }
|
|
public bool Public { get; set; }
|
|
|
|
internal static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
|
|
{
|
|
builder.Entity<FormData>()
|
|
.HasOne(o => o.Store)
|
|
.WithMany(o => o.Forms).OnDelete(DeleteBehavior.Cascade);
|
|
builder.Entity<FormData>().HasIndex(o => o.StoreId);
|
|
|
|
if (databaseFacade.IsNpgsql())
|
|
{
|
|
builder.Entity<FormData>()
|
|
.Property(o => o.Config)
|
|
.HasColumnType("JSONB");
|
|
}
|
|
}
|
|
}
|