SUB MODULES

This commit is contained in:
LinlyBoi
2022-12-22 14:22:12 +02:00
commit b67c3c073d
9 changed files with 1911 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target

6
.gitmodules vendored Normal file
View 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

File diff suppressed because it is too large Load Diff

11
Cargo.toml Normal file
View 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

Submodule backend added at 3eb1f29485

10
common/Cargo.toml Normal file
View 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
View 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

Submodule frontend added at 23ff6c8645

30
src/main.rs Normal file
View 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
}