YES?
This commit is contained in:
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -1,6 +0,0 @@
|
||||
[submodule "backend"]
|
||||
path = backend
|
||||
url = https://github.com/LinlyBoi/FCDS-DB.rs
|
||||
[submodule "frontend"]
|
||||
path = frontend
|
||||
url = git@github.com:LinlyBoi/Deans-FrontQuest.git
|
||||
34
Cargo.lock
generated
34
Cargo.lock
generated
@@ -242,7 +242,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"common",
|
||||
"diesel",
|
||||
"dotenvy",
|
||||
"dotenv",
|
||||
"tokio",
|
||||
"yew",
|
||||
]
|
||||
@@ -430,6 +430,11 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "deans-full-quest"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"backend",
|
||||
"common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
@@ -455,6 +460,7 @@ dependencies = [
|
||||
"diesel_derives",
|
||||
"itoa",
|
||||
"pq-sys",
|
||||
"r2d2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -480,10 +486,10 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenvy"
|
||||
version = "0.15.6"
|
||||
name = "dotenv"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03d8c417d7a8cb362e0c37e5d815f5eb7c37f79ff93707329d5a194e42e54ca0"
|
||||
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
@@ -1193,6 +1199,17 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r2d2"
|
||||
version = "0.8.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93"
|
||||
dependencies = [
|
||||
"log",
|
||||
"parking_lot",
|
||||
"scheduled-thread-pool",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
@@ -1270,6 +1287,15 @@ version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
|
||||
|
||||
[[package]]
|
||||
name = "scheduled-thread-pool"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf"
|
||||
dependencies = [
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
|
||||
@@ -6,6 +6,9 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
common = { path = "./common"}
|
||||
backend = {path = "./backend"}
|
||||
actix-web = "4.0.0-rc.1"
|
||||
|
||||
[workspace]
|
||||
members = ["frontend","backend","common"]
|
||||
|
||||
@@ -7,3 +7,11 @@ pub struct CommonTicket {
|
||||
pub category: String,
|
||||
pub description: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CommonAdmin {
|
||||
pub id: i32,
|
||||
pub name: String,
|
||||
pub address: String,
|
||||
}
|
||||
|
||||
30
src/main.rs
30
src/main.rs
@@ -1,29 +1,31 @@
|
||||
use actix_web::{
|
||||
get,
|
||||
web::{self, Json},
|
||||
App, HttpResponse, HttpServer, Responder,
|
||||
App, HttpServer,
|
||||
};
|
||||
use backend::admin_data::listadmins;
|
||||
use backend::establish_connection;
|
||||
use backend::ticket_data::get_ticket;
|
||||
use backend::{establish_connection, ticket_data::get_ticket};
|
||||
use common::CommonTicket;
|
||||
|
||||
#[get("/ggsya")]
|
||||
async fn ggsya() -> impl Responder {
|
||||
HttpResponse::Ok().body("Ggsya is here")
|
||||
}
|
||||
#[get("/admins")]
|
||||
async fn admins() -> impl Responder {
|
||||
HttpResponse::Ok().body(listadmins(&mut establish_connection()))
|
||||
}
|
||||
#[get("/ticket/{id}")]
|
||||
// //Admin Services
|
||||
// #[get("/api/admin/{id}")]
|
||||
// async fn admin(id: web::Path<i32>) -> Json<CommonAdmin> {
|
||||
// Json(get_admin(&mut establish_connection(), *id))
|
||||
// }
|
||||
// #[get("/api/admins{amount}")]
|
||||
// async fn admins(amount: web::Path<i64>) -> Json<Vec<CommonAdmin>> {
|
||||
// Json(get_admins(&mut establish_connection(), *amount))
|
||||
// }
|
||||
|
||||
//Ticket Table Services
|
||||
#[get("api/ticket/{id}")]
|
||||
async fn ticket(id: web::Path<i32>) -> Json<CommonTicket> {
|
||||
let fetched_ticket = get_ticket(&mut establish_connection(), *id);
|
||||
Json(fetched_ticket)
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| App::new().service(ggsya).service(admins).service(ticket))
|
||||
HttpServer::new(|| App::new().service(ticket))
|
||||
.bind(("127.0.0.1", 8081))?
|
||||
.run()
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user