From 0972fa6eab8c9111311f082ba8abfdc6b4a40945 Mon Sep 17 00:00:00 2001 From: nil Date: Wed, 2 Oct 2024 17:48:56 +0200 Subject: commit changes --- rust/.gitignore | 5 --- rust/.ignore | 1 - rust/Cargo.toml | 17 -------- rust/N | 2 - rust/env_example | 1 - rust/scripts/create_db.sh | 11 ----- rust/scripts/create_db.sql | 41 ------------------ rust/scripts/create_user.sql | 3 -- rust/scripts/populate.sh | 13 ------ rust/scripts/populate/.gitignore | 3 -- rust/scripts/populate/albums.py | 38 ----------------- rust/scripts/populate/api.py | 21 ---------- rust/scripts/populate/create_db.sql | 39 ----------------- rust/scripts/populate/database.py | 83 ------------------------------------- rust/scripts/populate/main.py | 46 -------------------- rust/scripts/populate/parser.py | 83 ------------------------------------- rust/scripts/populate/structures.py | 13 ------ rust/src/main.rs | 35 ---------------- rust/src/routes.rs | 1 - rust/src/routes/hello.rs | 11 ----- rust/src/structs.rs | 35 ---------------- 21 files changed, 502 deletions(-) delete mode 100644 rust/.gitignore delete mode 100644 rust/.ignore delete mode 100644 rust/Cargo.toml delete mode 100644 rust/N delete mode 100644 rust/env_example delete mode 100644 rust/scripts/create_db.sh delete mode 100644 rust/scripts/create_db.sql delete mode 100644 rust/scripts/create_user.sql delete mode 100644 rust/scripts/populate.sh delete mode 100644 rust/scripts/populate/.gitignore delete mode 100644 rust/scripts/populate/albums.py delete mode 100644 rust/scripts/populate/api.py delete mode 100644 rust/scripts/populate/create_db.sql delete mode 100644 rust/scripts/populate/database.py delete mode 100644 rust/scripts/populate/main.py delete mode 100644 rust/scripts/populate/parser.py delete mode 100644 rust/scripts/populate/structures.py delete mode 100644 rust/src/main.rs delete mode 100644 rust/src/routes.rs delete mode 100644 rust/src/routes/hello.rs delete mode 100644 rust/src/structs.rs (limited to 'rust') diff --git a/rust/.gitignore b/rust/.gitignore deleted file mode 100644 index 9adab75..0000000 --- a/rust/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -lock/ -target/ -Cargo.lock -**/*.rs.bk -.env diff --git a/rust/.ignore b/rust/.ignore deleted file mode 100644 index 0b68341..0000000 --- a/rust/.ignore +++ /dev/null @@ -1 +0,0 @@ -# scripts/populate/ diff --git a/rust/Cargo.toml b/rust/Cargo.toml deleted file mode 100644 index b4a8000..0000000 --- a/rust/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "ver1" -version = "0.1.0" -edition = "2021" - -[dependencies] -actix-web = { version = "4.9.0"} -sqlx = { version = "0.8.2", features = ["mysql", "macros", "runtime-tokio"] } -serde = { version = "1.0.210", features = ["derive"] } -tokio = "1.40.0" - -[package.metadata.scripts] -db_create = "bash ./scripts/create_db.sh" -db_populate = "bash ./scripts/populate.sh" -# db_start = "sudo docker start sqlx" -# db_start = "sudo docker stop sqlx" -# db_remove = "sudo docker rm sqlx" diff --git a/rust/N b/rust/N deleted file mode 100644 index a755b9a..0000000 --- a/rust/N +++ /dev/null @@ -1,2 +0,0 @@ -cargo install cargo-run-script -cargo-run-script db-create diff --git a/rust/env_example b/rust/env_example deleted file mode 100644 index 607b7cc..0000000 --- a/rust/env_example +++ /dev/null @@ -1 +0,0 @@ -DATABASE_URL="mysql://balalaika_user:password@127.0.0.1:3306/balalaika" diff --git a/rust/scripts/create_db.sh b/rust/scripts/create_db.sh deleted file mode 100644 index 4e6ebc1..0000000 --- a/rust/scripts/create_db.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -echo "choose a password for the database:" -read input -echo "creating database..." -sudo mariadb -u root < std::io::Result<()> { - let pool: MySqlPool = MySqlPoolOptions::new() - .max_connections(10) - .connect(DB_URL) - .await - .unwrap(); - - let app_state = AppState { pool }; - - HttpServer::new(move || { - App::new() - .app_data(web::Data::new(app_state.clone())) - .route("/", web::get().to(root)) - .service(routes::hello::hello_actix) - }) - .bind(("127.0.0.1", 8000))? - .run() - .await -} - -async fn root() -> String { - String::from("Server is up and running") -} diff --git a/rust/src/routes.rs b/rust/src/routes.rs deleted file mode 100644 index 8cb6ff0..0000000 --- a/rust/src/routes.rs +++ /dev/null @@ -1 +0,0 @@ -mod hello; diff --git a/rust/src/routes/hello.rs b/rust/src/routes/hello.rs deleted file mode 100644 index c356081..0000000 --- a/rust/src/routes/hello.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::AppState; -use actix_web::{get, web, HttpResponse}; -use serde::Deserialize; - -#[get("/hello")] -pub async fn hello_actix(app_state: web::Data) -> HttpResponse { - struct Song { - } - - return HttpResponse::Ok().json(databases); -} diff --git a/rust/src/structs.rs b/rust/src/structs.rs deleted file mode 100644 index 7535bb4..0000000 --- a/rust/src/structs.rs +++ /dev/null @@ -1,35 +0,0 @@ -#[allow(dead_code)] -struct Song { - //song variables - id: i32, - title: String, - lyrics: String, - - //album variables - album_id: i32, - genres: Vec, - album_cover: String, - - //artist variables - artist_id: i32, - artist_name: String, -} - -#[allow(dead_code)] -struct Album { - id: i32, - title: String, - genres: Vec, - cover: String, - songs: Vec, -} - -#[allow(dead_code)] -struct Artist { - id: i32, - name: String, - genres: Vec, - albums: Vec, -} - -// lepht anonym -- cgit v1.2.3