summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs131
1 files changed, 68 insertions, 63 deletions
diff --git a/src/main.rs b/src/main.rs
index 924dd81..2e4dc75 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -492,7 +492,7 @@ mod notifications_api {
}
#[utoipa::path(
get,
- path = "/api/ntfy-settings/me",
+ path = "/api/v1/settings/ntfy/me",
responses(
(status = 200, description = "Get NTFY settings for current user", body = NtfySettings),
(status = 404, description = "NTFY settings not found"),
@@ -514,7 +514,7 @@ mod notifications_api {
#[utoipa::path(
post,
- path = "/api/ntfy-settings",
+ path = "/api/v1/settings/ntfy",
request_body = CreateNtfy,
responses(
(status = 200, description = "Create NTFY settings", body = NtfySettings),
@@ -544,7 +544,7 @@ mod notifications_api {
#[utoipa::path(
put,
- path = "/api/ntfy-settings/{id}",
+ path = "/api/v1/settings/ntfy/{id}",
params(
("id" = i64, Path, description = "NTFY settings ID")
),
@@ -582,7 +582,7 @@ mod notifications_api {
#[utoipa::path(
delete,
- path = "/api/ntfy-settings/{id}",
+ path = "/api/v1/settings/ntfy/{id}",
params(
("id" = i64, Path, description = "NTFY settings ID")
),
@@ -633,7 +633,7 @@ mod notifications_api {
}
#[utoipa::path(
get,
- path = "/api/smtp-settings/me",
+ path = "/api/v1/settings/smtp/me",
responses(
(status = 200, description = "Get SMTP settings for current user", body = SmtpSettings),
(status = 404, description = "SMTP settings not found"),
@@ -655,7 +655,7 @@ mod notifications_api {
#[utoipa::path(
post,
- path = "/api/smtp-settings",
+ path = "/api/v1/settings/smtp",
request_body = CreateSmtp,
responses(
(status = 200, description = "Create SMTP settings", body = SmtpSettings),
@@ -690,7 +690,7 @@ mod notifications_api {
#[utoipa::path(
put,
- path = "/api/smtp-settings/{id}",
+ path = "/api/v1/settings/smtp/{id}",
params(
("id" = i64, Path, description = "SMTP settings ID")
),
@@ -733,7 +733,7 @@ mod notifications_api {
#[utoipa::path(
delete,
- path = "/api/smtp-settings/{id}",
+ path = "/api/v1/settings/smtp/{id}",
params(
("id" = i64, Path, description = "SMTP settings ID")
),
@@ -825,64 +825,69 @@ pub fn app_with_state(pool: std::sync::Arc<SqlitePool>) -> Router {
.route("/health", get(health::health_handler))
.merge(SwaggerUi::new("/swagger-ui").url("/openapi.json", ApiDoc::openapi()))
.nest(
- "/api/users",
+ "/api/v1",
Router::new()
- .route("/", get(users_api::list_users).post(users_api::create_user))
- .route(
- "/{id}",
- get(users_api::get_user)
- .put(users_api::update_user)
- .delete(users_api::delete_user),
- ),
- )
- .nest(
- "/api/locations",
- Router::new()
- .route(
- "/",
- get(locations_api::list_locations).post(locations_api::create_location),
+ .nest(
+ "/users",
+ Router::new()
+ .route("/", get(users_api::list_users).post(users_api::create_user))
+ .route(
+ "/{id}",
+ get(users_api::get_user)
+ .put(users_api::update_user)
+ .delete(users_api::delete_user),
+ ),
)
- .route(
- "/{id}",
- get(locations_api::get_location)
- .put(locations_api::update_location)
- .delete(locations_api::delete_location),
- ),
- )
- .nest(
- "/api/weather-thresholds",
- Router::new()
- .route(
- "/",
- get(thresholds_api::list_thresholds).post(thresholds_api::create_threshold),
+ .nest(
+ "/locations",
+ Router::new()
+ .route(
+ "/",
+ get(locations_api::list_locations).post(locations_api::create_location),
+ )
+ .route(
+ "/{id}",
+ get(locations_api::get_location)
+ .put(locations_api::update_location)
+ .delete(locations_api::delete_location),
+ ),
)
- .route(
- "/{id}",
- get(thresholds_api::get_threshold)
- .put(thresholds_api::update_threshold)
- .delete(thresholds_api::delete_threshold),
- ),
- )
- .nest(
- "/api/ntfy-settings",
- Router::new()
- .route("/me", get(notifications_api::get_ntfy_settings))
- .route("/", post(notifications_api::create_ntfy_settings))
- .route(
- "/{id}",
- put(notifications_api::update_ntfy_settings)
- .delete(notifications_api::delete_ntfy_settings),
- ),
- )
- .nest(
- "/api/smtp-settings",
- Router::new()
- .route("/me", get(notifications_api::get_smtp_settings))
- .route("/", post(notifications_api::create_smtp_settings))
- .route(
- "/{id}",
- put(notifications_api::update_smtp_settings)
- .delete(notifications_api::delete_smtp_settings),
+ .nest(
+ "/weather-thresholds",
+ Router::new()
+ .route(
+ "/",
+ get(thresholds_api::list_thresholds)
+ .post(thresholds_api::create_threshold),
+ )
+ .route(
+ "/{id}",
+ get(thresholds_api::get_threshold)
+ .put(thresholds_api::update_threshold)
+ .delete(thresholds_api::delete_threshold),
+ ),
+ )
+ .nest(
+ "/settings/ntfy",
+ Router::new()
+ .route("/me", get(notifications_api::get_ntfy_settings))
+ .route("/", post(notifications_api::create_ntfy_settings))
+ .route(
+ "/{id}",
+ put(notifications_api::update_ntfy_settings)
+ .delete(notifications_api::delete_ntfy_settings),
+ ),
+ )
+ .nest(
+ "/settings/smtp",
+ Router::new()
+ .route("/me", get(notifications_api::get_smtp_settings))
+ .route("/", post(notifications_api::create_smtp_settings))
+ .route(
+ "/{id}",
+ put(notifications_api::update_smtp_settings)
+ .delete(notifications_api::delete_smtp_settings),
+ ),
),
)
.fallback(not_found)