feat: implement repo fetching, add sentry

This commit is contained in:
2026-01-15 20:12:54 -08:00
parent 6f2f64fd73
commit 68d9a0a626
12 changed files with 822 additions and 51 deletions

View File

@@ -4,13 +4,15 @@ use serde::{Deserialize, Serialize};
use crate::{AppState, account::AccountRepository, error::Result};
#[derive(Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
struct Repository {
id: u64,
name: String,
full_name: String,
description: String,
language: String,
stars: usize,
description: Option<String>,
language: Option<String>,
#[serde(alias = "stargazers_count")]
stars: Option<usize>,
updated_at: DateTime<Utc>,
private: bool,
}
@@ -25,11 +27,13 @@ pub async fn get_repos(
let response = app_state
.reqwest_client
.get("https://api.github.com/user/repos")
.get("https://api.github.com/user/repos?affiliation=owner")
.bearer_auth(token)
.send()
.await?;
response.error_for_status_ref()?;
let data = response.json::<Vec<Repository>>().await?;
tracing::debug!(github_response = ?data.iter().filter(|r| r.private == true).collect::<Vec<&Repository>>(), "received repos");
Ok(HttpResponse::Ok().json(response.json::<Vec<Repository>>().await?))
Ok(HttpResponse::Ok().json(data))
}