Skip to content

Commit

Permalink
Feedback update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKrol committed Jan 14, 2025
1 parent 1d1ffac commit c3961cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
10 changes: 1 addition & 9 deletions backend/src/handlers_prelude/github_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,11 @@ pub async fn list_branches_handler(
State(state): State<AppState>,
) -> Result<(StatusCode, Json<ApiResponse<BranchesData>>), (StatusCode, String)> {
// Fetch the branch details from GitHub using the GitHubClient instance
<<<<<<< HEAD
let branch_details = state
.gh_client
.list_branches() // Call the method on the GitHubClient instance
=======
let branch_details = state.gh_client
.list_branches()
>>>>>>> 854ef16962a08c055c24b6d4ca8eaa65a78e98c1
.await
.map_err(|err| {
// Handle errors in fetching branch details (e.g., connection issues)
eyre_to_axum_err(err)
})?;
.map_err(|err| eyre_to_axum_err(err))?;

// Extract branch names and handle protection status if needed
let branches: Vec<String> = branch_details
Expand Down
21 changes: 10 additions & 11 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,21 @@ async fn main() -> Result<()> {
/// Initialize an instance of [`AppState`]
#[tracing::instrument]
async fn init_state(cli_args: &Args) -> Result<AppState> {

let repo_url = config.files.repo_url.clone();
let repo_path = config.files.repo_path.clone();
let docs_path = config.files.docs_path.clone();
let asset_path = config.files.asset_path.clone();
let repo_url = CONFIG.files.repo_url.clone();
let repo_path = CONFIG.files.repo_path.clone();
let docs_path = CONFIG.files.docs_path.clone();
let asset_path = CONFIG.files.asset_path.clone();

let git =
task::spawn(async { git::Interface::new(repo_url, repo_path, docs_path, asset_path) })
.await??;
let reqwest_client = Client::new();

let oauth = BasicClient::new(
ClientId::new(config.oauth.discord.client_id.clone()),
Some(ClientSecret::new(config.oauth.discord.secret.clone())),
AuthUrl::new(config.oauth.discord.url.clone())?,
Some(TokenUrl::new(config.oauth.discord.token_url.clone())?),
ClientId::new(CONFIG.oauth.discord.client_id.clone()),
Some(ClientSecret::new(CONFIG.oauth.discord.secret.clone())),
AuthUrl::new(CONFIG.oauth.discord.url.clone())?,
Some(TokenUrl::new(CONFIG.oauth.discord.token_url.clone())?),
);

Ok(AppState {
Expand All @@ -161,9 +160,9 @@ async fn init_state(cli_args: &Args) -> Result<AppState> {
oauth,
reqwest_client: reqwest_client.clone(),
gh_client: GitHubClient::new(
config.files.repo_url.clone(),
CONFIG.files.repo_url.clone(),
reqwest_client.clone(),
config.oauth.github.client_id.clone(),
CONFIG.oauth.github.client_id.clone(),
),
db: Database::new().await?,
})
Expand Down

0 comments on commit c3961cb

Please sign in to comment.