Embeddable funds

 Chat message embeddable poll
This commit is contained in:
2025-11-16 21:22:45 +08:00
parent 6252988390
commit 9b4f61fcda
10 changed files with 322 additions and 50 deletions

View File

@@ -300,18 +300,6 @@ public class PollService(AppDatabase db, ICacheService cache)
var poll = await db.Polls
.Where(e => e.Id == pollId)
.FirstOrDefaultAsync();
if (poll is null)
throw new Exception("Poll not found");
return new PollEmbed { Id = poll.Id };
}
public async Task<PollEmbed> LoadPollEmbed(Guid pollId, Guid? accountId)
{
var poll = await GetPoll(pollId) ?? throw new Exception("Poll not found");
var pollWithStats = PollWithStats.FromPoll(poll);
pollWithStats.Stats = await GetPollStats(poll.Id);
if (accountId is not null)
pollWithStats.UserAnswer = await GetPollAnswer(poll.Id, accountId.Value);
return new PollEmbed { Id = poll.Id, Poll = pollWithStats };
return poll is null ? throw new Exception("Poll not found") : new PollEmbed { Id = poll.Id };
}
}