feat(templates): add localized push templates and actions
Share template keys across email and push with independent editors and revisions. Render localized actions and preserve version-one delivery. Ref: IT-1627
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using HrynCo.NotificationService.DAL.EF.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace HrynCo.NotificationService.DAL.EF.Configurations;
|
||||
|
||||
internal sealed class PushTemplateEntityConfiguration : IEntityTypeConfiguration<PushTemplateEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PushTemplateEntity> builder)
|
||||
{
|
||||
builder.ToTable("push_templates");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.Id).HasColumnName("id");
|
||||
builder.Property(x => x.DefinitionId).HasColumnName("definition_id");
|
||||
builder.Property(x => x.ServiceId).HasColumnName("service_id");
|
||||
builder.Property(x => x.ServiceLanguageId).HasColumnName("service_language_id");
|
||||
builder.HasIndex(x => new { x.DefinitionId, x.ServiceLanguageId }).IsUnique();
|
||||
builder.HasOne(x => x.Definition).WithMany(x => x.Languages)
|
||||
.HasForeignKey(x => new { x.DefinitionId, x.ServiceId })
|
||||
.HasPrincipalKey(x => new { x.Id, x.ServiceId }).OnDelete(DeleteBehavior.Cascade);
|
||||
builder.HasOne(x => x.ServiceLanguage).WithMany()
|
||||
.HasForeignKey(x => new { x.ServiceLanguageId, x.ServiceId })
|
||||
.HasPrincipalKey(x => new { x.Id, x.ServiceId }).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.Property(x => x.Title).HasColumnName("title").IsRequired();
|
||||
builder.Property(x => x.Body).HasColumnName("body").IsRequired();
|
||||
builder.Property(x => x.ActionsJson).HasColumnName("actions").HasColumnType("jsonb").IsRequired();
|
||||
builder.Property(x => x.Created).HasColumnName("created");
|
||||
builder.Property(x => x.Updated).HasColumnName("updated");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user