From 3f4e88757f961532b84df85e86d21995655a29d4 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 27 Nov 2020 00:07:09 +0800 Subject: refactor: ... --- BackEnd/Timeline/Services/TimelinePostService.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'BackEnd/Timeline/Services/TimelinePostService.cs') diff --git a/BackEnd/Timeline/Services/TimelinePostService.cs b/BackEnd/Timeline/Services/TimelinePostService.cs index a1176a68..35513a36 100644 --- a/BackEnd/Timeline/Services/TimelinePostService.cs +++ b/BackEnd/Timeline/Services/TimelinePostService.cs @@ -39,7 +39,7 @@ namespace Timeline.Services /// Thrown when timeline with name does not exist. /// If it is a personal timeline, then inner exception is . /// - Task> GetPosts(string timelineName, DateTime? modifiedSince = null, bool includeDeleted = false); + Task> GetPosts(string timelineName, DateTime? modifiedSince = null, bool includeDeleted = false); /// /// Get the etag of data of a post. @@ -90,7 +90,7 @@ namespace Timeline.Services /// If it is a personal timeline, then inner exception is . /// /// Thrown if user of does not exist. - Task CreateTextPost(string timelineName, long authorId, string text, DateTime? time); + Task CreateTextPost(string timelineName, long authorId, string text, DateTime? time); /// /// Create a new image post in timeline. @@ -108,7 +108,7 @@ namespace Timeline.Services /// /// Thrown if user of does not exist. /// Thrown if data is not a image. Validated by . - Task CreateImagePost(string timelineName, long authorId, byte[] imageData, DateTime? time); + Task CreateImagePost(string timelineName, long authorId, byte[] imageData, DateTime? time); /// /// Delete a post. @@ -179,9 +179,9 @@ namespace Timeline.Services _clock = clock; } - private async Task MapTimelinePostFromEntity(TimelinePostEntity entity, string timelineName) + private async Task MapTimelinePostFromEntity(TimelinePostEntity entity, string timelineName) { - User? author = entity.AuthorId.HasValue ? await _userService.GetUser(entity.AuthorId.Value) : null; + UserInfo? author = entity.AuthorId.HasValue ? await _userService.GetUser(entity.AuthorId.Value) : null; ITimelinePostContent? content = null; @@ -197,7 +197,7 @@ namespace Timeline.Services }; } - return new TimelinePost( + return new TimelinePostInfo( id: entity.LocalId, author: author, content: content, @@ -207,7 +207,7 @@ namespace Timeline.Services ); } - public async Task> GetPosts(string timelineName, DateTime? modifiedSince = null, bool includeDeleted = false) + public async Task> GetPosts(string timelineName, DateTime? modifiedSince = null, bool includeDeleted = false) { modifiedSince = modifiedSince?.MyToUtc(); @@ -231,7 +231,7 @@ namespace Timeline.Services var postEntities = await query.ToListAsync(); - var posts = new List(); + var posts = new List(); foreach (var entity in postEntities) { posts.Add(await MapTimelinePostFromEntity(entity, timelineName)); @@ -309,7 +309,7 @@ namespace Timeline.Services }; } - public async Task CreateTextPost(string timelineName, long authorId, string text, DateTime? time) + public async Task CreateTextPost(string timelineName, long authorId, string text, DateTime? time) { time = time?.MyToUtc(); @@ -342,7 +342,7 @@ namespace Timeline.Services await _database.SaveChangesAsync(); - return new TimelinePost( + return new TimelinePostInfo( id: postEntity.LocalId, content: new TextTimelinePostContent(text), time: finalTime, @@ -352,7 +352,7 @@ namespace Timeline.Services ); } - public async Task CreateImagePost(string timelineName, long authorId, byte[] data, DateTime? time) + public async Task CreateImagePost(string timelineName, long authorId, byte[] data, DateTime? time) { time = time?.MyToUtc(); @@ -391,7 +391,7 @@ namespace Timeline.Services _database.TimelinePosts.Add(postEntity); await _database.SaveChangesAsync(); - return new TimelinePost( + return new TimelinePostInfo( id: postEntity.LocalId, content: new ImageTimelinePostContent(tag), time: finalTime, -- cgit v1.2.3