Update all dependencies - autoclosed #17
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.cuddle/
|
||||||
|
.git/
|
||||||
|
target/
|
93
.drone.yml
93
.drone.yml
@ -1,88 +1,5 @@
|
|||||||
kind: pipeline
|
kind: template
|
||||||
name: default
|
load: bust_rustbin_default_template.yaml
|
||||||
type: docker
|
name: como
|
||||||
|
data:
|
||||||
steps:
|
binName: como_bin
|
||||||
- name: load_secret
|
|
||||||
image: debian:buster-slim
|
|
||||||
volumes:
|
|
||||||
- name: ssh
|
|
||||||
path: /root/.ssh/
|
|
||||||
environment:
|
|
||||||
SSH_KEY:
|
|
||||||
from_secret: gitea_id_ed25519
|
|
||||||
commands:
|
|
||||||
- mkdir -p $HOME/.ssh/
|
|
||||||
- echo "$SSH_KEY" | base64 -d > $HOME/.ssh/id_ed25519
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
image: kasperhermansen/cuddle:latest
|
|
||||||
pull: always
|
|
||||||
volumes:
|
|
||||||
- name: ssh
|
|
||||||
path: /root/.ssh/
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
commands:
|
|
||||||
- apk add bash git
|
|
||||||
- git remote set-url origin $DRONE_GIT_SSH_URL
|
|
||||||
- cuddle_cli x setup_ssh
|
|
||||||
- cuddle_cli x start_deployment
|
|
||||||
- cuddle_cli x render_templates
|
|
||||||
- cuddle_cli x render_como_templates
|
|
||||||
- cuddle_cli x build_release
|
|
||||||
- cuddle_cli x push_release
|
|
||||||
- cuddle_cli x deploy_release
|
|
||||||
environment:
|
|
||||||
DOCKER_BUILDKIT: 1
|
|
||||||
DOCKER_USERNAME:
|
|
||||||
from_secret: docker_username
|
|
||||||
DOCKER_PASSWORD:
|
|
||||||
from_secret: docker_password
|
|
||||||
SSH_KEY:
|
|
||||||
from_secret: gitea_id_ed25519
|
|
||||||
|
|
||||||
- name: push_tags
|
|
||||||
image: kasperhermansen/drone-semantic-release:latest
|
|
||||||
pull: always
|
|
||||||
volumes:
|
|
||||||
- name: ssh
|
|
||||||
path: /root/.ssh/
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
commands:
|
|
||||||
- semantic-release --no-ci
|
|
||||||
environment:
|
|
||||||
DOCKER_BUILDKIT: 1
|
|
||||||
SSH_KEY:
|
|
||||||
from_secret: gitea_id_ed25519
|
|
||||||
depends_on:
|
|
||||||
- build
|
|
||||||
|
|
||||||
- name: send telegram notification
|
|
||||||
image: appleboy/drone-telegram
|
|
||||||
settings:
|
|
||||||
token:
|
|
||||||
from_secret: telegram_token
|
|
||||||
to: 2129601481
|
|
||||||
format: markdown
|
|
||||||
depends_on:
|
|
||||||
- build
|
|
||||||
- push_tags
|
|
||||||
when:
|
|
||||||
status: [failure, success]
|
|
||||||
|
|
||||||
services:
|
|
||||||
- name: docker
|
|
||||||
image: docker:dind
|
|
||||||
privileged: true
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
volumes:
|
|
||||||
- name: ssh
|
|
||||||
temp: {}
|
|
||||||
- name: dockersock
|
|
||||||
temp: {}
|
|
||||||
|
|
||||||
|
|
||||||
|
1
.env
1
.env
@ -3,6 +3,7 @@ POSTGRES_USER=como
|
|||||||
POSTGRES_PASSWORD=somenotverysecurepassword
|
POSTGRES_PASSWORD=somenotverysecurepassword
|
||||||
|
|
||||||
DATABASE_URL="postgres://como:somenotverysecurepassword@localhost:5432/como"
|
DATABASE_URL="postgres://como:somenotverysecurepassword@localhost:5432/como"
|
||||||
|
SQLX_OFFLINE=true
|
||||||
RUST_LOG=como_api=info,como_bin=info,como_core=info,como_domain=info,como_gql=info,como_infrastructure=info,sqlx=debug,tower_http=debug
|
RUST_LOG=como_api=info,como_bin=info,como_core=info,como_domain=info,como_gql=info,como_infrastructure=info,sqlx=debug,tower_http=debug
|
||||||
TOKEN_SECRET=something
|
TOKEN_SECRET=something
|
||||||
API_PORT=3001
|
API_PORT=3001
|
||||||
|
1121
Cargo.lock
generated
1121
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
41
Cargo.toml
41
Cargo.toml
@ -1,9 +1,48 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"como_bin",
|
|
||||||
"como_core",
|
"como_core",
|
||||||
"como_domain",
|
"como_domain",
|
||||||
"como_infrastructure",
|
"como_infrastructure",
|
||||||
"como_gql",
|
"como_gql",
|
||||||
"como_api",
|
"como_api",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[package]
|
||||||
|
name = "como_bin"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
como_gql = { path = "como_gql" }
|
||||||
|
como_core = { path = "como_core" }
|
||||||
|
como_domain = { path = "como_domain" }
|
||||||
|
como_infrastructure = { path = "como_infrastructure" }
|
||||||
|
como_api = { path = "como_api" }
|
||||||
|
|
||||||
|
async-graphql = "5.0.9"
|
||||||
|
async-graphql-axum = "*"
|
||||||
|
axum = "0.6.18"
|
||||||
|
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
||||||
|
axum-sessions = { version = "*" }
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0.96"
|
||||||
|
tokio = { version = "1.28.1", features = ["full"] }
|
||||||
|
uuid = { version = "1.3.3", features = ["v4", "fast-rng"] }
|
||||||
|
sqlx = { version = "0.6", features = [
|
||||||
|
"runtime-tokio-rustls",
|
||||||
|
"postgres",
|
||||||
|
"migrate",
|
||||||
|
"uuid",
|
||||||
|
"offline",
|
||||||
|
] }
|
||||||
|
anyhow = "1.0.71"
|
||||||
|
dotenv = "0.15.0"
|
||||||
|
tracing = "0.1.37"
|
||||||
|
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||||
|
tower-http = { version = "0.4.0", features = ["full"] }
|
||||||
|
argon2 = "0.5"
|
||||||
|
rand_core = { version = "0.6", features = ["std"] }
|
||||||
|
cookie = { version = "0.17", features = ["secure", "percent-encode"] }
|
||||||
|
clap = { version = "4", features = ["derive", "env"] }
|
||||||
|
0
Dockerfile
Normal file
0
Dockerfile
Normal file
@ -11,16 +11,16 @@ 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 = "5.0.9"
|
||||||
async-graphql-axum = "*"
|
async-graphql-axum = "*"
|
||||||
axum = "0.5.13"
|
axum = "0.6.18"
|
||||||
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
||||||
axum-sessions = { version = "*" }
|
axum-sessions = { version = "*" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0.68"
|
serde_json = "1.0.96"
|
||||||
|
|
||||||
tokio = { version = "1.20.1", features = ["full"] }
|
tokio = { version = "1.28.1", features = ["full"] }
|
||||||
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
|
uuid = { version = "1.3.3", features = ["v4", "fast-rng"] }
|
||||||
sqlx = { version = "0.6", features = [
|
sqlx = { version = "0.6", features = [
|
||||||
"runtime-tokio-rustls",
|
"runtime-tokio-rustls",
|
||||||
"postgres",
|
"postgres",
|
||||||
@ -28,12 +28,12 @@ sqlx = { version = "0.6", features = [
|
|||||||
"uuid",
|
"uuid",
|
||||||
"offline",
|
"offline",
|
||||||
] }
|
] }
|
||||||
anyhow = "1.0.60"
|
anyhow = "1.0.71"
|
||||||
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.17", features = ["env-filter"] }
|
||||||
argon2 = "0.4"
|
argon2 = "0.5"
|
||||||
rand_core = { version = "0.6", features = ["std"] }
|
rand_core = { version = "0.6", features = ["std"] }
|
||||||
cookie = { version = "0.16", features = ["secure", "percent-encode"] }
|
cookie = { version = "0.17", features = ["secure", "percent-encode"] }
|
||||||
tower = { version = "0.4", features = ["timeout"] }
|
tower = { version = "0.4", features = ["timeout"] }
|
||||||
tower-http = { version = "0.3", features = ["trace", "cors"] }
|
tower-http = { version = "0.4", features = ["trace", "cors"] }
|
||||||
|
@ -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,
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "como_bin"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
como_gql = { path = "../como_gql" }
|
|
||||||
como_core = { path = "../como_core" }
|
|
||||||
como_domain = { path = "../como_domain" }
|
|
||||||
como_infrastructure = { path = "../como_infrastructure" }
|
|
||||||
como_api = { path = "../como_api" }
|
|
||||||
|
|
||||||
async-graphql = "4.0.6"
|
|
||||||
async-graphql-axum = "*"
|
|
||||||
axum = "0.5.13"
|
|
||||||
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
|
||||||
axum-sessions = { version = "*" }
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde_json = "1.0.68"
|
|
||||||
tokio = { version = "1.20.1", features = ["full"] }
|
|
||||||
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
|
|
||||||
sqlx = { version = "0.6", features = [
|
|
||||||
"runtime-tokio-rustls",
|
|
||||||
"postgres",
|
|
||||||
"migrate",
|
|
||||||
"uuid",
|
|
||||||
"offline",
|
|
||||||
] }
|
|
||||||
anyhow = "1.0.60"
|
|
||||||
dotenv = "0.15.0"
|
|
||||||
tracing = "0.1.36"
|
|
||||||
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
|
|
||||||
tower-http = { version = "0.3.4", features = ["full"] }
|
|
||||||
argon2 = "0.4"
|
|
||||||
rand_core = { version = "0.6", features = ["std"] }
|
|
||||||
cookie = { version = "0.16", features = ["secure", "percent-encode"] }
|
|
||||||
clap = { version = "3", features = ["derive", "env"] }
|
|
@ -8,24 +8,24 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
como_domain = { path = "../como_domain" }
|
como_domain = { path = "../como_domain" }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
axum = "0.5.1"
|
axum = "0.6.18"
|
||||||
|
|
||||||
# utilty crates
|
# utilty crates
|
||||||
serde = { version = "1.0.136", features = ["derive"] }
|
serde = { version = "1.0.163", features = ["derive"] }
|
||||||
sqlx = { version = "0.5", features = [
|
sqlx = { version = "0.6", features = [
|
||||||
"runtime-tokio-rustls",
|
"runtime-tokio-rustls",
|
||||||
"postgres",
|
"postgres",
|
||||||
"time",
|
"time",
|
||||||
] }
|
] }
|
||||||
serde_json = "1.0.81"
|
serde_json = "1.0.96"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
tracing-subscriber = "0.3"
|
tracing-subscriber = "0.3"
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
validator = { version = "0.15", features = ["derive"] }
|
validator = { version = "0.16", features = ["derive"] }
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
rust-argon2 = "1.0"
|
rust-argon2 = "1.0"
|
||||||
clap = { version = "3", features = ["derive", "env"] }
|
clap = { version = "4", features = ["derive", "env"] }
|
||||||
mockall = "0.11.1"
|
mockall = "0.11.4"
|
||||||
time = "0.2"
|
time = "0.3"
|
||||||
|
@ -6,8 +6,8 @@ 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 = "5.0.9", features = ["uuid"] }
|
||||||
anyhow = "1.0.60"
|
anyhow = "1.0.71"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0.68"
|
serde_json = "1.0.96"
|
||||||
uuid = { version = "1.1.2", features = ["v4", "fast-rng", "serde"] }
|
uuid = { version = "1.3.3", features = ["v4", "fast-rng", "serde"] }
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -10,15 +10,15 @@ 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 = "5.0.9"
|
||||||
async-graphql-axum = "*"
|
async-graphql-axum = "*"
|
||||||
axum = "0.5.13"
|
axum = "0.6.18"
|
||||||
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
||||||
axum-sessions = { version = "*" }
|
axum-sessions = { version = "*" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0.68"
|
serde_json = "1.0.96"
|
||||||
tokio = { version = "1.20.1", features = ["full"] }
|
tokio = { version = "1.28.1", features = ["full"] }
|
||||||
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
|
uuid = { version = "1.3.3", features = ["v4", "fast-rng"] }
|
||||||
sqlx = { version = "0.6", features = [
|
sqlx = { version = "0.6", features = [
|
||||||
"runtime-tokio-rustls",
|
"runtime-tokio-rustls",
|
||||||
"postgres",
|
"postgres",
|
||||||
@ -26,11 +26,11 @@ sqlx = { version = "0.6", features = [
|
|||||||
"uuid",
|
"uuid",
|
||||||
"offline",
|
"offline",
|
||||||
] }
|
] }
|
||||||
anyhow = "1.0.60"
|
anyhow = "1.0.71"
|
||||||
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.17", features = ["env-filter"] }
|
||||||
tower-http = { version = "0.3.4", features = ["full"] }
|
tower-http = { version = "0.4.0", features = ["full"] }
|
||||||
argon2 = "0.4"
|
argon2 = "0.5"
|
||||||
rand_core = { version = "0.6", features = ["std"] }
|
rand_core = { version = "0.6", features = ["std"] }
|
||||||
cookie = { version = "0.16", features = ["secure", "percent-encode"] }
|
cookie = { version = "0.17", features = ["secure", "percent-encode"] }
|
||||||
|
@ -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},
|
||||||
|
@ -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> {
|
||||||
|
@ -9,15 +9,15 @@ 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 = "5.0.9"
|
||||||
async-graphql-axum = "*"
|
async-graphql-axum = "*"
|
||||||
axum = "0.5.13"
|
axum = "0.6.18"
|
||||||
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
|
||||||
axum-sessions = { version = "*" }
|
axum-sessions = { version = "*" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0.68"
|
serde_json = "1.0.96"
|
||||||
tokio = { version = "1.20.1", features = ["full"] }
|
tokio = { version = "1.28.1", features = ["full"] }
|
||||||
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
|
uuid = { version = "1.3.3", features = ["v4", "fast-rng"] }
|
||||||
sqlx = { version = "0.6", features = [
|
sqlx = { version = "0.6", features = [
|
||||||
"runtime-tokio-rustls",
|
"runtime-tokio-rustls",
|
||||||
"postgres",
|
"postgres",
|
||||||
@ -25,12 +25,12 @@ sqlx = { version = "0.6", features = [
|
|||||||
"uuid",
|
"uuid",
|
||||||
"offline",
|
"offline",
|
||||||
] }
|
] }
|
||||||
anyhow = "1.0.60"
|
anyhow = "1.0.71"
|
||||||
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.17", features = ["env-filter"] }
|
||||||
tower-http = { version = "0.3.4", features = ["full"] }
|
tower-http = { version = "0.4.0", features = ["full"] }
|
||||||
argon2 = "0.4"
|
argon2 = "0.5"
|
||||||
rand_core = { version = "0.6", features = ["std"] }
|
rand_core = { version = "0.6", features = ["std"] }
|
||||||
cookie = { version = "0.16", features = ["secure", "percent-encode"] }
|
cookie = { version = "0.17", features = ["secure", "percent-encode"] }
|
||||||
clap = { version = "3", features = ["derive", "env"] }
|
clap = { version = "4", features = ["derive", "env"] }
|
||||||
|
@ -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,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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"))
|
||||||
|
@ -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"))
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"query": "\n SELECT * from users\n where username=$1\n ",
|
|
||||||
"describe": {
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"ordinal": 0,
|
|
||||||
"name": "id",
|
|
||||||
"type_info": "Uuid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ordinal": 1,
|
|
||||||
"name": "username",
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ordinal": 2,
|
|
||||||
"name": "password_hash",
|
|
||||||
"type_info": "Varchar"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parameters": {
|
|
||||||
"Left": [
|
|
||||||
"Text"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"nullable": [
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"hash": "d3f222cf6c3d9816705426fdbed3b13cb575bb432eb1f33676c0b414e67aecaf"
|
|
||||||
}
|
|
3
renovate.json
Normal file
3
renovate.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
56
sqlx-data.json
Normal file
56
sqlx-data.json
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"db": "PostgreSQL",
|
||||||
|
"3b4484c5ccfd4dcb887c4e978fe6e45d4c9ecc2a73909be207dced79ddf17d87": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Varchar",
|
||||||
|
"Varchar"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "\n INSERT INTO users (username, password_hash) \n VALUES ( $1, $2 ) \n RETURNING id\n "
|
||||||
|
},
|
||||||
|
"d3f222cf6c3d9816705426fdbed3b13cb575bb432eb1f33676c0b414e67aecaf": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "username",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "password_hash",
|
||||||
|
"ordinal": 2,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Text"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "\n SELECT * from users\n where username=$1\n "
|
||||||
|
}
|
||||||
|
}
|
@ -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,
|
@ -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(),
|
@ -1,3 +1,3 @@
|
|||||||
FROM postgres:14-alpine
|
FROM postgres:15-alpine
|
||||||
|
|
||||||
COPY *.sh /docker-entrypoint-initdb.d/
|
COPY *.sh /docker-entrypoint-initdb.d/
|
||||||
|
Loading…
Reference in New Issue
Block a user