mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-22 13:31:08 +00:00
fix tests
This commit is contained in:
parent
f2180e5e0b
commit
dbd8e931a4
4 changed files with 13 additions and 7 deletions
|
@ -7,7 +7,7 @@ IBIS_BACKEND_PORT="${IBIS_BACKEND_PORT:-8081}"
|
||||||
# https://stackoverflow.com/a/52033580
|
# https://stackoverflow.com/a/52033580
|
||||||
(trap 'kill 0' SIGINT;
|
(trap 'kill 0' SIGINT;
|
||||||
# start frontend
|
# start frontend
|
||||||
trunk serve -w src/frontend/ --proxy-backend http://127.0.0.1:$IBIS_BACKEND_PORT &
|
CARGO_TARGET_DIR=target/frontend trunk serve -w src/frontend/ --proxy-backend http://127.0.0.1:$IBIS_BACKEND_PORT &
|
||||||
# # start backend, with separate target folder to avoid rebuilds from arch change
|
# # start backend, with separate target folder to avoid rebuilds from arch change
|
||||||
CARGO_TARGET_DIR=target/backend cargo watch -x run
|
cargo watch -x run
|
||||||
)
|
)
|
||||||
|
|
|
@ -216,9 +216,15 @@ pub(in crate::backend::api) async fn fork_article(
|
||||||
pub(super) async fn resolve_article(
|
pub(super) async fn resolve_article(
|
||||||
Query(query): Query<ResolveObject>,
|
Query(query): Query<ResolveObject>,
|
||||||
data: Data<MyDataHandle>,
|
data: Data<MyDataHandle>,
|
||||||
) -> MyResult<Json<DbArticle>> {
|
) -> MyResult<Json<ArticleView>> {
|
||||||
let article = ObjectId::from(query.id).dereference(&data).await?;
|
let article: DbArticle = ObjectId::from(query.id).dereference(&data).await?;
|
||||||
Ok(Json(article))
|
let edits = DbEdit::read_for_article(&article, &data.db_connection)?;
|
||||||
|
let latest_version = edits.last().unwrap().hash.clone();
|
||||||
|
Ok(Json(ArticleView {
|
||||||
|
article,
|
||||||
|
edits,
|
||||||
|
latest_version,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Search articles for matching title or body text.
|
/// Search articles for matching title or body text.
|
||||||
|
|
|
@ -156,7 +156,7 @@ impl ApiClient {
|
||||||
Ok(handle_json_res(req).await.unwrap())
|
Ok(handle_json_res(req).await.unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn resolve_article(&self, id: Url) -> MyResult<DbArticle> {
|
pub async fn resolve_article(&self, id: Url) -> MyResult<ArticleView> {
|
||||||
let resolve_object = ResolveObject { id };
|
let resolve_object = ResolveObject { id };
|
||||||
self.get_query("article/resolve", Some(resolve_object))
|
self.get_query("article/resolve", Some(resolve_object))
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn Search() -> impl IntoView {
|
||||||
join!(search, resolve_article, resolve_instance);
|
join!(search, resolve_article, resolve_instance);
|
||||||
search_results.instance = resolve_instance.ok();
|
search_results.instance = resolve_instance.ok();
|
||||||
if let Ok(article) = resolve_article {
|
if let Ok(article) = resolve_article {
|
||||||
search_results.articles.push(article);
|
search_results.articles.push(article.article);
|
||||||
}
|
}
|
||||||
search_results.articles.append(&mut search.unwrap())
|
search_results.articles.append(&mut search.unwrap())
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue