diff options
author | 杨宇千 <crupest@outlook.com> | 2019-11-20 18:21:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 18:21:17 +0800 |
commit | 751467deb8ae18909ebd2b241bbb64f1f9da8295 (patch) | |
tree | 788b8acdf1141c757cb3226d3cd5f64594386b8f /Timeline/Models | |
parent | 2de7fa95bb5ad0a10f74fb390bac464a250dee42 (diff) | |
parent | 33318b9244a82fee6d711aa15f853e1590ff13f7 (diff) | |
download | timeline-751467deb8ae18909ebd2b241bbb64f1f9da8295.tar.gz timeline-751467deb8ae18909ebd2b241bbb64f1f9da8295.tar.bz2 timeline-751467deb8ae18909ebd2b241bbb64f1f9da8295.zip |
Merge pull request #54 from crupest/timeline
Add core feature Timeline (currently only personal timeline)
Diffstat (limited to 'Timeline/Models')
-rw-r--r-- | Timeline/Models/Http/Timeline.cs | 45 | ||||
-rw-r--r-- | Timeline/Models/Timeline.cs | 55 |
2 files changed, 100 insertions, 0 deletions
diff --git a/Timeline/Models/Http/Timeline.cs b/Timeline/Models/Http/Timeline.cs new file mode 100644 index 00000000..06b88ad1 --- /dev/null +++ b/Timeline/Models/Http/Timeline.cs @@ -0,0 +1,45 @@ +using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Threading.Tasks;
+using Timeline.Entities;
+
+namespace Timeline.Models.Http
+{
+ public class TimelinePostCreateRequest
+ {
+ [Required(AllowEmptyStrings = true)]
+ public string Content { get; set; } = default!;
+
+ public DateTime? Time { get; set; }
+ }
+
+ public class TimelinePostCreateResponse
+ {
+ public long Id { get; set; }
+
+ public DateTime Time { get; set; }
+ }
+
+ public class TimelinePostDeleteRequest
+ {
+ [Required]
+ public long? Id { get; set; }
+ }
+
+ public class TimelinePropertyChangeRequest
+ {
+ public string? Description { get; set; }
+
+ public TimelineVisibility? Visibility { get; set; }
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is a DTO class.")]
+ public class TimelineMemberChangeRequest
+ {
+ public List<string>? Add { get; set; }
+
+ public List<string>? Remove { get; set; }
+ }
+}
diff --git a/Timeline/Models/Timeline.cs b/Timeline/Models/Timeline.cs new file mode 100644 index 00000000..752c698d --- /dev/null +++ b/Timeline/Models/Timeline.cs @@ -0,0 +1,55 @@ +using System;
+using System.Collections.Generic;
+
+namespace Timeline.Models
+{
+ public enum TimelineVisibility
+ {
+ /// <summary>
+ /// All people including those without accounts.
+ /// </summary>
+ Public,
+ /// <summary>
+ /// Only people signed in.
+ /// </summary>
+ Register,
+ /// <summary>
+ /// Only member.
+ /// </summary>
+ Private
+ }
+
+ public class TimelinePostInfo
+ {
+ public long Id { get; set; }
+
+ public string? Content { get; set; }
+
+ public DateTime Time { get; set; }
+
+ /// <summary>
+ /// The username of the author.
+ /// </summary>
+ public string Author { get; set; } = default!;
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is a DTO class.")]
+ public class BaseTimelineInfo
+ {
+ public string? Description { get; set; }
+
+ /// <summary>
+ /// The username of the owner.
+ /// </summary>
+ public string Owner { get; set; } = default!;
+
+ public TimelineVisibility Visibility { get; set; }
+
+ public List<string> Members { get; set; } = default!;
+ }
+
+ public class TimelineInfo : BaseTimelineInfo
+ {
+ public string Name { get; set; } = default!;
+ }
+}
|