Add Phase 1 critical endpoints: Config & Save/Load system

- Added ConfigController with 4 endpoints:
  - getGameConfig: Server config, feature flags, URLs
  - getServerTime: UTC timestamps
  - getFeatureFlags: Feature toggles
  - getServerStatus: Health check

- Added save/load system to ProgressionController:
  - POST /save/{synergyId}: Save JSON blob
  - GET /save/{synergyId}/load: Load JSON blob
  - Version tracking and timestamps

- Added PlayerSave entity to database:
  - Stores arbitrary JSON game state
  - Version tracking (increments on save)
  - LastModified timestamps

- Updated appsettings.json:
  - ServerSettings section (version, URLs, MOTD)
  - FeatureFlags section (7 feature toggles)

- Created migration: AddPlayerSavesAndConfig
- Updated ApiModels with new DTOs
- All endpoints tested and working

Phase 1 objectives complete:
 Synergy ID generation (already existed)
 Configuration endpoints (new)
 Save/load system (new)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-21 23:53:43 -08:00
parent c0ddf3aa6f
commit e839064b35
28 changed files with 1918 additions and 13 deletions

View File

@@ -130,3 +130,75 @@ public class DirectorResponse
public string environment { get; set; } = "COMMUNITY";
public string version { get; set; } = "1.0.0";
}
// Configuration models
public class GameConfig
{
public long ServerTime { get; set; }
public string ServerVersion { get; set; } = string.Empty;
public string GameVersion { get; set; } = string.Empty;
public bool MaintenanceMode { get; set; }
public string MessageOfTheDay { get; set; } = string.Empty;
public FeatureFlags FeatureFlags { get; set; } = new();
public ServerUrls Urls { get; set; } = new();
}
public class FeatureFlags
{
public bool MultiplayerEnabled { get; set; }
public bool LeaderboardsEnabled { get; set; }
public bool DailyRewardsEnabled { get; set; }
public bool TimeTrialsEnabled { get; set; }
public bool CustomContentEnabled { get; set; }
public bool SpecialEventsEnabled { get; set; }
public bool AllItemsFree { get; set; }
}
public class ServerUrls
{
public string BaseUrl { get; set; } = string.Empty;
public string AssetsUrl { get; set; } = string.Empty;
public string LeaderboardsUrl { get; set; } = string.Empty;
public string MultiplayerUrl { get; set; } = string.Empty;
}
public class ServerTime
{
public long ServerTimestamp { get; set; }
public long ServerTimeMs { get; set; }
public string Timezone { get; set; } = "UTC";
public bool IsDST { get; set; }
}
public class ServerStatus
{
public string Status { get; set; } = "online";
public string Version { get; set; } = string.Empty;
public bool MaintenanceMode { get; set; }
public int PlayerCount { get; set; }
public long Uptime { get; set; }
public string Message { get; set; } = string.Empty;
}
// Save/Load models
public class PlayerSaveData
{
public string SynergyId { get; set; } = string.Empty;
public string SaveDataJson { get; set; } = string.Empty;
public long Version { get; set; } = 1;
public long LastModified { get; set; }
}
public class SaveDataRequest
{
public string SynergyId { get; set; } = string.Empty;
public string SaveData { get; set; } = string.Empty;
}
public class SaveDataResponse
{
public string SaveData { get; set; } = string.Empty;
public long Version { get; set; }
public long LastModified { get; set; }
public bool Success { get; set; }
}