From e7ca87f25dae2f806469043ee556d4790d9ebcae Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 10 Mar 2020 03:04:23 +0800 Subject: ... --- Timeline/Models/Timeline.cs | 74 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Timeline/Models/Timeline.cs (limited to 'Timeline/Models/Timeline.cs') diff --git a/Timeline/Models/Timeline.cs b/Timeline/Models/Timeline.cs new file mode 100644 index 00000000..52f38e42 --- /dev/null +++ b/Timeline/Models/Timeline.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; + +namespace TimelineApp.Models +{ + public enum TimelineVisibility + { + /// + /// All people including those without accounts. + /// + Public, + /// + /// Only people signed in. + /// + Register, + /// + /// Only member. + /// + 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 long Id { get; set; } + public ITimelinePostContent Content { get; set; } = default!; + public DateTime Time { get; set; } + public User Author { get; set; } = default!; + public DateTime LastUpdated { get; set; } = default!; + } + + public class Timeline + { + 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 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; } + } +} -- cgit v1.2.3