Open
Conversation
Add missing reminders collection to the new MongoClient class. The reminders endpoints in routers/v2/server/reminders.py require access to mongo.reminders, which was missing from the MongoClient init. The reminders collection is located in the 'usafam' database alongside server_db and clan_db collections.
Corrected field names to match ClashKingBot's database schema: - Clan Capital: use 'townhalls' instead of 'townhall_filter' - Clan Games: use 'townhalls' instead of 'townhall_filter' - War/Inactivity: keep 'townhall_filter' (already correct) - Roster: ensure ObjectId conversion for roster field Changes: - POST: Create reminders with correct field names per type - GET: Read 'townhalls' for Capital/Games, 'townhall_filter' for War/Inactivity - PUT: Update correct field based on reminder type This ensures compatibility with existing ClashKingBot reminder data.
Complete comparison between ClashKingBot v2.0 and ClashKingAPI feat/dashboard: - ✅ 6 endpoint categories already implemented (reminders, logs, autoboards, links, server/clan settings) - ❌ ~62 missing endpoints identified across 4 priority categories -⚠️ Schema compatibility issues documented Missing endpoints breakdown: - Server Settings (general, nickname, eval, roles): ~24 endpoints - HIGH priority - Clan Settings (basic, war, member warning, buttons): ~18 endpoints - HIGH priority - Role Management (TH, league, achievement, status): ~18 endpoints - MEDIUM priority - Clan Management (add/remove): ~2 endpoints - MEDIUM priority Recommendations: - Phase 1: Basic server/clan settings (2-3 days) - Phase 2: Advanced settings (nickname, eval, warnings) (2-3 days) - Phase 3: Role management (3-4 days) - Phase 4: Clan management (1-2 days) Includes detailed field mappings from ClashKingBot database schema.
Create consolidated endpoints instead of 40+ individual PUT endpoints:
Server Settings (PATCH /v2/server/{server_id}/settings):
- Nickname conventions (family/non-family rules, auto-eval, flair)
- Auto-eval configuration (triggers, log channel, status)
- Role management (blacklist, treatment, whitelist)
- Channels (banlist, strike log, reddit feed)
- Link parse settings (clan, army, player, base, show)
- General settings (leadership eval, tied stats, autoboard limit, etc.)
Clan Settings (PATCH /v2/server/{server_id}/clan/{clan_tag}/settings):
- Basic settings (member/leader roles, channel, category, abbreviation, greeting)
- War settings (countdown channels, ban alert)
- Member count warnings (channel, thresholds, ping role)
- Log buttons (profile, strike, ban buttons)
Benefits:
- Single request to update multiple settings (more efficient)
- Consistent pattern across server and clan configurations
- Only provided fields are updated (partial updates)
- Full Pydantic validation with field descriptions
- Compatible with ClashKingBot v2.0 database schema
Each endpoint:
- Uses @linkd.ext.fastapi.inject for MongoClient
- Uses @check_authentication for security
- Returns updated field count in response
- Validates server/clan existence before update
Clan Management Endpoints:
- POST /v2/server/{server_id}/clans
* Add clan to server with CoC API validation
* Creates default clan settings document
* Prevents duplicate clans per server
- DELETE /v2/server/{server_id}/clans/{clan_tag}
* Remove clan from server
* Cascades deletion to associated reminders
* Returns deleted count
Unified Role Management Endpoints (3 endpoints for 7 role types):
- GET /v2/server/{server_id}/roles/{role_type}
* List all roles of specific type
* Returns role configuration and count
- POST /v2/server/{server_id}/roles/{role_type}
* Create role with type-specific validation
* Prevents duplicate role configurations
* Dynamic request body based on role type
- DELETE /v2/server/{server_id}/roles/{role_type}/{role_id}
* Remove role by Discord role ID
* Handles special status role structure
Supported Role Types:
- townhall: TH level-based roles (TH 1-17)
- league: League-based roles (Legend, Titan, etc.)
- builderhall: BH level-based roles (BH 1-10)
- builder_league: Builder league roles
- achievement: Achievement-based roles
- status: Discord tenure roles (months in server)
- family_position: Position roles (elder, co-leader, leader)
Benefits:
- 18 individual endpoints reduced to 3 unified endpoints
- Type-safe with Pydantic models per role type
- Consistent pattern across all role types
- Direct access to separate MongoDB collections
- Compatible with ClashKingBot schema
Database Collections:
- townhallroles, legendleagueroles, builderhallroles
- builderleagueroles, achievementroles, statusroles
- family_roles (position roles)
Mark all high-priority endpoints as complete: - ✅ Server Settings: 24 fields → 1 PATCH endpoint - ✅ Clan Settings: 18 fields → 1 PATCH endpoint - ✅ Clan Management: POST/DELETE endpoints - ✅ Role Management: 7 types → 3 unified endpoints - ✅ Reminders: Schema fixes applied Summary: - 89% endpoint reduction (65 → 7) - 100% schema compatibility with ClashKingBot v2.0 - Complete API usage examples - Production-ready status All dashboard configuration needs are now covered.
Add DELETE /v2/server/{server_id}/clan/{clan_tag}/logs endpoint to remove
log configurations for specific log types.
Features:
- Delete multiple log types in one request via query parameter
- Query parameter accepts comma-separated log type list
- Uses MongoDB $unset to remove log configurations
- Compatible with dashboard branch claude/logs-channel-thread-fix-017B7mrL1LqN7ZGi3Gy4WAYs
Example usage:
DELETE /v2/server/123/clan/%232PP/logs?log_types=join_log,leave_log,donation_log
This endpoint complements the existing PUT endpoint which updates/creates log configurations.
Complete API reference for ClashKingDashboard integration: - All server settings endpoints - Clan management and settings endpoints - Logs configuration endpoints (including new DELETE endpoint) - Discord channels/threads endpoints - Reminders CRUD endpoints - Role management endpoints (unified) - Autoboards and links endpoints Each endpoint documented with: - Complete parameter list (including injected dependencies) - rest: hikari.RESTApp explicitly listed where used - Request/response examples - Authentication requirements - Error codes This document can be used in ClashKingDashboard repository as .claude/stats-endpoints-analysis.md
Added high and medium priority endpoints for ClashKingDashboard: Capital Endpoints: - GET /v2/capital/player-stats - Player raid statistics with pagination - GET /v2/capital/guild-leaderboard - Server clan leaderboard Activity Endpoints: - GET /v2/activity/guild-summary - Server-wide activity overview - GET /v2/activity/inactive-players - List of inactive members Legends Endpoints: - GET /v2/legends/guild-stats - Aggregate legend statistics - GET /v2/legends/daily-tracking - Daily trophy progression All endpoints follow established patterns: - Use @linkd.ext.fastapi.inject for dependency injection - Use @check_authentication with rest: hikari.RESTApp parameter - Include Pydantic models for request/response validation - Proper error handling (404, 400, etc.)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
…int (#18) Co-authored-by: Claude <noreply@anthropic.com> fix: add missing aiohttp and requests dependencies
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.