aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/TimelinePostService.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-27 00:07:09 +0800
committercrupest <crupest@outlook.com>2020-11-27 00:07:09 +0800
commit3f4e88757f961532b84df85e86d21995655a29d4 (patch)
tree1dbb69aadcd4d3287ae0d2aad913365abc44a18e /BackEnd/Timeline/Services/TimelinePostService.cs
parentc2ca954fc8bc0f12ad2ece715cb6c4a633a23119 (diff)
downloadtimeline-3f4e88757f961532b84df85e86d21995655a29d4.tar.gz
timeline-3f4e88757f961532b84df85e86d21995655a29d4.tar.bz2
timeline-3f4e88757f961532b84df85e86d21995655a29d4.zip
refactor: ...
Diffstat (limited to 'BackEnd/Timeline/Services/TimelinePostService.cs')
-rw-r--r--BackEnd/Timeline/Services/TimelinePostService.cs24
1 files changed, 12 insertions, 12 deletions
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 <paramref name="timelineName"/> does not exist.
/// If it is a personal timeline, then inner exception is <see cref="UserNotExistException"/>.
/// </exception>
- Task<List<TimelinePost>> GetPosts(string timelineName, DateTime? modifiedSince = null, bool includeDeleted = false);
+ Task<List<TimelinePostInfo>> GetPosts(string timelineName, DateTime? modifiedSince = null, bool includeDeleted = false);
/// <summary>
/// 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 <see cref="UserNotExistException"/>.
/// </exception>
/// <exception cref="UserNotExistException">Thrown if user of <paramref name="authorId"/> does not exist.</exception>
- Task<TimelinePost> CreateTextPost(string timelineName, long authorId, string text, DateTime? time);
+ Task<TimelinePostInfo> CreateTextPost(string timelineName, long authorId, string text, DateTime? time);
/// <summary>
/// Create a new image post in timeline.
@@ -108,7 +108,7 @@ namespace Timeline.Services
/// </exception>
/// <exception cref="UserNotExistException">Thrown if user of <paramref name="authorId"/> does not exist.</exception>
/// <exception cref="ImageException">Thrown if data is not a image. Validated by <see cref="ImageValidator"/>.</exception>
- Task<TimelinePost> CreateImagePost(string timelineName, long authorId, byte[] imageData, DateTime? time);
+ Task<TimelinePostInfo> CreateImagePost(string timelineName, long authorId, byte[] imageData, DateTime? time);
/// <summary>
/// Delete a post.
@@ -179,9 +179,9 @@ namespace Timeline.Services
_clock = clock;
}
- private async Task<TimelinePost> MapTimelinePostFromEntity(TimelinePostEntity entity, string timelineName)
+ private async Task<TimelinePostInfo> 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<List<TimelinePost>> GetPosts(string timelineName, DateTime? modifiedSince = null, bool includeDeleted = false)
+ public async Task<List<TimelinePostInfo>> 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<TimelinePost>();
+ var posts = new List<TimelinePostInfo>();
foreach (var entity in postEntities)
{
posts.Add(await MapTimelinePostFromEntity(entity, timelineName));
@@ -309,7 +309,7 @@ namespace Timeline.Services
};
}
- public async Task<TimelinePost> CreateTextPost(string timelineName, long authorId, string text, DateTime? time)
+ public async Task<TimelinePostInfo> 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<TimelinePost> CreateImagePost(string timelineName, long authorId, byte[] data, DateTime? time)
+ public async Task<TimelinePostInfo> 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,