From 74ea9ddf795476b9ace09d64bf39ba9b2789bfb9 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Wed, 10 Apr 2024 20:50:48 +0200 Subject: [PATCH] feat: update Signed-off-by: kjuulh --- Cargo.toml | 3 +-- {src/cmd => crates}/scel/.gitignore | 0 {src/cmd => crates}/scel/Cargo.toml | 4 ++-- {src/cmd => crates}/scel/src/main.rs | 0 {src/lib => crates}/scel_api/Cargo.toml | 0 {src/lib => crates}/scel_api/src/auth/mod.rs | 0 {src/lib => crates}/scel_api/src/graphql/mod.rs | 0 {src/lib => crates}/scel_api/src/graphql/mutation.rs | 0 {src/lib => crates}/scel_api/src/graphql/query.rs | 0 {src/lib => crates}/scel_api/src/graphql/schema.rs | 0 {src/lib => crates}/scel_api/src/graphql/subscription.rs | 0 {src/lib => crates}/scel_api/src/lib.rs | 9 ++------- {src/lib => crates}/scel_core/.gitignore | 0 {src/lib => crates}/scel_core/Cargo.toml | 0 {src/lib => crates}/scel_core/src/lib.rs | 0 {src/lib => crates}/scel_core/src/repo/users_repo.rs | 0 {src/lib => crates}/scel_core/src/services/mod.rs | 0 {src/lib => crates}/scel_core/src/youtube/mod.rs | 0 {src/web => web}/.dockerignore | 0 {src/web => web}/.gitignore | 0 {src/web => web}/index.html | 0 {src/web => web}/package.json | 0 {src/web => web}/public/vite.svg | 0 {src/web => web}/src/App.tsx | 0 {src/web => web}/src/assets/react.svg | 0 {src/web => web}/src/components/body/Body.tsx | 0 {src/web => web}/src/components/navbar/Navbar.tsx | 0 .../src/components/request-download/RequestDownload.tsx | 0 {src/web => web}/src/lib/env.ts | 0 {src/web => web}/src/main.tsx | 0 {src/web => web}/src/vite-env.d.ts | 0 {src/web => web}/tsconfig.json | 0 {src/web => web}/tsconfig.node.json | 0 {src/web => web}/vite.config.ts | 0 {src/web => web}/yarn.lock | 0 35 files changed, 5 insertions(+), 11 deletions(-) rename {src/cmd => crates}/scel/.gitignore (100%) rename {src/cmd => crates}/scel/Cargo.toml (80%) rename {src/cmd => crates}/scel/src/main.rs (100%) rename {src/lib => crates}/scel_api/Cargo.toml (100%) rename {src/lib => crates}/scel_api/src/auth/mod.rs (100%) rename {src/lib => crates}/scel_api/src/graphql/mod.rs (100%) rename {src/lib => crates}/scel_api/src/graphql/mutation.rs (100%) rename {src/lib => crates}/scel_api/src/graphql/query.rs (100%) rename {src/lib => crates}/scel_api/src/graphql/schema.rs (100%) rename {src/lib => crates}/scel_api/src/graphql/subscription.rs (100%) rename {src/lib => crates}/scel_api/src/lib.rs (95%) rename {src/lib => crates}/scel_core/.gitignore (100%) rename {src/lib => crates}/scel_core/Cargo.toml (100%) rename {src/lib => crates}/scel_core/src/lib.rs (100%) rename {src/lib => crates}/scel_core/src/repo/users_repo.rs (100%) rename {src/lib => crates}/scel_core/src/services/mod.rs (100%) rename {src/lib => crates}/scel_core/src/youtube/mod.rs (100%) rename {src/web => web}/.dockerignore (100%) rename {src/web => web}/.gitignore (100%) rename {src/web => web}/index.html (100%) rename {src/web => web}/package.json (100%) rename {src/web => web}/public/vite.svg (100%) rename {src/web => web}/src/App.tsx (100%) rename {src/web => web}/src/assets/react.svg (100%) rename {src/web => web}/src/components/body/Body.tsx (100%) rename {src/web => web}/src/components/navbar/Navbar.tsx (100%) rename {src/web => web}/src/components/request-download/RequestDownload.tsx (100%) rename {src/web => web}/src/lib/env.ts (100%) rename {src/web => web}/src/main.tsx (100%) rename {src/web => web}/src/vite-env.d.ts (100%) rename {src/web => web}/tsconfig.json (100%) rename {src/web => web}/tsconfig.node.json (100%) rename {src/web => web}/vite.config.ts (100%) rename {src/web => web}/yarn.lock (100%) diff --git a/Cargo.toml b/Cargo.toml index d714236..c66a4d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,2 @@ [workspace] - -members = ["src/cmd/scel", "src/lib/scel_core", "src/lib/scel_api"] +members = ["crates/*"] diff --git a/src/cmd/scel/.gitignore b/crates/scel/.gitignore similarity index 100% rename from src/cmd/scel/.gitignore rename to crates/scel/.gitignore diff --git a/src/cmd/scel/Cargo.toml b/crates/scel/Cargo.toml similarity index 80% rename from src/cmd/scel/Cargo.toml rename to crates/scel/Cargo.toml index 38dde30..1e5a7df 100644 --- a/src/cmd/scel/Cargo.toml +++ b/crates/scel/Cargo.toml @@ -12,5 +12,5 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } anyhow = { version = "1.0.66" } dotenv = { version = "*" } -scel_api = { path = "../../lib/scel_api" } -scel_core = { path = "../../lib/scel_core" } +scel_api = { path = "../scel_api" } +scel_core = { path = "../scel_core" } diff --git a/src/cmd/scel/src/main.rs b/crates/scel/src/main.rs similarity index 100% rename from src/cmd/scel/src/main.rs rename to crates/scel/src/main.rs diff --git a/src/lib/scel_api/Cargo.toml b/crates/scel_api/Cargo.toml similarity index 100% rename from src/lib/scel_api/Cargo.toml rename to crates/scel_api/Cargo.toml diff --git a/src/lib/scel_api/src/auth/mod.rs b/crates/scel_api/src/auth/mod.rs similarity index 100% rename from src/lib/scel_api/src/auth/mod.rs rename to crates/scel_api/src/auth/mod.rs diff --git a/src/lib/scel_api/src/graphql/mod.rs b/crates/scel_api/src/graphql/mod.rs similarity index 100% rename from src/lib/scel_api/src/graphql/mod.rs rename to crates/scel_api/src/graphql/mod.rs diff --git a/src/lib/scel_api/src/graphql/mutation.rs b/crates/scel_api/src/graphql/mutation.rs similarity index 100% rename from src/lib/scel_api/src/graphql/mutation.rs rename to crates/scel_api/src/graphql/mutation.rs diff --git a/src/lib/scel_api/src/graphql/query.rs b/crates/scel_api/src/graphql/query.rs similarity index 100% rename from src/lib/scel_api/src/graphql/query.rs rename to crates/scel_api/src/graphql/query.rs diff --git a/src/lib/scel_api/src/graphql/schema.rs b/crates/scel_api/src/graphql/schema.rs similarity index 100% rename from src/lib/scel_api/src/graphql/schema.rs rename to crates/scel_api/src/graphql/schema.rs diff --git a/src/lib/scel_api/src/graphql/subscription.rs b/crates/scel_api/src/graphql/subscription.rs similarity index 100% rename from src/lib/scel_api/src/graphql/subscription.rs rename to crates/scel_api/src/graphql/subscription.rs diff --git a/src/lib/scel_api/src/lib.rs b/crates/scel_api/src/lib.rs similarity index 95% rename from src/lib/scel_api/src/lib.rs rename to crates/scel_api/src/lib.rs index cd2916f..7f08d14 100644 --- a/src/lib/scel_api/src/lib.rs +++ b/crates/scel_api/src/lib.rs @@ -22,7 +22,7 @@ use axum::{ use graphql::{ mutation::MutationRoot, query::QueryRoot, schema::ScelSchema, subscription::SubscriptionRoot, }; -use hyper::{client::HttpConnector, Body, StatusCode, Uri}; +use reqwest::StatusCode; use scel_core::App; use serde::{Deserialize, Serialize}; use tower_http::{ @@ -49,8 +49,6 @@ pub struct Server { addr: SocketAddr, } -type Client = hyper::client::Client; - impl Server { pub fn new(app: Arc) -> Server { let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot) @@ -83,7 +81,6 @@ impl Server { .fallback(get_service(ServeDir::new("./src/web/dist/")).handle_error(handle_error)) .layer(Extension(schema)) .layer(Extension(MemoryStore::new())) - .layer(Extension(Client::new())) .layer(Extension(auth::oauth_client())) .layer( CorsLayer::new() @@ -93,9 +90,7 @@ impl Server { ) .layer(TraceLayer::new_for_http().make_span_with(DefaultMakeSpan::default())); - let app = Router::new() - .nest("/api", api_router) - .fallback(svc) + let app = Router::new().nest("/api", api_router); let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); diff --git a/src/lib/scel_core/.gitignore b/crates/scel_core/.gitignore similarity index 100% rename from src/lib/scel_core/.gitignore rename to crates/scel_core/.gitignore diff --git a/src/lib/scel_core/Cargo.toml b/crates/scel_core/Cargo.toml similarity index 100% rename from src/lib/scel_core/Cargo.toml rename to crates/scel_core/Cargo.toml diff --git a/src/lib/scel_core/src/lib.rs b/crates/scel_core/src/lib.rs similarity index 100% rename from src/lib/scel_core/src/lib.rs rename to crates/scel_core/src/lib.rs diff --git a/src/lib/scel_core/src/repo/users_repo.rs b/crates/scel_core/src/repo/users_repo.rs similarity index 100% rename from src/lib/scel_core/src/repo/users_repo.rs rename to crates/scel_core/src/repo/users_repo.rs diff --git a/src/lib/scel_core/src/services/mod.rs b/crates/scel_core/src/services/mod.rs similarity index 100% rename from src/lib/scel_core/src/services/mod.rs rename to crates/scel_core/src/services/mod.rs diff --git a/src/lib/scel_core/src/youtube/mod.rs b/crates/scel_core/src/youtube/mod.rs similarity index 100% rename from src/lib/scel_core/src/youtube/mod.rs rename to crates/scel_core/src/youtube/mod.rs diff --git a/src/web/.dockerignore b/web/.dockerignore similarity index 100% rename from src/web/.dockerignore rename to web/.dockerignore diff --git a/src/web/.gitignore b/web/.gitignore similarity index 100% rename from src/web/.gitignore rename to web/.gitignore diff --git a/src/web/index.html b/web/index.html similarity index 100% rename from src/web/index.html rename to web/index.html diff --git a/src/web/package.json b/web/package.json similarity index 100% rename from src/web/package.json rename to web/package.json diff --git a/src/web/public/vite.svg b/web/public/vite.svg similarity index 100% rename from src/web/public/vite.svg rename to web/public/vite.svg diff --git a/src/web/src/App.tsx b/web/src/App.tsx similarity index 100% rename from src/web/src/App.tsx rename to web/src/App.tsx diff --git a/src/web/src/assets/react.svg b/web/src/assets/react.svg similarity index 100% rename from src/web/src/assets/react.svg rename to web/src/assets/react.svg diff --git a/src/web/src/components/body/Body.tsx b/web/src/components/body/Body.tsx similarity index 100% rename from src/web/src/components/body/Body.tsx rename to web/src/components/body/Body.tsx diff --git a/src/web/src/components/navbar/Navbar.tsx b/web/src/components/navbar/Navbar.tsx similarity index 100% rename from src/web/src/components/navbar/Navbar.tsx rename to web/src/components/navbar/Navbar.tsx diff --git a/src/web/src/components/request-download/RequestDownload.tsx b/web/src/components/request-download/RequestDownload.tsx similarity index 100% rename from src/web/src/components/request-download/RequestDownload.tsx rename to web/src/components/request-download/RequestDownload.tsx diff --git a/src/web/src/lib/env.ts b/web/src/lib/env.ts similarity index 100% rename from src/web/src/lib/env.ts rename to web/src/lib/env.ts diff --git a/src/web/src/main.tsx b/web/src/main.tsx similarity index 100% rename from src/web/src/main.tsx rename to web/src/main.tsx diff --git a/src/web/src/vite-env.d.ts b/web/src/vite-env.d.ts similarity index 100% rename from src/web/src/vite-env.d.ts rename to web/src/vite-env.d.ts diff --git a/src/web/tsconfig.json b/web/tsconfig.json similarity index 100% rename from src/web/tsconfig.json rename to web/tsconfig.json diff --git a/src/web/tsconfig.node.json b/web/tsconfig.node.json similarity index 100% rename from src/web/tsconfig.node.json rename to web/tsconfig.node.json diff --git a/src/web/vite.config.ts b/web/vite.config.ts similarity index 100% rename from src/web/vite.config.ts rename to web/vite.config.ts diff --git a/src/web/yarn.lock b/web/yarn.lock similarity index 100% rename from src/web/yarn.lock rename to web/yarn.lock