Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit bcd078a

Browse files
committed
Add project ID to autocomplete
1 parent a5c3dbd commit bcd078a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

server/bleep/src/webserver.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ pub async fn start(app: Application) -> anyhow::Result<()> {
5050

5151
let mut api = Router::new()
5252
.route("/config", get(config::get).put(config::put))
53-
// autocomplete
54-
.route("/autocomplete", get(autocomplete::handle))
5553
// indexing
5654
.route("/index", get(index::handle))
5755
// repo management
@@ -119,6 +117,7 @@ pub async fn start(app: Application) -> anyhow::Result<()> {
119117
get(conversation::get).delete(conversation::delete),
120118
)
121119
.route("/projects/:project_id/q", get(query::handle))
120+
.route("/projects/:project_id/autocomplete", get(autocomplete::handle))
122121
.route("/projects/:project_id/search/path", get(search::fuzzy_path))
123122
.route("/projects/:project_id/answer/vote", post(answer::vote))
124123
.route("/projects/:project_id/answer", get(answer::answer))

server/bleep/src/webserver/autocomplete.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
},
1414
};
1515

16-
use axum::{extract::Query, response::IntoResponse as IntoAxumResponse, Extension};
16+
use axum::{extract::{Query, Path}, response::IntoResponse as IntoAxumResponse, Extension};
1717
use futures::{stream, StreamExt, TryStreamExt};
1818
use serde::Serialize;
1919

@@ -36,12 +36,15 @@ pub struct AutocompleteParams {
3636
pub(super) async fn handle(
3737
Query(mut api_params): Query<ApiQuery>,
3838
Query(ac_params): Query<AutocompleteParams>,
39+
Path(project_id): Path<i64>,
3940
Extension(indexes): Extension<Arc<Indexes>>,
4041
) -> Result<impl IntoAxumResponse> {
4142
// Override page_size and set to low value
4243
api_params.page = 0;
4344
api_params.page_size = 8;
4445

46+
api_params.project_id = project_id;
47+
4548
let mut partial_lang = None;
4649
let mut has_target = false;
4750

0 commit comments

Comments
 (0)