??idkfrontend things?
This commit is contained in:
@@ -659,7 +659,7 @@ function initSync(module) {
|
|||||||
|
|
||||||
async function init(input) {
|
async function init(input) {
|
||||||
if (typeof input === 'undefined') {
|
if (typeof input === 'undefined') {
|
||||||
input = new URL('db-frontend-78ce040a256470ee_bg.wasm', import.meta.url);
|
input = new URL('db-frontend-5a949c39a51fa2c9_bg.wasm', import.meta.url);
|
||||||
}
|
}
|
||||||
const imports = getImports();
|
const imports = getImports();
|
||||||
|
|
||||||
Binary file not shown.
6
frontend/dist/index.html
vendored
6
frontend/dist/index.html
vendored
@@ -2,10 +2,10 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Ze greatest</title>
|
<title>Ze greatest</title>
|
||||||
|
|
||||||
<link rel="preload" href="/db-frontend-78ce040a256470ee_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
|
<link rel="preload" href="/db-frontend-5a949c39a51fa2c9_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
|
||||||
<link rel="modulepreload" href="/db-frontend-78ce040a256470ee.js"></head>
|
<link rel="modulepreload" href="/db-frontend-5a949c39a51fa2c9.js"></head>
|
||||||
<body>
|
<body>
|
||||||
<script type="module">import init from '/db-frontend-78ce040a256470ee.js';init('/db-frontend-78ce040a256470ee_bg.wasm');</script><script>(function () {
|
<script type="module">import init from '/db-frontend-5a949c39a51fa2c9.js';init('/db-frontend-5a949c39a51fa2c9_bg.wasm');</script><script>(function () {
|
||||||
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
var url = protocol + '//' + window.location.host + '/_trunk/ws';
|
var url = protocol + '//' + window.location.host + '/_trunk/ws';
|
||||||
var poll_interval = 5000;
|
var poll_interval = 5000;
|
||||||
|
|||||||
33
src/api.rs
Normal file
33
src/api.rs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
use actix_web::{
|
||||||
|
get,
|
||||||
|
web::{self, Json},
|
||||||
|
HttpResponse, Responder,
|
||||||
|
};
|
||||||
|
use backend::{
|
||||||
|
admin_data::get_admin, driver_data::get_driver, establish_connection, ticket_data::get_ticket,
|
||||||
|
};
|
||||||
|
use common::{CommonAdmin, CommonDriver, CommonTicket};
|
||||||
|
|
||||||
|
//Ticket Table Services
|
||||||
|
#[get("api/ticket/{id}")]
|
||||||
|
async fn api_ticket(id: web::Path<i32>) -> Json<CommonTicket> {
|
||||||
|
let fetched_ticket_data = get_ticket(&mut establish_connection(), *id);
|
||||||
|
Json(fetched_ticket_data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getting admin data or smth idk
|
||||||
|
#[get("api/admin/{id}")]
|
||||||
|
async fn api_admin(id: web::Path<i32>) -> Json<CommonAdmin> {
|
||||||
|
let fetched_admin_data = get_admin(&mut establish_connection(), *id);
|
||||||
|
Json(fetched_admin_data)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("api/driver/{id}")]
|
||||||
|
async fn api_driver(id: web::Path<i32>) -> Json<CommonDriver> {
|
||||||
|
let fetched_driver_data = get_driver(&mut establish_connection(), *id);
|
||||||
|
Json(fetched_driver_data)
|
||||||
|
}
|
||||||
|
#[get("api/test")]
|
||||||
|
async fn api_test() -> impl Responder {
|
||||||
|
HttpResponse::Ok().body("My balls are on fire :(")
|
||||||
|
}
|
||||||
48
src/main.rs
48
src/main.rs
@@ -1,47 +1,9 @@
|
|||||||
use actix_web::{
|
pub mod api;
|
||||||
get,
|
use crate::api::*;
|
||||||
web::{self, Json},
|
pub(crate) use actix_web::{App, HttpServer};
|
||||||
App, HttpResponse, HttpServer, Responder,
|
|
||||||
};
|
|
||||||
use backend::{
|
|
||||||
admin_data::get_admin, driver_data::get_driver, establish_connection, ticket_data::get_ticket,
|
|
||||||
};
|
|
||||||
use common::{CommonAdmin, CommonDriver, CommonTicket};
|
|
||||||
|
|
||||||
// //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 api_ticket(id: web::Path<i32>) -> Json<CommonTicket> {
|
|
||||||
let fetched_ticket_data = get_ticket(&mut establish_connection(), *id);
|
|
||||||
Json(fetched_ticket_data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getting admin data or smth idk
|
|
||||||
#[get("api/admin/{id}")]
|
|
||||||
async fn api_admin(id: web::Path<i32>) -> Json<CommonAdmin> {
|
|
||||||
let fetched_admin_data = get_admin(&mut establish_connection(), *id);
|
|
||||||
Json(fetched_admin_data)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("api/driver/{id}")]
|
|
||||||
async fn api_driver(id: web::Path<i32>) -> Json<CommonDriver> {
|
|
||||||
let fetched_driver_data = get_driver(&mut establish_connection(), *id);
|
|
||||||
Json(fetched_driver_data)
|
|
||||||
}
|
|
||||||
#[get("api/test")]
|
|
||||||
async fn api_test() -> impl Responder {
|
|
||||||
HttpResponse::Ok().body("My balls are on fire :(")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//Main function where all the api calls are
|
||||||
|
//attached as services to backend
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
|
|||||||
Reference in New Issue
Block a user