Improvements, new data in rewind point

🐛 Fix most called rewind point unable to get real data
This commit is contained in:
2025-12-27 01:19:24 +08:00
parent 4443da5660
commit 50518351bc
4 changed files with 122 additions and 39 deletions

View File

@@ -310,17 +310,19 @@ public class PublisherService(
var publisher = await db.Publishers.FirstOrDefaultAsync(e => e.Name == name);
if (publisher is null) return null;
var postsCount = await db.Posts.Where(e => e.Publisher.Id == publisher.Id).CountAsync();
var postsCount = await db.Posts.Where(e => e.PublisherId == publisher.Id).CountAsync();
var postsUpvotes = await db.PostReactions
.Where(r => r.Post.Publisher.Id == publisher.Id &&
.Where(r => r.Post.PublisherId == publisher.Id &&
r.Attitude == Shared.Models.PostReactionAttitude.Positive)
.CountAsync();
var postsDownvotes = await db.PostReactions
.Where(r => r.Post.Publisher.Id == publisher.Id &&
.Where(r => r.Post.PublisherId == publisher.Id &&
r.Attitude == Shared.Models.PostReactionAttitude.Negative)
.CountAsync();
var stickerPacksId = await db.StickerPacks.Where(e => e.Publisher.Id == publisher.Id).Select(e => e.Id)
var stickerPacksId = await db.StickerPacks
.Where(e => e.PublisherId == publisher.Id)
.Select(e => e.Id)
.ToListAsync();
var stickerPacksCount = stickerPacksId.Count;