feat: golang v2#26
Draft
Destinea wants to merge 202 commits into
Draft
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Validate day param in legendStatsDay to prevent BSON injection - Generic JWT error message to avoid leaking internal details - url.PathEscape for clan tags in war.go HTTP calls - Goroutine semaphores in mobileFetchPlayersBasic (50) and mobileFetchWarSummariesByClan (20) - N+1 → batch query in mobileFetchPlayerWarTimerClansBatch - Handle cur.All() errors in tickets.go (links, players, users) - Add projections on ClanDB and LeaderboardDB queries in leaderboards.go - Propagate cur.All() errors in legend rankings, leaderboard, raid weekend
…tickets/open Closes #27 The tickets/open endpoint was spending ~15s on live Discord member lookups (64 users × rate-limited REST calls). This PR adds a shared Valkey cache so the bot can populate member identities and the API reads from cache first. - Add internal/utils/cache.go: CacheAdapter wrapping valkey-go client - Key format: discord:guild_member:{guild_id}:{user_id} - Supports positive entries (username/display_name/avatar_url) and negative entries (not_on_server: true) for confirmed-absent users - Degrades gracefully: no-op when REDIS_IP is unset or connection fails - Add Cache *CacheAdapter to Deps; initialize in main.go; close on shutdown - tickets.go: resolve missing identities from Valkey cache before falling back to live Discord API calls, reducing discord_ms from ~15s to near 0 when cache is warm
- #300: initialise entries array on giveaway creation so the bot can push entries - #275: use $unset instead of $set:null when clearing ticket panel channel fields - #298: resolve internal UUIDs to Discord IDs in getLinks so Go-API-created accounts appear alongside legacy Python-bot accounts
Tests hit a live API at localhost:8000 and require SERVER_ID env var. Run with: go test -tags integration ./test/integration/...
- #267: listRosterGroups now returns key "items" instead of "groups" so the dashboard fetchGroups function can read the list correctly - #273: add recover() in warSummaryBulk goroutines so a panic in one clan's fetch cannot crash the whole server
…toboards - #209: getAllRoles now includes category_roles from the server document alongside the existing status_roles, so clan category role assignments are visible in the all-roles endpoint - #266: getAutoboards now checks each resolved channel against the Discord API and sets channel_deleted: true on items whose channel no longer exists
- #207: add GET /v2/server/:server_id/giveaways/:giveaway_id/entries returns each entrant with their entry count and win chance percentage (users with boosters appear multiple times in entries array, so counts reflect their actual weighted probability) - #263: cap live Discord API lookups in getOpenTickets at 20 per request to prevent slow responses on servers with many uncached ticket users; users beyond the cap still appear in the list without display names
- Fix giveawayEntryCount using []any assertion instead of bson.A, causing entry count to always return 0 - Fix giveawayBoosters with same bson.A assertion bug - Add CategoryRoles to RoleSettingsUpdate model to allow PATCH updates - Support $set/$unset per-key dot-notation updates for category_roles in patchRoleSettings - Return category_roles values as strings in getRoleSettings and getAllRoles to prevent JS precision loss on large Discord snowflake IDs - Add categoryRolesStrings helper - Remove erroneous #298 entry from BUGFIXES.txt (not a bug)
Add GiveawayEntrant and GiveawayEntriesResponse Pydantic models. Add get_giveaway_entries endpoint that reads the entries array, handles both plain user-ID strings and dict entries, counts each user's entries via Counter, computes win_chance, and returns the sorted entrant list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.