You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: Apply PR #576 review comments and improve architecture
Changes based on @neSpecc review:
1. TypeDefs improvements:
- Use DateTime! instead of String! for date parameters in Project.chartData
2. Method renaming for clarity:
- eventsFactory: getChartData → getProjectChartData
- eventsFactory: getChartDataFromMongo → getEventDailyChart
- Improved parameter order (main identifier first)
3. Code quality:
- Remove duplication in try-catch blocks
- Extract Redis key composition to utility functions
4. Architecture improvements:
- Create ChartDataService to separate business logic from Redis client
- Simplify RedisHelper to only low-level Redis operations
- Add tsRange() method for TS.RANGE commands
- Move chart data logic from redisHelper to dedicated service
5. New utilities:
- src/utils/redisKeys.ts with composeTimeSeriesKey(), composeEventTimeSeriesKey()
- Type-safe key composition with required parameters
Benefits:
- Clear separation of concerns (Data Access vs Business Logic vs Service)
- RedisHelper stays focused and doesn't grow
- Easier to test and maintain
- Better type safety and documentation
0 commit comments