fix(discord): cast COUNT to int for slash command list query #99

Closed
Toutsu wants to merge 0 commits from fix/discord-count-bigint-cast into main
Owner

Summary

/listsessions в Discord возвращала ошибку материализации Dapper:

A parameterless default constructor or one matching signature (...) is required for GmRelay.DiscordBot.Features.Sessions.DiscordSessionListItemDto materialization

Root cause: PostgreSQL COUNT() возвращает bigint, а DiscordSessionListItemDto ожидает int для полей PlayerCount и WaitlistCount. Dapper 2.1.72 (без Dapper.AOT) не умеет кастить bigint→int при материализации record с positional constructor.

Fix: Добавлены ::int к обоим COUNT выражениям в SQL запросе.

Changes

  • DiscordListSessionsHandler.csCOUNT(...)::int as PlayerCount, COUNT(...)::int as WaitlistCount
  • Версия синхронизирована до 3.0.6

Test plan

  • dotnet build src/GmRelay.DiscordBot — успешно
  • Полный test suite — 271/271 зеленых

Workflow

  • CI passes
  • Code review approved
  • Deployed
  • Release published
## Summary `/listsessions` в Discord возвращала ошибку материализации Dapper: > A parameterless default constructor or one matching signature (...) is required for `GmRelay.DiscordBot.Features.Sessions.DiscordSessionListItemDto` materialization **Root cause:** PostgreSQL `COUNT()` возвращает `bigint`, а `DiscordSessionListItemDto` ожидает `int` для полей `PlayerCount` и `WaitlistCount`. Dapper 2.1.72 (без Dapper.AOT) не умеет кастить bigint→int при материализации record с positional constructor. **Fix:** Добавлены `::int` к обоим `COUNT` выражениям в SQL запросе. ## Changes - `DiscordListSessionsHandler.cs` — `COUNT(...)::int as PlayerCount`, `COUNT(...)::int as WaitlistCount` - Версия синхронизирована до `3.0.6` ## Test plan - [x] `dotnet build src/GmRelay.DiscordBot` — успешно - [x] Полный test suite — 271/271 зеленых ## Workflow - [ ] CI passes - [ ] Code review approved - [ ] Deployed - [ ] Release published
Toutsu added 1 commit 2026-05-26 10:11:17 +03:00
fix(discord): cast COUNT to int for slash command list query
PR Checks / test-and-build (pull_request) Successful in 9m34s
dd9337dd20
PostgreSQL COUNT() returns bigint, but DiscordSessionListItemDto expects
int for PlayerCount and WaitlistCount. Dapper 2.1.72 in GmRelay.DiscordBot
(without Dapper.AOT) fails to materialize the record with bigint→int mismatch.
Added ::int casts to both COUNT expressions.

Bump version to 3.0.6.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Toutsu reviewed 2026-05-26 10:23:55 +03:00
Toutsu left a comment
Author
Owner

Approved. CI passed. Minimal and correct fix.

Approved. CI passed. Minimal and correct fix.
Toutsu closed this pull request 2026-05-26 16:06:28 +03:00
Some checks are pending
PR Checks / test-and-build (pull_request) Successful in 9m34s

Pull request closed

Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Toutsu/GmRelayBot#99