This commit is contained in:
Joshua Perry 2024-06-06 19:21:12 +01:00
parent b3d8d408d2
commit e620db1385
8 changed files with 51 additions and 48 deletions

35
src/account.rs Normal file
View File

@ -0,0 +1,35 @@
use axum::{
Router,
routing::{get, post}
};
pub fn router() -> Router {
Router::new()
.nest("/:user_id", user_router())
.route("/",
post(post_sign_up)
)
}
fn user_router() -> Router {
Router::new()
.route("/sign-in",
get(get_sign_in)
.post(post_sign_in)
)
.route("/backup",
post(post_backup)
)
.route("/restore",
get(get_restore)
)
}
pub async fn get_sign_in() {}
pub async fn post_sign_in() {}
pub async fn post_sign_up() {}
pub async fn post_backup() {}
pub async fn get_restore() {}

View File

@ -1,32 +0,0 @@
use axum::{
Router,
routing::{get, post}
};
mod account;
mod model;
pub fn api_router() -> Router {
Router::new()
.nest("/account/:user_id", account_router())
.route("/account",
post(account::post_sign_up)
)
.route("/predict",
get(model::get_predict)
)
}
fn account_router() -> Router {
Router::new()
.route("/sign-in",
get(account::get_sign_in)
.post(account::post_sign_in)
)
.route("/backup",
post(account::post_backup)
)
.route("/restore",
get(account::get_restore)
)
}

View File

@ -1,8 +0,0 @@
pub async fn get_sign_in() {}
pub async fn post_sign_in() {}
pub async fn post_sign_up() {}
pub async fn post_backup() {}
pub async fn get_restore() {}

View File

@ -1 +0,0 @@
pub async fn get_predict() {}

View File

@ -1,3 +0,0 @@
//TODO: New User Auth loop
//TODO: Existing User Auth loop
//TODO: Hash Function

View File

@ -1 +0,0 @@
//TODO: Logic for backing up an account

View File

@ -1,4 +1,9 @@
pub mod api;
mod auth;
mod backup;
mod account;
mod db;
mod model;
pub fn router() -> axum::Router {
axum::Router::new()
.nest("/account", account::router())
.nest("/predict", model::router())
}

8
src/model.rs Normal file
View File

@ -0,0 +1,8 @@
pub fn router() -> axum::Router {
axum::Router::new()
.route("/",
axum::routing::post(get_predict)
)
}
async fn get_predict() {}