fixed LocalDateTime conversion missing with EmailNewsletter

This commit is contained in:
Mia Rose Winter 2024-02-14 14:43:16 +01:00
parent 79ad3ed5ed
commit 9cf97fbef7
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E

View file

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Wave.Data.Migrations.postgres;
namespace Wave.Data; namespace Wave.Data;
@ -81,6 +82,8 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
newsletter.HasKey(n => n.Id); newsletter.HasKey(n => n.Id);
newsletter.HasOne(n => n.Article).WithOne().HasForeignKey<EmailNewsletter>() newsletter.HasOne(n => n.Article).WithOne().HasForeignKey<EmailNewsletter>()
.IsRequired().OnDelete(DeleteBehavior.Cascade); .IsRequired().OnDelete(DeleteBehavior.Cascade);
newsletter.Property(a => a.DistributionDateTime)
.HasConversion(dateTimeOffsetUtcConverter);
newsletter.ToTable("Newsletter"); newsletter.ToTable("Newsletter");
}); });