feat: include private repo contributions in graph metrics
Aggregate graph endpoints (daily counts, language daily counts, source summaries, OG image) now include private repository activity. These endpoints only expose numeric counts — no commit messages, repo names, or other metadata — so private details remain hidden. The activity timeline continues to serve only public events. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -196,7 +196,7 @@ impl EventReader for PgStore {
|
||||
.collect()
|
||||
}
|
||||
|
||||
async fn daily_counts(&self, from: NaiveDate, to: NaiveDate) -> Result<Vec<DailyCount>, StoreError> {
|
||||
async fn daily_counts(&self, from: NaiveDate, to: NaiveDate, include_private: bool) -> Result<Vec<DailyCount>, StoreError> {
|
||||
let rows = sqlx::query(
|
||||
r#"
|
||||
SELECT d::date AS date,
|
||||
@@ -205,13 +205,14 @@ impl EventReader for PgStore {
|
||||
LEFT JOIN events e
|
||||
ON e.occurred_at >= (d::date || 'T00:00:00Z')::timestamptz
|
||||
AND e.occurred_at < ((d::date + 1) || 'T00:00:00Z')::timestamptz
|
||||
AND e.public = true
|
||||
AND ($3::bool OR e.public = true)
|
||||
GROUP BY d::date
|
||||
ORDER BY d::date
|
||||
"#,
|
||||
)
|
||||
.bind(from)
|
||||
.bind(to)
|
||||
.bind(include_private)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(map_err)?;
|
||||
@@ -226,7 +227,7 @@ impl EventReader for PgStore {
|
||||
.collect()
|
||||
}
|
||||
|
||||
async fn language_daily_counts(&self, from: NaiveDate, to: NaiveDate) -> Result<Vec<LanguageDailyCount>, StoreError> {
|
||||
async fn language_daily_counts(&self, from: NaiveDate, to: NaiveDate, include_private: bool) -> Result<Vec<LanguageDailyCount>, StoreError> {
|
||||
let rows = sqlx::query(
|
||||
r#"
|
||||
SELECT date, language, color,
|
||||
@@ -244,7 +245,7 @@ impl EventReader for PgStore {
|
||||
JOIN events e
|
||||
ON e.occurred_at >= (d::date || 'T00:00:00Z')::timestamptz
|
||||
AND e.occurred_at < ((d::date + 1) || 'T00:00:00Z')::timestamptz
|
||||
AND e.public = true
|
||||
AND ($3::bool OR e.public = true)
|
||||
AND e.action IN ('Commit', 'PushEvent', 'commit_repo')
|
||||
JOIN repo_languages rl
|
||||
ON rl.source = e.source
|
||||
@@ -273,6 +274,7 @@ impl EventReader for PgStore {
|
||||
)
|
||||
.bind(from)
|
||||
.bind(to)
|
||||
.bind(include_private)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map_err(map_err)?;
|
||||
|
||||
Reference in New Issue
Block a user