Update Rust crate async-graphql to 4.0.16 - autoclosed #3

Closed
kjuulh wants to merge 5 commits from renovate/async-graphql-4.x into main
17 changed files with 58 additions and 31 deletions

18
Cargo.lock generated
View File

@ -163,15 +163,16 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql" name = "async-graphql"
version = "4.0.6" version = "4.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84ecd9edbd48b68e44f81b720d83e670d876dce440856feee6c892c8cd3f6798" checksum = "d9ed522678d412d77effe47b3c82314ac36952a35e6e852093dd48287c421f80"
dependencies = [ dependencies = [
"async-graphql-derive", "async-graphql-derive",
"async-graphql-parser", "async-graphql-parser",
"async-graphql-value", "async-graphql-value",
"async-stream", "async-stream",
"async-trait", "async-trait",
"base64",
"bytes", "bytes",
"fast_chemail", "fast_chemail",
"fnv", "fnv",
@ -186,6 +187,7 @@ dependencies = [
"regex", "regex",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded",
"static_assertions", "static_assertions",
"tempfile", "tempfile",
"thiserror", "thiserror",
@ -212,9 +214,9 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql-derive" name = "async-graphql-derive"
version = "4.0.6" version = "4.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8801127f6a7b3af410498d2f971ee6da8f12f9b0b784473da636ce04e5ac565" checksum = "c121a894495d7d3fc3d4e15e0a9843e422e4d1d9e3c514d8062a1c94b35b005d"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"async-graphql-parser", "async-graphql-parser",
@ -228,9 +230,9 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql-parser" name = "async-graphql-parser"
version = "4.0.6" version = "4.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4097e2e3e313a9220df25485046b7749f4b8d749aba8ed7e09e929d60a643e3" checksum = "6b6c386f398145c6180206c1869c2279f5a3d45db5be4e0266148c6ac5c6ad68"
dependencies = [ dependencies = [
"async-graphql-value", "async-graphql-value",
"pest", "pest",
@ -240,9 +242,9 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql-value" name = "async-graphql-value"
version = "4.0.6" version = "4.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cbb3f5e2eb77fbe173b102e3a9321a5f93a491f9c5ef3850e1155ae83c49e88" checksum = "7a941b499fead4a3fb5392cabf42446566d18c86313f69f2deab69560394d65f"
dependencies = [ dependencies = [
"bytes", "bytes",
"indexmap", "indexmap",

View File

@ -1,3 +1 @@
# Cibus Backend # Cibus Backend
Some text

View File

@ -11,7 +11,7 @@ como_core = { path = "../como_core" }
como_domain = { path = "../como_domain" } como_domain = { path = "../como_domain" }
como_infrastructure = { path = "../como_infrastructure" } como_infrastructure = { path = "../como_infrastructure" }
async-graphql = "4.0.6" async-graphql = "4.0.16"
async-graphql-axum = "*" async-graphql-axum = "*"
axum = "0.5.13" axum = "0.5.13"
axum-extra = { version = "*", features = ["cookie", "cookie-private"] } axum-extra = { version = "*", features = ["cookie", "cookie-private"] }

View File

@ -12,7 +12,7 @@ use crate::controllers::graphql::GraphQLController;
pub struct Api; pub struct Api;
impl Api { impl Api {
pub async fn new( pub async fn run_api(
port: u32, port: u32,
cors_origin: &str, cors_origin: &str,
service_register: ServiceRegister, service_register: ServiceRegister,

View File

@ -12,7 +12,7 @@ como_domain = { path = "../como_domain" }
como_infrastructure = { path = "../como_infrastructure" } como_infrastructure = { path = "../como_infrastructure" }
como_api = { path = "../como_api" } como_api = { path = "../como_api" }
async-graphql = "4.0.6" async-graphql = "4.0.16"
async-graphql-axum = "*" async-graphql-axum = "*"
axum = "0.5.13" axum = "0.5.13"
axum-extra = { version = "*", features = ["cookie", "cookie-private"] } axum-extra = { version = "*", features = ["cookie", "cookie-private"] }

View File

@ -1,6 +1,7 @@
use axum::{http::StatusCode, response::IntoResponse, Json}; use axum::{http::StatusCode, response::IntoResponse, Json};
use serde_json::json; use serde_json::json;
#[allow(dead_code)]
#[derive(Debug)] #[derive(Debug)]
pub enum AppError { pub enum AppError {
WrongCredentials, WrongCredentials,

View File

@ -29,7 +29,7 @@ async fn main() -> anyhow::Result<()> {
let service_register = ServiceRegister::new(pool, config.clone()); let service_register = ServiceRegister::new(pool, config.clone());
Api::new( Api::run_api(
config.api_port, config.api_port,
&config.cors_origin, &config.cors_origin,
service_register.clone(), service_register.clone(),

View File

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
async-graphql = { version = "4.0.6", features = ["uuid"] } async-graphql = { version = "4.0.16", features = ["uuid"] }
anyhow = "1.0.60" anyhow = "1.0.60"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.68" serde_json = "1.0.68"

View File

@ -2,7 +2,7 @@ pub mod queries;
pub mod requests; pub mod requests;
pub mod responses; pub mod responses;
use async_graphql::{Enum, InputObject, SimpleObject}; use async_graphql::{Enum, InputObject};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use uuid::Uuid; use uuid::Uuid;

View File

@ -10,7 +10,7 @@ como_core = { path = "../como_core" }
como_domain = { path = "../como_domain" } como_domain = { path = "../como_domain" }
como_infrastructure = { path = "../como_infrastructure" } como_infrastructure = { path = "../como_infrastructure" }
async-graphql = "4.0.6" async-graphql = "4.0.16"
async-graphql-axum = "*" async-graphql-axum = "*"
axum = "0.5.13" axum = "0.5.13"
axum-extra = { version = "*", features = ["cookie", "cookie-private"] } axum-extra = { version = "*", features = ["cookie", "cookie-private"] }

View File

@ -4,8 +4,6 @@ use como_domain::{
item::{ item::{
queries::{GetItemQuery, GetItemsQuery}, queries::{GetItemQuery, GetItemsQuery},
requests::CreateItemDto, requests::CreateItemDto,
responses::CreatedItemDto,
ItemDto,
}, },
projects::{ projects::{
queries::{GetProjectQuery, GetProjectsQuery}, queries::{GetProjectQuery, GetProjectsQuery},

View File

@ -35,19 +35,19 @@ pub struct Item {
#[Object] #[Object]
impl Item { impl Item {
pub async fn id(&self, _ctx: &Context<'_>) -> anyhow::Result<Uuid> { pub async fn id(&self, _ctx: &Context<'_>) -> anyhow::Result<Uuid> {
return Ok(self.id); Ok(self.id)
} }
pub async fn title(&self, _ctx: &Context<'_>) -> anyhow::Result<String> { pub async fn title(&self, _ctx: &Context<'_>) -> anyhow::Result<String> {
return Ok(self.title.clone()); Ok(self.title.clone())
} }
pub async fn description(&self, _ctx: &Context<'_>) -> anyhow::Result<Option<String>> { pub async fn description(&self, _ctx: &Context<'_>) -> anyhow::Result<Option<String>> {
return Ok(self.description.clone()); Ok(self.description.clone())
} }
pub async fn state(&self, _ctx: &Context<'_>) -> anyhow::Result<ItemState> { pub async fn state(&self, _ctx: &Context<'_>) -> anyhow::Result<ItemState> {
return Ok(self.state); Ok(self.state)
} }
pub async fn project(&self, ctx: &Context<'_>) -> anyhow::Result<Project> { pub async fn project(&self, ctx: &Context<'_>) -> anyhow::Result<Project> {

View File

@ -9,7 +9,7 @@ edition = "2021"
como_core = { path = "../como_core" } como_core = { path = "../como_core" }
como_domain = { path = "../como_domain" } como_domain = { path = "../como_domain" }
async-graphql = "4.0.6" async-graphql = "4.0.16"
async-graphql-axum = "*" async-graphql-axum = "*"
axum = "0.5.13" axum = "0.5.13"
axum-extra = { version = "*", features = ["cookie", "cookie-private"] } axum-extra = { version = "*", features = ["cookie", "cookie-private"] }

View File

@ -7,8 +7,7 @@ use crate::{
configs::AppConfig, configs::AppConfig,
database::ConnectionPool, database::ConnectionPool,
services::{ services::{
item_service::{DefaultItemService, MemoryItemService}, item_service::MemoryItemService, project_service::MemoryProjectService,
project_service::{DefaultProjectService, MemoryProjectService},
user_service::DefaultUserService, user_service::DefaultUserService,
}, },
}; };
@ -26,14 +25,14 @@ impl ServiceRegister {
let item_service = Arc::new(MemoryItemService::new()) as DynItemService; let item_service = Arc::new(MemoryItemService::new()) as DynItemService;
let project_service = Arc::new(MemoryProjectService::new()) as DynProjectService; let project_service = Arc::new(MemoryProjectService::new()) as DynProjectService;
let user_service = Arc::new(DefaultUserService::new(pool.clone())) as DynUserService; let user_service = Arc::new(DefaultUserService::new(pool)) as DynUserService;
info!("services created succesfully"); info!("services created succesfully");
return Self { Self {
item_service, item_service,
user_service, user_service,
project_service, project_service,
}; }
} }
} }

View File

@ -3,6 +3,7 @@ use std::{
sync::{Arc, Mutex}, sync::{Arc, Mutex},
}; };
use anyhow::Context;
use axum::async_trait; use axum::async_trait;
use como_core::items::ItemService; use como_core::items::ItemService;
use como_domain::item::{ use como_domain::item::{
@ -21,6 +22,12 @@ impl DefaultItemService {
} }
} }
impl Default for DefaultItemService {
fn default() -> Self {
Self::new()
}
}
#[async_trait] #[async_trait]
impl ItemService for DefaultItemService { impl ItemService for DefaultItemService {
async fn add_item(&self, _item: CreateItemDto) -> anyhow::Result<CreatedItemDto> { async fn add_item(&self, _item: CreateItemDto) -> anyhow::Result<CreatedItemDto> {
@ -48,6 +55,12 @@ impl MemoryItemService {
} }
} }
impl Default for MemoryItemService {
fn default() -> Self {
Self::new()
}
}
#[async_trait] #[async_trait]
impl ItemService for MemoryItemService { impl ItemService for MemoryItemService {
async fn add_item(&self, create_item: CreateItemDto) -> anyhow::Result<CreatedItemDto> { async fn add_item(&self, create_item: CreateItemDto) -> anyhow::Result<CreatedItemDto> {
@ -71,7 +84,7 @@ impl ItemService for MemoryItemService {
if let Ok(item_store) = self.item_store.lock() { if let Ok(item_store) = self.item_store.lock() {
let item = item_store let item = item_store
.get(&query.item_id.to_string()) .get(&query.item_id.to_string())
.ok_or(anyhow::anyhow!("could not find item"))?; .context("could not find item")?;
return Ok(item.clone()); return Ok(item.clone());
} else { } else {
Err(anyhow::anyhow!("could not unlock item_store")) Err(anyhow::anyhow!("could not unlock item_store"))

View File

@ -1,5 +1,6 @@
use std::{collections::HashMap, sync::Arc}; use std::{collections::HashMap, sync::Arc};
use anyhow::Context;
use axum::async_trait; use axum::async_trait;
use como_core::projects::ProjectService; use como_core::projects::ProjectService;
use como_domain::projects::{ use como_domain::projects::{
@ -16,6 +17,12 @@ impl DefaultProjectService {
} }
} }
impl Default for DefaultProjectService {
fn default() -> Self {
Self::new()
}
}
#[async_trait] #[async_trait]
impl ProjectService for DefaultProjectService { impl ProjectService for DefaultProjectService {
async fn get_project(&self, _query: GetProjectQuery) -> anyhow::Result<ProjectDto> { async fn get_project(&self, _query: GetProjectQuery) -> anyhow::Result<ProjectDto> {
@ -38,6 +45,12 @@ impl MemoryProjectService {
} }
} }
impl Default for MemoryProjectService {
fn default() -> Self {
Self::new()
}
}
#[async_trait] #[async_trait]
impl ProjectService for MemoryProjectService { impl ProjectService for MemoryProjectService {
async fn get_project(&self, query: GetProjectQuery) -> anyhow::Result<ProjectDto> { async fn get_project(&self, query: GetProjectQuery) -> anyhow::Result<ProjectDto> {
@ -45,7 +58,7 @@ impl ProjectService for MemoryProjectService {
if let Some(item_id) = query.item_id { if let Some(item_id) = query.item_id {
Ok(ps Ok(ps
.get(&item_id.to_string()) .get(&item_id.to_string())
.ok_or(anyhow::anyhow!("could not find project"))? .context("could not find project")?
.clone()) .clone())
} else { } else {
Err(anyhow::anyhow!("could not find project")) Err(anyhow::anyhow!("could not find project"))

3
renovate.json Normal file
View File

@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}