Update Rust crate tracing to 0.1.37 - autoclosed #9

Closed
kjuulh wants to merge 5 commits from renovate/tracing-0.x into main
16 changed files with 53 additions and 28 deletions

12
Cargo.lock generated
View File

@ -2934,9 +2934,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.36" version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"log", "log",
@ -2947,9 +2947,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-attributes" name = "tracing-attributes"
version = "0.1.22" version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2958,9 +2958,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.29" version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"valuable", "valuable",

View File

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

View File

@ -30,7 +30,7 @@ sqlx = { version = "0.6", features = [
] } ] }
anyhow = "1.0.60" anyhow = "1.0.60"
dotenv = "0.15.0" dotenv = "0.15.0"
tracing = "0.1.36" tracing = "0.1.37"
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
argon2 = "0.4" argon2 = "0.4"
rand_core = { version = "0.6", features = ["std"] } rand_core = { version = "0.6", features = ["std"] }

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

@ -30,7 +30,7 @@ sqlx = { version = "0.6", features = [
] } ] }
anyhow = "1.0.60" anyhow = "1.0.60"
dotenv = "0.15.0" dotenv = "0.15.0"
tracing = "0.1.36" tracing = "0.1.37"
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
tower-http = { version = "0.3.4", features = ["full"] } tower-http = { version = "0.3.4", features = ["full"] }
argon2 = "0.4" argon2 = "0.4"

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

@ -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

@ -28,7 +28,7 @@ sqlx = { version = "0.6", features = [
] } ] }
anyhow = "1.0.60" anyhow = "1.0.60"
dotenv = "0.15.0" dotenv = "0.15.0"
tracing = "0.1.36" tracing = "0.1.37"
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
tower-http = { version = "0.3.4", features = ["full"] } tower-http = { version = "0.3.4", features = ["full"] }
argon2 = "0.4" argon2 = "0.4"

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

@ -27,7 +27,7 @@ sqlx = { version = "0.6", features = [
] } ] }
anyhow = "1.0.60" anyhow = "1.0.60"
dotenv = "0.15.0" dotenv = "0.15.0"
tracing = "0.1.36" tracing = "0.1.37"
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
tower-http = { version = "0.3.4", features = ["full"] } tower-http = { version = "0.3.4", features = ["full"] }
argon2 = "0.4" argon2 = "0.4"

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"
}