aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/Timeline.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-03-12 19:56:20 +0800
committerGitHub <noreply@github.com>2020-03-12 19:56:20 +0800
commit904f98bda60b3bd92331aacde3771dedde62d2b5 (patch)
tree70681348ddfc3bc8c3d9a92ae010a02020830573 /Timeline/Models/Timeline.cs
parenta37874830399c193392cc78367efcecbe8275ceb (diff)
parentf8ff7e20eb5d5673575d36b8964a013765b77bf8 (diff)
downloadtimeline-904f98bda60b3bd92331aacde3771dedde62d2b5.tar.gz
timeline-904f98bda60b3bd92331aacde3771dedde62d2b5.tar.bz2
timeline-904f98bda60b3bd92331aacde3771dedde62d2b5.zip
Merge pull request #69 from crupest/image
Post image feature.
Diffstat (limited to 'Timeline/Models/Timeline.cs')
-rw-r--r--Timeline/Models/Timeline.cs87
1 files changed, 87 insertions, 0 deletions
diff --git a/Timeline/Models/Timeline.cs b/Timeline/Models/Timeline.cs
new file mode 100644
index 00000000..803a5c5c
--- /dev/null
+++ b/Timeline/Models/Timeline.cs
@@ -0,0 +1,87 @@
+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 static class TimelinePostContentTypes
+ {
+ public const string Text = "text";
+ public const string Image = "image";
+ }
+
+ public interface ITimelinePostContent
+ {
+ public string Type { get; }
+ }
+
+ public class TextTimelinePostContent : ITimelinePostContent
+ {
+ public TextTimelinePostContent(string text) { Text = text; }
+
+ public string Type { get; } = TimelinePostContentTypes.Text;
+ public string Text { get; set; }
+ }
+
+ public class ImageTimelinePostContent : ITimelinePostContent
+ {
+ public ImageTimelinePostContent(string dataTag) { DataTag = dataTag; }
+
+ public string Type { get; } = TimelinePostContentTypes.Image;
+ public string DataTag { get; set; }
+ }
+
+ public class TimelinePost
+ {
+ public TimelinePost(long id, ITimelinePostContent content, DateTime time, User author, DateTime lastUpdated, string timelineName)
+ {
+ Id = id;
+ Content = content;
+ Time = time;
+ Author = author;
+ LastUpdated = lastUpdated;
+ TimelineName = timelineName;
+ }
+
+ public long Id { get; set; }
+ public ITimelinePostContent Content { get; set; }
+ public DateTime Time { get; set; }
+ public User Author { get; set; }
+ public DateTime LastUpdated { get; set; }
+ public string TimelineName { get; set; }
+ }
+
+#pragma warning disable CA1724 // Type names should not match namespaces
+ public class Timeline
+#pragma warning restore CA1724 // Type names should not match namespaces
+ {
+ public string Name { get; set; } = default!;
+ public string Description { get; set; } = default!;
+ public User Owner { get; set; } = default!;
+ public TimelineVisibility Visibility { get; set; }
+#pragma warning disable CA2227 // Collection properties should be read only
+ public List<User> Members { get; set; } = default!;
+#pragma warning restore CA2227 // Collection properties should be read only
+ }
+
+ public class TimelineChangePropertyRequest
+ {
+ public string? Description { get; set; }
+ public TimelineVisibility? Visibility { get; set; }
+ }
+}