refactor(calendar): expose AllTime via GameCalendarPeriods, not the concrete service

Move the "all-time" constant out of GameCalendarService (concrete) into a new
static class GameCalendarPeriods. Consumers using IGameCalendarService no
longer have to reach through the concrete class to name the lifetime bucket.

Migrates 5 callsites (mission progress/assembler, admin, item purchase, tests).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-07-04 12:59:24 -04:00
parent e1b38d5649
commit fa89c32110
6 changed files with 14 additions and 10 deletions

View File

@@ -32,10 +32,14 @@ public interface IGameCalendarService
IReadOnlyList<string> AllPeriods(DateTimeOffset when);
}
public static class GameCalendarPeriods
{
/// <summary>The lifetime bucket string — same constant regardless of reset boundary config.</summary>
public const string AllTime = "all-time";
}
public class GameCalendarService : IGameCalendarService
{
public const string AllTime = "all-time";
private readonly IGameConfigService _config;
public GameCalendarService(IGameConfigService config)
@@ -73,7 +77,7 @@ public class GameCalendarService : IGameCalendarService
public IReadOnlyList<string> AllPeriods(DateTimeOffset when) => new[]
{
DayKey(when), WeekKey(when), MonthKey(when), AllTime,
DayKey(when), WeekKey(when), MonthKey(when), GameCalendarPeriods.AllTime,
};
private DateTime MostRecentBoundary(DateTime nowUtc)