From 0c594ac306095af53c04e5c20b3048ce56533fa5 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Mon, 7 Aug 2023 23:42:59 +0100 Subject: [PATCH] feat: add Updated property to BlogPost --- OliverBooth/Data/Blog/BlogPost.cs | 8 +++++++- .../Data/Blog/Configuration/BlogPostConfiguration.cs | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/OliverBooth/Data/Blog/BlogPost.cs b/OliverBooth/Data/Blog/BlogPost.cs index c8aef68..effc376 100644 --- a/OliverBooth/Data/Blog/BlogPost.cs +++ b/OliverBooth/Data/Blog/BlogPost.cs @@ -1,4 +1,4 @@ -namespace OliverBooth.Data.Blog; +namespace OliverBooth.Data.Blog; /// /// Represents a blog post. @@ -41,6 +41,12 @@ public sealed class BlogPost : IEquatable /// The title. public string Title { get; set; } = string.Empty; + /// + /// Gets or sets the date and time at which the blog post was updated. + /// + /// The update timestamp. + public DateTimeOffset? Updated { get; set; } + /// /// Gets or sets the legacy WordPress ID of the blog post. /// diff --git a/OliverBooth/Data/Blog/Configuration/BlogPostConfiguration.cs b/OliverBooth/Data/Blog/Configuration/BlogPostConfiguration.cs index d2152a2..3db6c2c 100644 --- a/OliverBooth/Data/Blog/Configuration/BlogPostConfiguration.cs +++ b/OliverBooth/Data/Blog/Configuration/BlogPostConfiguration.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace OliverBooth.Data.Blog.Configuration; @@ -19,6 +19,7 @@ internal sealed class BlogPostConfiguration : IEntityTypeConfiguration builder.Property(e => e.Slug).HasMaxLength(100).IsRequired(); builder.Property(e => e.AuthorId).IsRequired(); builder.Property(e => e.Published).IsRequired(); + builder.Property(e => e.Updated).IsRequired(false); builder.Property(e => e.Title).HasMaxLength(255).IsRequired(); builder.Property(e => e.Body).IsRequired(); }