diff options
| author | Paweł Bernaciak <pawelbernaciak@zohomail.eu> | 2023-12-22 16:02:41 +0100 |
|---|---|---|
| committer | Paweł Bernaciak <pawelbernaciak@zohomail.eu> | 2023-12-22 16:02:41 +0100 |
| commit | 1a96616699ab41bf6343bc1acc45a836c3e6caf3 (patch) | |
| tree | aff3d8bb8418355d3a8279024afaa13f196a0506 /CoreWiki/Models/Article.cs | |
| parent | 7fefe217c8462444ecb9806599e70afe2a7102ea (diff) | |
Backup
Diffstat (limited to 'CoreWiki/Models/Article.cs')
| -rw-r--r-- | CoreWiki/Models/Article.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/CoreWiki/Models/Article.cs b/CoreWiki/Models/Article.cs index 53c2706..b989573 100644 --- a/CoreWiki/Models/Article.cs +++ b/CoreWiki/Models/Article.cs @@ -2,23 +2,32 @@ using NodaTime; using NodaTime.Extensions; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using CoreWiki.Utils; namespace CoreWiki.Models; public class Article { - [Required, Key] + [Key] + public string Slug { get; set; } + + [Required, MaxLength(100)] public string Topic { get; set; } + [NotMapped] public Instant Published { get; set; } = SystemClock.Instance.GetCurrentInstant(); + [Obsolete("This property is only for serialization")] [DataType(DataType.DateTime)] [Column("Published")] + [Required] public DateTime PublishedDateTime { get => Published.ToDateTimeUtc(); set => Published = DateTime.SpecifyKind(value, DateTimeKind.Utc).ToInstant(); } + [DataType(DataType.MultilineText)] - public string Content { get; set; } + [Required] + public string Content { get; set; } = default!; }
\ No newline at end of file |
