Commit e0cc08e6 authored by Szymon Zimnowoda's avatar Szymon Zimnowoda
Browse files

Merge branch 'sz/fix_pipeline' into 'dev'

fixing pipeline

See merge request !437
parents 535ebb80 a2e30ae3
Showing with 23 additions and 18 deletions
+23 -18
image: rust:latest
image: rust:1.71.1
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
......
......@@ -23,4 +23,4 @@ tracing = "0.1.36"
tracing-subscriber = { version = "0.3.15" }
uuid = { version = "1.3.3", features = ["fast-rng", "v4", "serde"] }
futures = "0.3.24"
validator = { version = "0.16.0", features = ["derive"] }
\ No newline at end of file
validator = { version = "0.16.0", features = ["derive"] }
......@@ -186,7 +186,7 @@ async fn find_key_and_nonce_by_sha256(tx: &AsyncTx, sha256: &str) -> Result<(Vec
.await?;
let Some(search_item) = search_res.pop_front() else {
return Err(any_error! {
return Err(any_error! {
StatusCode::NOT_FOUND,
"Item with sha256={sha256} not found",
});
......
......@@ -233,13 +233,13 @@ async fn resolve_target_node_names(
EdgeDirection::In => schema.get_in_edges_for_node(node_name),
};
let Some(edges) = edges else {
let Some(edges) = edges else {
return Err(bad_request!(
"Node {node_name} have no edges defined in {direction:?} direction"
));
};
let Some(edge_targets) = edges.get(edge_name) else {
let Some(edge_targets) = edges.get(edge_name) else {
return Err(bad_request!(
"Node {node_name} have no edge {edge_name} defined in {direction:?} direction"
));
......
......@@ -843,8 +843,8 @@ async fn check_kubernetes_limits(
/// Look for containers for given unique_id, kill them if any exist.
/// Currently it's used for mitigating rate limiting twitter api has.
async fn k8s_enforce_unique_instance(plugin: &PluginRunItem) -> Result<()> {
let Some(ref unique_id) = plugin.unique_id else {
return Ok(())
let Some(ref unique_id) = plugin.unique_id else {
return Ok(());
};
info!(
......@@ -871,7 +871,7 @@ async fn k8s_enforce_unique_instance(plugin: &PluginRunItem) -> Result<()> {
/// Currently it's used for mitigating rate limiting twitter api has.
async fn docker_enforce_unique_instance(plugin: &PluginRunItem) -> Result<()> {
let Some(ref unique_id) = plugin.unique_id else {
return Ok(())
return Ok(());
};
info!(
......
......@@ -145,8 +145,8 @@ pub async fn recover_pod_keys(init_db: &InitDb, body: &RecoverRequest) -> Result
#[instrument(fields(login=%body.login), skip_all)]
pub async fn verify(init_db: &InitDb, body: &RegisterVerifyAccountReq) -> Result<()> {
let mut conn = shared_state::db_connection(init_db).await?;
let Some(mut acc) = get_account_from_db(&mut conn, &body.login).await? else{
return Err(bad_request!("Account does not exist"))
let Some(mut acc) = get_account_from_db(&mut conn, &body.login).await? else {
return Err(bad_request!("Account does not exist"));
};
// Account already exists
......@@ -179,8 +179,8 @@ pub async fn resend_verification_mail(
body: &UserAccountCredentials,
) -> Result<()> {
let mut conn = shared_state::db_connection(init_db).await?;
let Some(mut acc) = get_account_from_db(&mut conn, &body.login).await? else {
return Err(bad_request!("No such account {}", body.login));
let Some(mut acc) = get_account_from_db(&mut conn, &body.login).await? else {
return Err(bad_request!("No such account {}", body.login));
};
validate_password(body.password.clone(), acc.item.password_hash.clone()).await?;
......@@ -291,7 +291,10 @@ pub async fn open_pod(init_db: &InitDb, body: PodCredentials) -> Result<PodOwner
pub async fn get_example_pod(cli: &CliOptions) -> Result<PodCredentials> {
debug!("Going to return example POD credentials");
let (Some(example_owner_key), Some(example_db_key)) = (&cli.owner_key_for_example_data, &cli.db_key_for_example_data) else {
let (Some(example_owner_key), Some(example_db_key)) = (
&cli.owner_key_for_example_data,
&cli.db_key_for_example_data,
) else {
return Err(internal_error!("No example POD credentials defined"));
};
......@@ -317,7 +320,9 @@ pub async fn delete_account(
let mut conn = shared_state::db_connection(init_db).await?;
let Some(acc) = get_account_from_db(&mut conn, &body.login).await? else {
return Err(bad_request!("There is no account registered with this email."));
return Err(bad_request!(
"There is no account registered with this email."
));
};
validate_password(body.password.clone(), acc.item.password_hash.clone()).await?;
......
......@@ -303,12 +303,12 @@ async fn handle_delete_items(tx: &AsyncTx, items: &HashSet<ItemId>) -> Result<()
pub async fn delete_edge(tx: &AsyncTx, payload: &DeleteEdgeReq) -> Result<()> {
for edge in &payload.edges {
let Some((source_type, _rowid)) = get_type_name_from_id(tx,&edge.source)? else {
let Some((source_type, _rowid)) = get_type_name_from_id(tx, &edge.source)? else {
warn!("Source node with id {} does not exist", edge.source);
continue;
};
let Some((target_type, _rowid)) = get_type_name_from_id(tx,&edge.target)? else {
let Some((target_type, _rowid)) = get_type_name_from_id(tx, &edge.target)? else {
warn!("Target node with id {} does not exist", edge.target);
continue;
};
......
......@@ -676,7 +676,7 @@ fn build_search_query_for_edge_to_node<'a>(payload: &SearchEdgeReq) -> Result<Se
};
let mut params: Vec<ToSqlOutput> = vec![payload.source_id.to_string().into()];
params.extend(target_node_query.params.into_iter());
params.extend(target_node_query.params);
let node_predicate = if target_node_query.predicates.is_empty() {
String::new()
......@@ -740,7 +740,7 @@ async fn get_node_names_for_query(
// get node type and rowid from the registry
let Some((item_name, rid)) = get_type_name_from_id(tx, id)? else {
// No such id in the database
return Ok(None)
return Ok(None);
};
if is_edge_type(&item_name) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment