Skip to content

Commit

Permalink
feat: info api route
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Jul 25, 2024
1 parent 34ea1de commit b2c25e9
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "koji",
"version": "1.3.13",
"version": "1.3.14",
"description": "Tool to make RDM routes",
"main": "server/dist/index.js",
"author": "TurtIeSocks <[email protected]>",
Expand Down
6 changes: 3 additions & 3 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/algorithms/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "algorithms"
version = "1.2.2"
version = "1.3.0"
edition = "2021"
publish = false

Expand Down
7 changes: 7 additions & 0 deletions server/algorithms/src/bootstrap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,10 @@ pub fn main(
pub fn bootstrap_plugins() -> Vec<String> {
utils::get_plugin_list("algorithms/src/bootstrap/plugins").unwrap_or(vec![])
}

pub fn all_bootstrap_options() -> Vec<String> {
let mut options = bootstrap_plugins();
options.push("radius".to_string());
options.push("s2".to_string());
options
}
11 changes: 11 additions & 0 deletions server/algorithms/src/clustering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,14 @@ pub fn main(
pub fn clustering_plugins() -> Vec<String> {
utils::get_plugin_list("algorithms/src/clustering/plugins").unwrap_or(vec![])
}

pub fn all_clustering_options() -> Vec<String> {
let mut options = clustering_plugins();
options.push("honeycomb".to_string());
options.push("fastest".to_string());
options.push("balanced".to_string());
options.push("fast".to_string());
options.push("better".to_string());
options.push("best".to_string());
options
}
10 changes: 10 additions & 0 deletions server/algorithms/src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,13 @@ pub fn main(
pub fn routing_plugins() -> Vec<String> {
utils::get_plugin_list("algorithms/src/routing/plugins").unwrap_or(vec![])
}

pub fn all_routing_options() -> Vec<String> {
let mut options = routing_plugins();
options.push("point_count".to_string());
options.push("latlon".to_string());
options.push("geohash".to_string());
options.push("s2".to_string());
options.push("random".to_string());
options
}
2 changes: 1 addition & 1 deletion server/api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "api"
version = "1.4.1"
version = "1.5.0"
edition = "2021"
publish = false

Expand Down
7 changes: 5 additions & 2 deletions server/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ pub async fn start() -> io::Result<()> {
web::scope("/api").service(
web::scope("/v1")
.wrap(HttpAuthentication::with_fn(auth::public_validator))
.service(web::resource("/health").route(web::get().to(|| HttpResponse::Ok())))
.service(
web::resource("/health").route(web::get().to(|| HttpResponse::Ok())),
)
.service(
web::scope("/calc")
.service(public::v1::calculate::bootstrap)
Expand Down Expand Up @@ -163,7 +165,8 @@ pub async fn start() -> io::Result<()> {
.service(public::v1::s2::cell_coverage)
.service(public::v1::s2::cell_polygons)
.service(public::v1::s2::s2_cells),
),
)
.service(web::scope("/info").service(public::v1::info::main)),
),
)
.service(
Expand Down
13 changes: 13 additions & 0 deletions server/api/src/public/v1/info.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use super::*;

use algorithms::{bootstrap, clustering, routing};
use serde_json::json;

#[get("/")]
async fn main() -> Result<HttpResponse, Error> {
Ok(HttpResponse::Ok().json(json!({
"routing": routing::all_routing_options(),
"clustering": clustering::all_clustering_options(),
"bootstrap": bootstrap::all_bootstrap_options(),
})))
}
1 change: 1 addition & 0 deletions server/api/src/public/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use super::*;
pub mod calculate;
pub mod convert;
pub mod geofence;
pub mod info;
pub mod project;
pub mod route;
pub mod s2;
2 changes: 1 addition & 1 deletion server/model/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "model"
version = "1.4.1"
version = "1.5.0"
edition = "2021"
publish = false

Expand Down

0 comments on commit b2c25e9

Please sign in to comment.