diff options
author | crupest <crupest@outlook.com> | 2020-08-21 23:44:53 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-08-21 23:44:53 +0800 |
commit | 3aa8e1cda4222fc3a9828888ba8fb51d2ba1d6c8 (patch) | |
tree | 520b56d834185ba5f9f556558a181bb9f4059b29 /Timeline | |
parent | e429b7e0c0425b507b26f95ff3176f9a01f73423 (diff) | |
download | timeline-3aa8e1cda4222fc3a9828888ba8fb51d2ba1d6c8.tar.gz timeline-3aa8e1cda4222fc3a9828888ba8fb51d2ba1d6c8.tar.bz2 timeline-3aa8e1cda4222fc3a9828888ba8fb51d2ba1d6c8.zip |
...
Diffstat (limited to 'Timeline')
-rw-r--r-- | Timeline/Models/Http/Timeline.cs | 75 | ||||
-rw-r--r-- | Timeline/Models/Http/TimelineController.cs | 33 | ||||
-rw-r--r-- | Timeline/Models/Http/UserController.cs | 6 | ||||
-rw-r--r-- | Timeline/Models/Http/UserInfo.cs | 31 |
4 files changed, 138 insertions, 7 deletions
diff --git a/Timeline/Models/Http/Timeline.cs b/Timeline/Models/Http/Timeline.cs index 52e26190..6498fa74 100644 --- a/Timeline/Models/Http/Timeline.cs +++ b/Timeline/Models/Http/Timeline.cs @@ -8,45 +8,120 @@ using Timeline.Controllers; namespace Timeline.Models.Http
{
+ /// <summary>
+ /// Info of post content.
+ /// </summary>
public class TimelinePostContentInfo
{
+ /// <summary>
+ /// Type of the post content.
+ /// </summary>
public string Type { get; set; } = default!;
+ /// <summary>
+ /// If post is of text type. This is the text.
+ /// </summary>
public string? Text { get; set; }
+ /// <summary>
+ /// If post is of image type. This is the image url.
+ /// </summary>
public string? Url { get; set; }
}
+ /// <summary>
+ /// Info of a post.
+ /// </summary>
public class TimelinePostInfo
{
+ /// <summary>
+ /// Post id.
+ /// </summary>
public long Id { get; set; }
+ /// <summary>
+ /// Content of the post. May be null if post is deleted.
+ /// </summary>
public TimelinePostContentInfo? Content { get; set; }
+ /// <summary>
+ /// True if post is deleted.
+ /// </summary>
public bool Deleted { get; set; }
+ /// <summary>
+ /// Post time.
+ /// </summary>
public DateTime Time { get; set; }
+ /// <summary>
+ /// The author. May be null if the user has been deleted.
+ /// </summary>
public UserInfo? Author { get; set; } = default!;
+ /// <summary>
+ /// Last updated time.
+ /// </summary>
public DateTime LastUpdated { get; set; } = default!;
}
+ /// <summary>
+ /// Info of a timeline.
+ /// </summary>
public class TimelineInfo
{
+ /// <summary>
+ /// Unique id.
+ /// </summary>
public string UniqueId { get; set; } = default!;
+ /// <summary>
+ /// Name of timeline.
+ /// </summary>
public string Name { get; set; } = default!;
+ /// <summary>
+ /// Last modified time of timeline name.
+ /// </summary>
public DateTime NameLastModifed { get; set; } = default!;
+ /// <summary>
+ /// Timeline description.
+ /// </summary>
public string Description { get; set; } = default!;
+ /// <summary>
+ /// Owner of the timeline.
+ /// </summary>
public UserInfo Owner { get; set; } = default!;
+ /// <summary>
+ /// Visibility of the timeline.
+ /// </summary>
public TimelineVisibility Visibility { get; set; }
#pragma warning disable CA2227 // Collection properties should be read only
+ /// <summary>
+ /// Members of timeline.
+ /// </summary>
public List<UserInfo> Members { get; set; } = default!;
#pragma warning restore CA2227 // Collection properties should be read only
+ /// <summary>
+ /// Create time of timeline.
+ /// </summary>
public DateTime CreateTime { get; set; } = default!;
+ /// <summary>
+ /// Last modified time of timeline.
+ /// </summary>
public DateTime LastModified { get; set; } = default!;
#pragma warning disable CA1707 // Identifiers should not contain underscores
+ /// <summary>
+ /// Related links.
+ /// </summary>
public TimelineInfoLinks _links { get; set; } = default!;
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
+ /// <summary>
+ /// Related links for timeline.
+ /// </summary>
public class TimelineInfoLinks
{
+ /// <summary>
+ /// Self.
+ /// </summary>
public string Self { get; set; } = default!;
+ /// <summary>
+ /// Posts url.
+ /// </summary>
public string Posts { get; set; } = default!;
}
diff --git a/Timeline/Models/Http/TimelineController.cs b/Timeline/Models/Http/TimelineController.cs index 3e2e6b58..aad361ee 100644 --- a/Timeline/Models/Http/TimelineController.cs +++ b/Timeline/Models/Http/TimelineController.cs @@ -4,33 +4,66 @@ using Timeline.Models.Validation; namespace Timeline.Models.Http
{
+ /// <summary>
+ /// Content of post create request.
+ /// </summary>
public class TimelinePostCreateRequestContent
{
+ /// <summary>
+ /// Type of post content.
+ /// </summary>
[Required]
public string Type { get; set; } = default!;
+ /// <summary>
+ /// If post is of text type, this is the text.
+ /// </summary>
public string? Text { get; set; }
+ /// <summary>
+ /// If post is of image type, this is base64 of image data.
+ /// </summary>
public string? Data { get; set; }
}
public class TimelinePostCreateRequest
{
+ /// <summary>
+ /// Content of the new post.
+ /// </summary>
[Required]
public TimelinePostCreateRequestContent Content { get; set; } = default!;
+ /// <summary>
+ /// Time of the post. If not set, current time will be used.
+ /// </summary>
public DateTime? Time { get; set; }
}
+ /// <summary>
+ /// Create timeline request model.
+ /// </summary>
public class TimelineCreateRequest
{
+ /// <summary>
+ /// Name of the new timeline. Must be a valid name.
+ /// </summary>
[Required]
[TimelineName]
public string Name { get; set; } = default!;
}
+ /// <summary>
+ /// Patch timeline request model.
+ /// </summary>
public class TimelinePatchRequest
{
+ /// <summary>
+ /// New description. Null for not change.
+ /// </summary>
public string? Description { get; set; }
+ /// <summary>
+ /// New visibility. Null for not change.
+ /// </summary>
public TimelineVisibility? Visibility { get; set; }
}
}
diff --git a/Timeline/Models/Http/UserController.cs b/Timeline/Models/Http/UserController.cs index ea30a0ea..6bc5a66e 100644 --- a/Timeline/Models/Http/UserController.cs +++ b/Timeline/Models/Http/UserController.cs @@ -82,14 +82,8 @@ namespace Timeline.Models.Http public string NewPassword { get; set; } = default!;
}
- /// <summary>
- ///
- /// </summary>
public class UserControllerAutoMapperProfile : Profile
{
- /// <summary>
- ///
- /// </summary>
public UserControllerAutoMapperProfile()
{
CreateMap<UserPatchRequest, User>(MemberList.Source);
diff --git a/Timeline/Models/Http/UserInfo.cs b/Timeline/Models/Http/UserInfo.cs index c9a26072..d92a12c4 100644 --- a/Timeline/Models/Http/UserInfo.cs +++ b/Timeline/Models/Http/UserInfo.cs @@ -2,26 +2,55 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Routing;
-using System;
using Timeline.Controllers;
namespace Timeline.Models.Http
{
+ /// <summary>
+ /// Info of a user.
+ /// </summary>
public class UserInfo
{
+ /// <summary>
+ /// Unique id.
+ /// </summary>
public string UniqueId { get; set; } = default!;
+ /// <summary>
+ /// Username.
+ /// </summary>
public string Username { get; set; } = default!;
+ /// <summary>
+ /// Nickname.
+ /// </summary>
public string Nickname { get; set; } = default!;
+ /// <summary>
+ /// True if the user is a administrator.
+ /// </summary>
public bool? Administrator { get; set; } = default!;
#pragma warning disable CA1707 // Identifiers should not contain underscores
+ /// <summary>
+ /// Related links.
+ /// </summary>
public UserInfoLinks _links { get; set; } = default!;
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
+ /// <summary>
+ /// Related links for user.
+ /// </summary>
public class UserInfoLinks
{
+ /// <summary>
+ /// Self.
+ /// </summary>
public string Self { get; set; } = default!;
+ /// <summary>
+ /// Avatar url.
+ /// </summary>
public string Avatar { get; set; } = default!;
+ /// <summary>
+ /// Personal timeline url.
+ /// </summary>
public string Timeline { get; set; } = default!;
}
|