feat: impl dashboard & issue list

This commit is contained in:
2026-05-06 01:42:38 +08:00
parent bef3a0b9ed
commit 7de0039d38
36 changed files with 2381 additions and 107 deletions

View File

@@ -1,11 +1,11 @@
use std::fmt::format;
use reqwest::{Response, dns::Resolving};
use serde::{Deserialize, Serialize};
use crate::query;
pub(crate) mod auth;
pub(crate) mod issues;
#[cfg(debug_assertions)]
mod mock;
pub(crate) mod repo;
pub(crate) mod user;
@@ -14,6 +14,9 @@ pub struct QueryContext {
pub(crate) http: reqwest::Client,
pub(crate) auth: Option<AuthTokens>,
pub(crate) github: GithubCredentials,
#[cfg(debug_assertions)]
pub(crate) should_use_fixtures: bool,
}
#[derive(Clone, Serialize, Deserialize)]
@@ -30,6 +33,8 @@ pub(crate) struct GithubCredentials {
#[derive(Debug)]
pub(crate) enum Error {
Unauthenticated,
#[cfg(debug_assertions)]
MissingMockFixture(String),
Github(GithubError),
MalformedResponse(serde_json::Error),
HttpError(reqwest::Error),
@@ -63,6 +68,16 @@ impl QueryContext {
}
}
#[cfg(debug_assertions)]
pub(crate) fn use_github_fixtures() -> bool {
mock::is_enabled()
}
#[cfg(not(debug_assertions))]
pub(crate) fn use_github_fixtures() -> bool {
false
}
impl query::Context for QueryContext {}
impl From<reqwest::Error> for Error {