Update Rust crate anyhow to 1.0.66 - autoclosed #2
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -108,9 +108,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.60"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c794e162a5eff65c72ef524dfe393eb923c354e350bb78b9c7383df13f3bc142"
|
||||
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
|
||||
|
||||
[[package]]
|
||||
name = "argon2"
|
||||
|
@ -28,7 +28,7 @@ sqlx = { version = "0.6", features = [
|
||||
"uuid",
|
||||
"offline",
|
||||
] }
|
||||
anyhow = "1.0.60"
|
||||
anyhow = "1.0.66"
|
||||
dotenv = "0.15.0"
|
||||
tracing = "0.1.36"
|
||||
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
|
||||
|
@ -12,7 +12,7 @@ use crate::controllers::graphql::GraphQLController;
|
||||
pub struct Api;
|
||||
|
||||
impl Api {
|
||||
pub async fn new(
|
||||
pub async fn run_api(
|
||||
port: u32,
|
||||
cors_origin: &str,
|
||||
service_register: ServiceRegister,
|
||||
|
@ -28,7 +28,7 @@ sqlx = { version = "0.6", features = [
|
||||
"uuid",
|
||||
"offline",
|
||||
] }
|
||||
anyhow = "1.0.60"
|
||||
anyhow = "1.0.66"
|
||||
dotenv = "0.15.0"
|
||||
tracing = "0.1.36"
|
||||
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
|
||||
|
@ -1,6 +1,7 @@
|
||||
use axum::{http::StatusCode, response::IntoResponse, Json};
|
||||
use serde_json::json;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub enum AppError {
|
||||
WrongCredentials,
|
||||
|
@ -29,7 +29,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let service_register = ServiceRegister::new(pool, config.clone());
|
||||
|
||||
Api::new(
|
||||
Api::run_api(
|
||||
config.api_port,
|
||||
&config.cors_origin,
|
||||
service_register.clone(),
|
||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-graphql = { version = "4.0.6", features = ["uuid"] }
|
||||
anyhow = "1.0.60"
|
||||
anyhow = "1.0.66"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0.68"
|
||||
uuid = { version = "1.1.2", features = ["v4", "fast-rng", "serde"] }
|
||||
|
@ -2,7 +2,7 @@ pub mod queries;
|
||||
pub mod requests;
|
||||
pub mod responses;
|
||||
|
||||
use async_graphql::{Enum, InputObject, SimpleObject};
|
||||
use async_graphql::{Enum, InputObject};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
@ -26,7 +26,7 @@ sqlx = { version = "0.6", features = [
|
||||
"uuid",
|
||||
"offline",
|
||||
] }
|
||||
anyhow = "1.0.60"
|
||||
anyhow = "1.0.66"
|
||||
dotenv = "0.15.0"
|
||||
tracing = "0.1.36"
|
||||
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
|
||||
|
@ -4,8 +4,6 @@ use como_domain::{
|
||||
item::{
|
||||
queries::{GetItemQuery, GetItemsQuery},
|
||||
requests::CreateItemDto,
|
||||
responses::CreatedItemDto,
|
||||
ItemDto,
|
||||
},
|
||||
projects::{
|
||||
queries::{GetProjectQuery, GetProjectsQuery},
|
||||
|
@ -35,19 +35,19 @@ pub struct Item {
|
||||
#[Object]
|
||||
impl Item {
|
||||
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> {
|
||||
return Ok(self.title.clone());
|
||||
Ok(self.title.clone())
|
||||
}
|
||||
|
||||
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> {
|
||||
return Ok(self.state);
|
||||
Ok(self.state)
|
||||
}
|
||||
|
||||
pub async fn project(&self, ctx: &Context<'_>) -> anyhow::Result<Project> {
|
||||
|
@ -25,7 +25,7 @@ sqlx = { version = "0.6", features = [
|
||||
"uuid",
|
||||
"offline",
|
||||
] }
|
||||
anyhow = "1.0.60"
|
||||
anyhow = "1.0.66"
|
||||
dotenv = "0.15.0"
|
||||
tracing = "0.1.36"
|
||||
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
|
||||
|
@ -7,8 +7,7 @@ use crate::{
|
||||
configs::AppConfig,
|
||||
database::ConnectionPool,
|
||||
services::{
|
||||
item_service::{DefaultItemService, MemoryItemService},
|
||||
project_service::{DefaultProjectService, MemoryProjectService},
|
||||
item_service::MemoryItemService, project_service::MemoryProjectService,
|
||||
user_service::DefaultUserService,
|
||||
},
|
||||
};
|
||||
@ -26,14 +25,14 @@ impl ServiceRegister {
|
||||
|
||||
let item_service = Arc::new(MemoryItemService::new()) as DynItemService;
|
||||
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");
|
||||
|
||||
return Self {
|
||||
Self {
|
||||
item_service,
|
||||
user_service,
|
||||
project_service,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ use std::{
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
use axum::async_trait;
|
||||
use como_core::items::ItemService;
|
||||
use como_domain::item::{
|
||||
@ -21,6 +22,12 @@ impl DefaultItemService {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DefaultItemService {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ItemService for DefaultItemService {
|
||||
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]
|
||||
impl ItemService for MemoryItemService {
|
||||
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() {
|
||||
let item = item_store
|
||||
.get(&query.item_id.to_string())
|
||||
.ok_or(anyhow::anyhow!("could not find item"))?;
|
||||
.context("could not find item")?;
|
||||
return Ok(item.clone());
|
||||
} else {
|
||||
Err(anyhow::anyhow!("could not unlock item_store"))
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use anyhow::Context;
|
||||
use axum::async_trait;
|
||||
use como_core::projects::ProjectService;
|
||||
use como_domain::projects::{
|
||||
@ -16,6 +17,12 @@ impl DefaultProjectService {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DefaultProjectService {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ProjectService for DefaultProjectService {
|
||||
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]
|
||||
impl ProjectService for MemoryProjectService {
|
||||
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 {
|
||||
Ok(ps
|
||||
.get(&item_id.to_string())
|
||||
.ok_or(anyhow::anyhow!("could not find project"))?
|
||||
.context("could not find project")?
|
||||
.clone())
|
||||
} else {
|
||||
Err(anyhow::anyhow!("could not find project"))
|
||||
|
3
renovate.json
Normal file
3
renovate.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||
}
|
Loading…
Reference in New Issue
Block a user