diff options
author | 杨宇千 <crupest@outlook.com> | 2019-11-03 00:28:21 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-11-03 00:28:21 +0800 |
commit | cb2d9949ecc1d3c4b10295eb715a9293d493c5e2 (patch) | |
tree | be58859c6235b1be43bb0f989910257ce99f815b /Timeline/Entities/TimelineEntity.cs | |
parent | 37a2e6340ab20de1f9e847d795c0cbec9846de97 (diff) | |
download | timeline-cb2d9949ecc1d3c4b10295eb715a9293d493c5e2.tar.gz timeline-cb2d9949ecc1d3c4b10295eb715a9293d493c5e2.tar.bz2 timeline-cb2d9949ecc1d3c4b10295eb715a9293d493c5e2.zip |
Design the entity model primarily.
Diffstat (limited to 'Timeline/Entities/TimelineEntity.cs')
-rw-r--r-- | Timeline/Entities/TimelineEntity.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Timeline/Entities/TimelineEntity.cs b/Timeline/Entities/TimelineEntity.cs new file mode 100644 index 00000000..f4c7045d --- /dev/null +++ b/Timeline/Entities/TimelineEntity.cs @@ -0,0 +1,46 @@ +using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Timeline.Entities
+{
+ public enum TimelineVisibility
+ {
+ Public,
+ Private
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is entity object.")]
+ [Table("timelines")]
+ public class TimelineEntity
+ {
+ [Column("id"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public long Id { get; set; }
+
+ /// <summary>
+ /// If null, then this timeline is a personal timeline.
+ /// </summary>
+ [Column("name")]
+ public string? Name { get; set; }
+
+ [Column("description")]
+ public string? Description { get; set; }
+
+ [Column("owner")]
+ public long OwnerId { get; set; }
+
+ [ForeignKey(nameof(OwnerId))]
+ public User Owner { get; set; } = default!;
+
+ [Column("visibility")]
+ public TimelineVisibility Visibility { get; set; }
+
+ [Column("create_time")]
+ public DateTime CreateTime { get; set; }
+
+ public List<TimelineMemberEntity> Members { get; set; } = default!;
+
+ public List<TimelinePostEntity> Posts { get; set; } = default!;
+ }
+}
|