fix: v2 alert APIs (#5563)

Try to match on the v2 alert endpoints in the router **before** the v1
endpoints.

If we try to match on the v1 endpoints first then a call to a v2
endpoint such as
`GET: /api/v2/my-org/alerts`
will actually match with the v1 endpoint
`GET: /api/{org_id}/alerts`
where `v2` will be bound to `{org_id}`.

If we swap the matching order then requests to v2 endpoints will be
correctly routed to v2 endpoints and requests to v1 endpoints will be
correctly routed to v1 endpoints.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
	- Reorganized alert-related service routes in the application
- Removed and re-added existing alert service routes without changing
their core functionality

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Patrick Sullivan
2025-01-02 22:43:33 -06:00
committed by GitHub
parent 73360c2ed3
commit 9524c0ca7a
+7 -7
View File
@@ -433,6 +433,13 @@ pub fn get_service_routes(cfg: &mut web::ServiceConfig) {
.service(folders::deprecated::update_folder)
.service(folders::deprecated::get_folder)
.service(folders::deprecated::delete_folder)
.service(alerts::create_alert)
.service(alerts::get_alert)
.service(alerts::update_alert)
.service(alerts::delete_alert)
.service(alerts::list_alerts)
.service(alerts::enable_alert)
.service(alerts::trigger_alert)
.service(alerts::deprecated::save_alert)
.service(alerts::deprecated::update_alert)
.service(alerts::deprecated::get_alert)
@@ -441,13 +448,6 @@ pub fn get_service_routes(cfg: &mut web::ServiceConfig) {
.service(alerts::deprecated::delete_alert)
.service(alerts::deprecated::enable_alert)
.service(alerts::deprecated::trigger_alert)
.service(alerts::create_alert)
.service(alerts::get_alert)
.service(alerts::update_alert)
.service(alerts::delete_alert)
.service(alerts::list_alerts)
.service(alerts::enable_alert)
.service(alerts::trigger_alert)
.service(alerts::templates::save_template)
.service(alerts::templates::update_template)
.service(alerts::templates::get_template)