summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/api/album.rs8
-rw-r--r--src/api/artist.rs8
-rw-r--r--src/api/search_results.rs2
-rw-r--r--src/api/song.rs8
-rw-r--r--src/auth.rs6
-rw-r--r--src/main.rs17
6 files changed, 27 insertions, 22 deletions
diff --git a/src/api/album.rs b/src/api/album.rs
index f8731fb..b618e29 100644
--- a/src/api/album.rs
+++ b/src/api/album.rs
@@ -17,7 +17,7 @@ struct AlbumQueryOptions {
#[utoipa::path(
params(AlbumQueryOptions),
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Gets a list of the current albums and applies filters based on the url parameters recieved. It only accepts one parameter at a time.",
responses(
(status = 200, description = "Return a list of albums", body = Vec<Album>),
@@ -65,7 +65,7 @@ pub async fn get_album(
#[utoipa::path(
request_body = AlbumPost,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Creates a new album with the specified values.",
responses(
(status = 200, description = "Create new album", body = Response),
@@ -93,7 +93,7 @@ pub async fn post_album(
#[utoipa::path(
request_body = AlbumPut,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Edits the values of the specified album.",
responses(
(status = 200, description = "Edit album values", body = Response),
@@ -121,7 +121,7 @@ pub async fn put_album(
#[utoipa::path(
request_body = Delete,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Deletes the specified album.",
responses(
(status = 200, description = "Delete existing album", body = Response),
diff --git a/src/api/artist.rs b/src/api/artist.rs
index 1fdae37..93a8956 100644
--- a/src/api/artist.rs
+++ b/src/api/artist.rs
@@ -16,7 +16,7 @@ pub struct ArtistQueryOptions {
#[utoipa::path(
params(ArtistQueryOptions),
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Gets a list of the current artists and applies filters based on the url parameters recieved. It only accepts one parameter at a time.",
responses(
(status = 200, description = "Return a list of artists", body = Vec<Artist>),
@@ -60,7 +60,7 @@ pub async fn get_artist(
#[utoipa::path(
request_body = ArtistPost,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Creates a new artist with the specified name.",
responses(
(status = 200, description = "Create new artist", body = Response),
@@ -88,7 +88,7 @@ pub async fn post_artist(
#[utoipa::path(
request_body = ArtistPut,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Edits the name of the specified artist.",
responses(
(status = 200, description = "Edit artist name", body = Response),
@@ -116,7 +116,7 @@ pub async fn put_artist(
#[utoipa::path(
request_body = Delete,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Deletes the specified artist.",
responses(
(status = 200, description = "Delete existing artist", body = Response),
diff --git a/src/api/search_results.rs b/src/api/search_results.rs
index cd47054..87b635c 100644
--- a/src/api/search_results.rs
+++ b/src/api/search_results.rs
@@ -13,7 +13,7 @@ struct SearchQueryOptions {
#[utoipa::path(
params(SearchQueryOptions),
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Performs a search based on the 'name' parameter and returns a list.",
responses(
(status = 200, description = "Return a list of artists, albums and songs"),
diff --git a/src/api/song.rs b/src/api/song.rs
index 06bc4b6..a1ba641 100644
--- a/src/api/song.rs
+++ b/src/api/song.rs
@@ -18,7 +18,7 @@ struct SongQueryOptions {
#[utoipa::path(
params(SongQueryOptions),
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Gets a list of the current songs and applies filters based on the url parameters recieved. It only accepts one parameter at a time.",
responses(
(status = 200, description = "Return a list of songs", body = Vec<Song>),
@@ -70,7 +70,7 @@ pub async fn get_song(
#[utoipa::path(
request_body = SongPost,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Creates a new song with the specified values.",
responses(
(status = 200, description = "Create new song", body = Response),
@@ -98,7 +98,7 @@ pub async fn post_song(
#[utoipa::path(
request_body = SongPut,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Edits the values of the specified song.",
responses(
(status = 200, description = "Edit song values", body = Response),
@@ -126,7 +126,7 @@ pub async fn put_song(
#[utoipa::path(
request_body = Delete,
- context_path = "/api",
+ context_path = "/balalaika/api",
description = "Deletes the specified song.",
responses(
(status = 200, description = "Delete existing song", body = Response),
diff --git a/src/auth.rs b/src/auth.rs
index 0635910..09cc5e2 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -31,7 +31,7 @@ struct EncodeResponse {
#[utoipa::path(
request_body = UserForm,
- context_path = "/auth",
+ context_path = "/balalaika/auth",
description = "Creates a new user with the specified values.",
responses(
(status = 200, description = "Create new user", body = Response),
@@ -56,7 +56,7 @@ pub async fn register(
#[utoipa::path(
request_body = UserForm,
- context_path = "/auth",
+ context_path = "/balalaika/auth",
description = "Attempts to log in user. If successful, it returns an encoded token that grants access to protected routes in the api.",
responses(
(status = 200, description = "Returns encoded token", body = EncodeResponse),
@@ -122,7 +122,7 @@ async fn encode_token(id: usize, secret: &String) -> Result<String, HttpResponse
#[utoipa::path(
request_body = UserForm,
- context_path = "/auth",
+ context_path = "/balalaika/auth",
description = "Attempts to delete user. Both username and password are required.",
responses(
(status = 200, description = "Delete user", body = Response),
diff --git a/src/main.rs b/src/main.rs
index 2f3449d..0f6ca87 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -48,11 +48,16 @@ async fn main() -> std::io::Result<()> {
HttpServer::new(move || {
App::new()
.app_data(web::Data::new(app_state.clone()))
- .service(api::api_scope())
- .service(auth::auth_scope())
- .service(SwaggerUi::new("/doc/{_:.*}").url("/docs/openapi.json", openapi.clone()))
- .route("/", web::get().to(redirect_to_docs))
- .route("/doc", web::get().to(redirect_to_docs))
+ .service(
+ SwaggerUi::new("/balalaika/doc/{_:.*}").url("/balalaika/docs/openapi.json", openapi.clone()),
+ )
+ .service(
+ web::scope("/balalaika")
+ .service(api::api_scope())
+ .service(auth::auth_scope())
+ .route("/doc", web::get().to(redirect_to_docs))
+ .route("/", web::get().to(redirect_to_docs))
+ )
})
.bind(("127.0.0.1", 8000))?
.run()
@@ -61,5 +66,5 @@ async fn main() -> std::io::Result<()> {
/* Redirection page */
async fn redirect_to_docs() -> impl Responder {
- Redirect::to("/doc/")
+ Redirect::to("doc/")
}