diff --git a/web/src/controller/organization_controller.rs b/web/src/controller/organization_controller.rs index 18b68fe..684caae 100644 --- a/web/src/controller/organization_controller.rs +++ b/web/src/controller/organization_controller.rs @@ -17,6 +17,9 @@ pub struct OrganizationController {} impl OrganizationController { /// GET all Organizations + /// Test this with curl: curl --header "Content-Type: application/json" \ in zsh at 12:03:06 + /// --request GET \ + /// http://localhost:3000/organizations pub async fn index(State(app_state): State) -> impl IntoResponse { let organizations = organization::Entity::find() .all(&app_state.database_connection.unwrap()) @@ -27,6 +30,10 @@ impl OrganizationController { } /// CREATE a new Organization entity + /// Test this with curl: curl --header "Content-Type: application/json" \ + /// --request POST \ + /// --data '{"name":"My New Organization"}' \ + /// http://localhost:3000/organizations pub async fn create(State(app_state): State, Json(organization_json): Json) -> impl IntoResponse { debug!("CREATE new Organization: {}", organization_json.name); @@ -43,6 +50,9 @@ impl OrganizationController { } /// DELETE an Organization entity specified by its primary key + /// Test this with curl: curl --header "Content-Type: application/json" \ in zsh at 12:03:06 + /// --request DELETE \ + /// http://localhost:3000/organizations/ pub async fn delete(State(app_state): State, Path(id): Path) -> impl IntoResponse { debug!("DELETE Organization by id: {}", id);