feat(rendering): display description, system, duration, format, type and location in Telegram game card
This commit is contained in:
@@ -119,7 +119,14 @@ internal sealed record WebBatchSessionRow(
|
||||
long TelegramChatId,
|
||||
int? ThreadId,
|
||||
string NotificationMode,
|
||||
bool TopicCreatedByBot = false);
|
||||
bool TopicCreatedByBot = false,
|
||||
string? Description = null,
|
||||
string? System = null,
|
||||
int? DurationMinutes = null,
|
||||
string? Format = null,
|
||||
string? LocationAddress = null,
|
||||
bool IsOneShot = false,
|
||||
string? CoverImageUrl = null);
|
||||
internal sealed record WebTemplateGroupDto(long TelegramChatId);
|
||||
internal sealed record WebTemplateTopicDestination(int? MessageThreadId, bool TopicCreatedByBot);
|
||||
internal sealed record WebPublicGroupRow(
|
||||
@@ -1508,7 +1515,14 @@ public sealed class SessionService(
|
||||
g.external_group_id::BIGINT AS TelegramChatId,
|
||||
s.thread_id AS ThreadId,
|
||||
s.topic_created_by_bot AS TopicCreatedByBot,
|
||||
s.notification_mode AS NotificationMode
|
||||
s.notification_mode AS NotificationMode,
|
||||
s.description AS Description,
|
||||
s.system AS System,
|
||||
s.duration_minutes AS DurationMinutes,
|
||||
s.format AS Format,
|
||||
s.location_address AS LocationAddress,
|
||||
s.is_one_shot AS IsOneShot,
|
||||
s.cover_image_url AS CoverImageUrl
|
||||
FROM sessions s
|
||||
JOIN game_groups g ON g.id = s.group_id
|
||||
WHERE s.batch_id = @BatchId
|
||||
@@ -1536,8 +1550,14 @@ public sealed class SessionService(
|
||||
var scheduledAt = BatchSchedulePlanner.ShiftForClone(sourceSession.ScheduledAt, interval);
|
||||
var sessionId = await conn.ExecuteScalarAsync<Guid>(
|
||||
"""
|
||||
INSERT INTO sessions (batch_id, group_id, title, join_link, scheduled_at, status, thread_id, topic_created_by_bot, max_players, notification_mode)
|
||||
VALUES (@BatchId, @GroupId, @Title, @JoinLink, @ScheduledAt, @Status, @ThreadId, @TopicCreatedByBot, @MaxPlayers, @NotificationMode)
|
||||
INSERT INTO sessions (
|
||||
batch_id, group_id, title, join_link, scheduled_at, status, thread_id,
|
||||
topic_created_by_bot, max_players, notification_mode, description, system,
|
||||
duration_minutes, format, location_address, is_one_shot, cover_image_url)
|
||||
VALUES (
|
||||
@BatchId, @GroupId, @Title, @JoinLink, @ScheduledAt, @Status, @ThreadId,
|
||||
@TopicCreatedByBot, @MaxPlayers, @NotificationMode, @Description, @System,
|
||||
@DurationMinutes, @Format, @LocationAddress, @IsOneShot, @CoverImageUrl)
|
||||
RETURNING id
|
||||
""",
|
||||
new
|
||||
@@ -1551,11 +1571,29 @@ public sealed class SessionService(
|
||||
ThreadId = threadId,
|
||||
sourceSession.TopicCreatedByBot,
|
||||
sourceSession.MaxPlayers,
|
||||
sourceSession.NotificationMode
|
||||
sourceSession.NotificationMode,
|
||||
Description = sourceSession.Description,
|
||||
System = sourceSession.System,
|
||||
DurationMinutes = sourceSession.DurationMinutes,
|
||||
Format = sourceSession.Format,
|
||||
LocationAddress = sourceSession.LocationAddress,
|
||||
IsOneShot = sourceSession.IsOneShot,
|
||||
CoverImageUrl = sourceSession.CoverImageUrl
|
||||
},
|
||||
transaction);
|
||||
|
||||
renderedSessions.Add(new SessionBatchDto(sessionId, scheduledAt, SessionStatus.Planned, sourceSession.MaxPlayers, batchJoinLink));
|
||||
renderedSessions.Add(new SessionBatchDto(
|
||||
sessionId,
|
||||
scheduledAt,
|
||||
SessionStatus.Planned,
|
||||
sourceSession.MaxPlayers,
|
||||
batchJoinLink,
|
||||
sourceSession.Format,
|
||||
sourceSession.LocationAddress,
|
||||
sourceSession.Description,
|
||||
sourceSession.System,
|
||||
sourceSession.DurationMinutes,
|
||||
sourceSession.IsOneShot));
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
@@ -1770,7 +1808,18 @@ public sealed class SessionService(
|
||||
},
|
||||
transaction);
|
||||
|
||||
renderedSessions.Add(new SessionBatchDto(sessionId, scheduledAt, SessionStatus.Planned, template.MaxPlayers, template.JoinLink));
|
||||
renderedSessions.Add(new SessionBatchDto(
|
||||
sessionId,
|
||||
scheduledAt,
|
||||
SessionStatus.Planned,
|
||||
template.MaxPlayers,
|
||||
template.JoinLink,
|
||||
Format: null,
|
||||
LocationAddress: null,
|
||||
Description: null,
|
||||
System: null,
|
||||
DurationMinutes: null,
|
||||
IsOneShot: false));
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
@@ -1897,7 +1946,7 @@ public sealed class SessionService(
|
||||
await using var conn = await dataSource.OpenConnectionAsync();
|
||||
|
||||
var sessions = (await conn.QueryAsync<SessionBatchDto>(
|
||||
"SELECT id AS SessionId, scheduled_at AS ScheduledAt, status AS Status, max_players AS MaxPlayers, join_link AS JoinLink, format AS Format, location_address AS LocationAddress FROM sessions WHERE batch_id = @BatchId ORDER BY scheduled_at",
|
||||
"SELECT id AS SessionId, scheduled_at AS ScheduledAt, status AS Status, max_players AS MaxPlayers, join_link AS JoinLink, format AS Format, location_address AS LocationAddress, description AS Description, system AS System, duration_minutes AS DurationMinutes, is_one_shot AS IsOneShot FROM sessions WHERE batch_id = @BatchId ORDER BY scheduled_at",
|
||||
new { BatchId = batchId })).ToList();
|
||||
|
||||
var participants = (await conn.QueryAsync<ParticipantBatchDto>(
|
||||
|
||||
Reference in New Issue
Block a user