diff options
author | Cara Salter <cara@devcara.com> | 2022-05-27 23:35:22 -0400 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2022-05-27 23:35:22 -0400 |
commit | ccdcc1891b01b43069991cf58a588145b7559090 (patch) | |
tree | 347040d20aff34f3482b50aca26e6b9a1fb438fa /src/handlers | |
parent | 372b484e8a6366346d52ff44bbdaa6aad1cc2daa (diff) | |
download | homeworld-ccdcc1891b01b43069991cf58a588145b7559090.tar.gz homeworld-ccdcc1891b01b43069991cf58a588145b7559090.zip |
meta: API Scaffold
Initial implementation of a CRUD API for Ships. Should probably at some
point support getting specific Ships based on something like shasum or
an ID, so that solard can more easily pull it down
Diffstat (limited to 'src/handlers')
-rw-r--r-- | src/handlers/mod.rs | 1 | ||||
-rw-r--r-- | src/handlers/ships.rs | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs new file mode 100644 index 0000000..2b5bfaf --- /dev/null +++ b/src/handlers/mod.rs @@ -0,0 +1 @@ +pub mod ships; diff --git a/src/handlers/ships.rs b/src/handlers/ships.rs new file mode 100644 index 0000000..5e8c000 --- /dev/null +++ b/src/handlers/ships.rs @@ -0,0 +1,23 @@ +use axum::{Json, extract::Path}; +use solarlib::ship::{Ship, Sha256}; + +use crate::errors::{JsonResult, StringResult}; + + +pub async fn list() -> JsonResult<Json<Vec<Ship>>> { + let mut result: Vec<Ship> = Vec::new(); + + Ok(Json(result)) +} + +pub async fn new(Json(new_ship): Json<Ship>) -> StringResult { + unimplemented!(); +} + +pub async fn update(Json(new_ship): Json<Ship>) -> StringResult { + todo!(); +} + +pub async fn delete(Path(shasum): Path<Sha256>) -> StringResult { + todo!(); +} |