From ea8d82143c07afb38767d6afb4be0031452495fb Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Sat, 9 Nov 2019 23:44:20 +0800 Subject: Add PersonalTimelineController PostOperationCreate unit tests. --- Timeline/Controllers/PersonalTimelineController.cs | 6 +++--- Timeline/Models/Http/Timeline.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'Timeline') diff --git a/Timeline/Controllers/PersonalTimelineController.cs b/Timeline/Controllers/PersonalTimelineController.cs index f006ad47..f41e354b 100644 --- a/Timeline/Controllers/PersonalTimelineController.cs +++ b/Timeline/Controllers/PersonalTimelineController.cs @@ -74,7 +74,7 @@ namespace Timeline.Controllers [HttpGet("users/{username}/timeline/posts")] [CatchTimelineNotExistException] - public async Task>> PostsGet([FromRoute][Username] string username) + public async Task>> PostListGet([FromRoute][Username] string username) { if (!IsAdmin() && !await _service.HasReadPermission(username, GetAuthUsername())) { @@ -88,7 +88,7 @@ namespace Timeline.Controllers [HttpPost("user/{username}/timeline/postop/create")] [Authorize] [CatchTimelineNotExistException] - public async Task> TimelinePost([FromRoute][Username] string username, [FromBody] TimelinePostCreateRequest body) + public async Task> PostOperationCreate([FromRoute][Username] string username, [FromBody] TimelinePostCreateRequest body) { if (!IsAdmin() && !await _service.IsMemberOf(username, GetAuthUsername()!)) { @@ -103,7 +103,7 @@ namespace Timeline.Controllers [HttpPost("user/{username}/timeline/postop/delete")] [Authorize] [CatchTimelineNotExistException] - public async Task TimelinePostDelete([FromRoute][Username] string username, [FromBody] TimelinePostDeleteRequest body) + public async Task PostOperationDelete([FromRoute][Username] string username, [FromBody] TimelinePostDeleteRequest body) { var postId = body.Id!.Value; if (!IsAdmin() && !await _service.HasPostModifyPermission(username, postId, GetAuthUsername()!)) diff --git a/Timeline/Models/Http/Timeline.cs b/Timeline/Models/Http/Timeline.cs index f676afa0..06b88ad1 100644 --- a/Timeline/Models/Http/Timeline.cs +++ b/Timeline/Models/Http/Timeline.cs @@ -9,7 +9,7 @@ namespace Timeline.Models.Http { public class TimelinePostCreateRequest { - [Required(AllowEmptyStrings = false)] + [Required(AllowEmptyStrings = true)] public string Content { get; set; } = default!; public DateTime? Time { get; set; } -- cgit v1.2.3