Add working test

This commit is contained in:
2025-09-09 22:23:01 +02:00
parent 4e38b13faa
commit fa00747e80
27 changed files with 2373 additions and 46 deletions

View File

@@ -8,7 +8,7 @@ use axum::{
routing::{delete, get, post, put},
Router,
};
use routes::{accounts, admin, auth as auth_routes, config, machines, setup};
use routes::{accounts, admin, auth, config, machines, setup, snapshots};
use std::path::Path;
use tokio::signal;
use tower_http::{
@@ -27,8 +27,8 @@ async fn main() -> Result<()> {
let api_routes = Router::new()
.route("/setup/status", get(setup::get_setup_status))
.route("/setup/init", post(setup::init_setup))
.route("/auth/login", post(auth_routes::login))
.route("/auth/logout", post(auth_routes::logout))
.route("/auth/login", post(auth::login))
.route("/auth/logout", post(auth::logout))
.route("/accounts/me", get(accounts::me))
.route("/admin/users", get(admin::get_users))
.route("/admin/users", post(admin::create_user_handler))
@@ -40,7 +40,10 @@ async fn main() -> Result<()> {
.route("/machines/register", post(machines::register_machine))
.route("/machines/provisioning-code", post(machines::create_provisioning_code))
.route("/machines", get(machines::get_machines))
.route("/machines/{id}", get(machines::get_machine))
.route("/machines/{id}", delete(machines::delete_machine))
.route("/machines/{id}/snapshots", get(snapshots::get_machine_snapshots))
.route("/machines/{machine_id}/snapshots/{snapshot_id}", get(snapshots::get_snapshot_details))
.layer(CorsLayer::permissive())
.with_state(pool);