feat: add web batch bulk operations
Deploy Telegram Bot / build-and-push (push) Successful in 3m21s
Deploy Telegram Bot / deploy (push) Successful in 11s

This commit is contained in:
2026-04-27 09:31:51 +03:00
parent 5f3516e703
commit 621ef553e7
12 changed files with 931 additions and 7 deletions
@@ -26,6 +26,17 @@ public sealed class AuthorizedSessionService(ISessionStore sessionStore)
return await GroupBelongsToGmAsync(session.GroupId, gmId) ? session : null;
}
public async Task<WebSessionBatch?> GetBatchForGmAsync(Guid batchId, long gmId)
{
var batch = await sessionStore.GetBatchAsync(batchId);
if (batch is null)
{
return null;
}
return await GroupBelongsToGmAsync(batch.GroupId, gmId) ? batch : null;
}
public async Task UpdateSessionForGmAsync(Guid sessionId, long gmId, string title, DateTime scheduledAt, string joinLink, int? maxPlayers)
{
var session = await GetSessionForGmAsync(sessionId, gmId);
@@ -48,6 +59,44 @@ public sealed class AuthorizedSessionService(ISessionStore sessionStore)
await sessionStore.PromoteWaitlistedPlayerAsync(sessionId, session.GroupId);
}
public async Task UpdateBatchDetailsForGmAsync(Guid batchId, long gmId, string title, string joinLink)
{
var batch = await GetBatchForGmAsync(batchId, gmId);
if (batch is null)
{
throw new SessionAccessDeniedException(batchId, gmId);
}
await sessionStore.UpdateBatchDetailsAsync(batchId, batch.GroupId, title.Trim(), joinLink.Trim());
}
public async Task RescheduleBatchForGmAsync(Guid batchId, long gmId, DateTime firstScheduledAt, int intervalDays)
{
if (intervalDays <= 0)
{
throw new ArgumentOutOfRangeException(nameof(intervalDays), intervalDays, "Interval must be greater than zero.");
}
var batch = await GetBatchForGmAsync(batchId, gmId);
if (batch is null)
{
throw new SessionAccessDeniedException(batchId, gmId);
}
await sessionStore.RescheduleBatchAsync(batchId, batch.GroupId, firstScheduledAt, intervalDays);
}
public async Task<WebSessionBatch> CloneBatchForGmAsync(Guid batchId, long gmId, BatchCloneInterval interval)
{
var batch = await GetBatchForGmAsync(batchId, gmId);
if (batch is null)
{
throw new SessionAccessDeniedException(batchId, gmId);
}
return await sessionStore.CloneBatchAsync(batchId, batch.GroupId, interval);
}
private async Task<bool> GroupBelongsToGmAsync(Guid groupId, long gmId)
{
var group = await sessionStore.GetGroupAsync(groupId);