- POST /v1/in/stats/daily: 기간별 일별 통계 - POST /v1/in/stats/summary: 대시보드 요약 통계 - POST /v1/in/stats/message: 메시지별 발송 통계 - POST /v1/in/stats/hourly: 시간대별 발송 추이 - POST /v1/in/stats/device: 디바이스 분포 통계 - IDailyStatRepository, DailyStatRepository 신규 - IPushSendLogRepository 통계 메서드 확장 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
858 B
C#
25 lines
858 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using SPMS.Domain.Entities;
|
|
using SPMS.Domain.Interfaces;
|
|
|
|
namespace SPMS.Infrastructure.Persistence.Repositories;
|
|
|
|
public class DailyStatRepository : Repository<DailyStat>, IDailyStatRepository
|
|
{
|
|
public DailyStatRepository(AppDbContext context) : base(context) { }
|
|
|
|
public async Task<IReadOnlyList<DailyStat>> GetByDateRangeAsync(long serviceId, DateOnly startDate, DateOnly endDate)
|
|
{
|
|
return await _dbSet
|
|
.Where(s => s.ServiceId == serviceId && s.StatDate >= startDate && s.StatDate <= endDate)
|
|
.OrderByDescending(s => s.StatDate)
|
|
.ToListAsync();
|
|
}
|
|
|
|
public async Task<DailyStat?> GetByDateAsync(long serviceId, DateOnly date)
|
|
{
|
|
return await _dbSet
|
|
.FirstOrDefaultAsync(s => s.ServiceId == serviceId && s.StatDate == date);
|
|
}
|
|
}
|