Skip to content

Commit

Permalink
Fix merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
sabotack committed Nov 28, 2023
1 parent c1f6b63 commit 3cf686c
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/api/ecdar_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ use super::server::server::{
};
use crate::api::auth::{RequestExt, Token, TokenType};
use crate::api::context_collection::ContextCollection;
use crate::database::{
access_context::AccessContextTrait, in_use_context::InUseContextTrait,
model_context::ModelContextTrait, query_context::QueryContextTrait,
session_context::SessionContextTrait, user_context::UserContextTrait,
};
use crate::entities::access::Model;
use crate::entities::{access, query, session, user};
use crate::database::{session_context::SessionContextTrait, user_context::UserContextTrait};
use crate::entities::{access, model, query, session, user};
use regex::Regex;
use sea_orm::SqlErr;
use serde_json;
Expand Down Expand Up @@ -129,7 +124,7 @@ impl EcdarApi for ConcreteEcdarApi {
owner_id: uid,
};

match self.model_context.create(model).await {
match self.contexts.model_context.create(model).await {
Ok(model) => Ok(Response::new(CreateModelResponse { id: model.id })),
Err(error) => Err(Status::internal(error.to_string())),
}
Expand All @@ -150,14 +145,15 @@ impl EcdarApi for ConcreteEcdarApi {
.ok_or(Status::internal("Could not get uid from request metadata"))?;

// Check if the model exists
let model = match self.model_context.get_by_id(message.id).await {
let model = match self.contexts.model_context.get_by_id(message.id).await {
Ok(Some(model)) => model,
Ok(None) => return Err(Status::not_found("No model found with given id")),
Err(error) => return Err(Status::internal(error.to_string())),
};

// Check if the user has access to the model
let access = match self

Check warning on line 155 in src/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

unused variable: `access`

warning: unused variable: `access` --> src/api/ecdar_api.rs:155:13 | 155 | let access = match self | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_access` | = note: `#[warn(unused_variables)]` on by default

Check warning on line 155 in src/api/ecdar_api.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

unused variable: `access`

warning: unused variable: `access` --> src/api/ecdar_api.rs:155:13 | 155 | let access = match self | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_access` | = note: `#[warn(unused_variables)]` on by default
.contexts
.access_context
.get_access_by_uid_and_model_id(uid, model.id)
.await
Expand Down Expand Up @@ -201,7 +197,7 @@ impl EcdarApi for ConcreteEcdarApi {
},
};

match self.model_context.update(new_model).await {
match self.contexts.model_context.update(new_model).await {
Ok(_) => Ok(Response::new(())),
Err(error) => Err(Status::new(Code::Internal, error.to_string())),
}
Expand Down

0 comments on commit 3cf686c

Please sign in to comment.