SUB MODULES
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
[submodule "backend"]
|
||||
path = backend
|
||||
url = https://github.com/LinlyBoi/FCDS-DB.rs
|
||||
[submodule "frontend"]
|
||||
path = frontend
|
||||
url = git@github.com:LinlyBoi/Deans-FrontQuest.git
|
||||
1842
Cargo.lock
generated
Normal file
1842
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "deans-full-quest"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
||||
[workspace]
|
||||
members = ["frontend","backend","common"]
|
||||
1
backend
Submodule
1
backend
Submodule
Submodule backend added at 3eb1f29485
10
common/Cargo.toml
Normal file
10
common/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "common"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.81"
|
||||
serde = { version = "1.0.37", features = ["derive"]}
|
||||
9
common/src/lib.rs
Normal file
9
common/src/lib.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CommonTicket {
|
||||
pub id: i32,
|
||||
pub category: String,
|
||||
pub description: String,
|
||||
}
|
||||
1
frontend
Submodule
1
frontend
Submodule
Submodule frontend added at 23ff6c8645
30
src/main.rs
Normal file
30
src/main.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use actix_web::{
|
||||
get,
|
||||
web::{self, Json},
|
||||
App, HttpResponse, HttpServer, Responder,
|
||||
};
|
||||
use backend::admin_data::listadmins;
|
||||
use backend::establish_connection;
|
||||
use backend::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}")]
|
||||
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))
|
||||
.bind(("127.0.0.1", 8081))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
Reference in New Issue
Block a user