Skip to content

Commit

Permalink
ENG-3184: Merge admin routes into private routes
Browse files Browse the repository at this point in the history
  • Loading branch information
sagojez committed Apr 22, 2024
1 parent 3df274b commit 0bac44a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 42 deletions.
3 changes: 1 addition & 2 deletions api/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::sync::Arc;

use chrono::{DateTime, Datelike, Utc};
use http::HeaderValue;
use integrationos_domain::{event_access::EventAccess, ownership::Ownership, Connection};
use segment::message::{Track, User};
use serde::Deserialize;
use serde_json::json;
use std::sync::Arc;

pub const TOTAL_KEY: &str = "total";
pub const DAILY_KEY: &str = "daily";
Expand Down
34 changes: 0 additions & 34 deletions api/src/routes/admin.rs

This file was deleted.

2 changes: 0 additions & 2 deletions api/src/routes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod admin;
pub mod protected;
pub mod public;

Expand All @@ -14,7 +13,6 @@ use tower_http::cors::CorsLayer;
pub fn get_admin_router(state: &Arc<AppState>) -> Router<Arc<AppState>> {
let path = format!("/{}", state.config.api_version);
Router::new()
.nest(&path, admin::get_router())
.nest(&path, public::get_router(state))
.route("/", get(get_root))
.fallback(not_found_handler)
Expand Down
29 changes: 25 additions & 4 deletions api/src/routes/protected.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::{
endpoints::{
connection,
connection_model_definition::test_connection_model_definition,
common_model, connection, connection_definition,
connection_model_definition::{self, test_connection_model_definition},
connection_model_schema::{self, public_get_connection_model_schema},
event_access, events, oauth, passthrough, pipeline, transactions, unified,
connection_oauth_definition, event_access, events, metrics, oauth, openapi, passthrough,
pipeline, transactions, unified,
},
middleware::{
auth,
Expand Down Expand Up @@ -44,7 +45,27 @@ pub async fn get_router(state: &Arc<AppState>) -> Router<Arc<AppState>> {
.nest("/event-access", event_access::get_router())
.nest("/passthrough", passthrough::get_router())
.nest("/oauth", oauth::get_router())
.nest("/unified", unified::get_router());
.nest("/unified", unified::get_router())
.nest(
"/connection-definitions",
connection_definition::get_router(),
)
.nest(
"/connection-oauth-definitions",
connection_oauth_definition::get_router(),
)
.nest(
"/connection-model-definitions",
connection_model_definition::get_router(),
)
.route("/openapi", post(openapi::refresh_openapi))
.nest(
"/connection-model-schemas",
connection_model_schema::get_router(),
)
.nest("/common-models", common_model::get_router())
.layer(TraceLayer::new_for_http())
.nest("/metrics", metrics::get_router());

let config = Box::new(
GovernorConfigBuilder::default()
Expand Down

0 comments on commit 0bac44a

Please sign in to comment.