fix: pr suggestions by coderabbit

This commit is contained in:
ppoliani
2025-08-24 18:09:31 +03:00
parent cfe478f8f3
commit 073075809e
10 changed files with 14 additions and 9 deletions
Generated
+1
View File
@@ -526,6 +526,7 @@ dependencies = [
"actix-web",
"actix-web-lab",
"chrono 0.4.41",
"jsonwebtoken",
"log",
"musicbrainz_rs",
"percent-encoding",
@@ -15,7 +15,7 @@ pub struct GetArtistPublicationsQuery {
path = "/api/artists",
params (GetArtistPublicationsQuery),
responses(
(status = 200, description = "Successfully got the artist's pulications", body=ArtistAndTitleGroupsLite),
(status = 200, description = "Successfully got the artist's publications", body=ArtistAndTitleGroupsLite),
)
)]
pub async fn exec(
+1 -1
View File
@@ -50,7 +50,7 @@ pub async fn exec(arc: web::Data<Arcadia>, user_login: web::Json<Login>) -> Resu
&token_claims,
&EncodingKey::from_secret(arc.jwt_secret.as_bytes()),
)
.unwrap();
.map_err(Error::JwtError)?;
Ok(HttpResponse::Ok().json(serde_json::json!({
"token": token,
@@ -43,7 +43,7 @@ pub async fn exec(arc: web::Data<Arcadia>, form: web::Json<RefreshToken>) -> Res
&refresh_token_claims,
&EncodingKey::from_secret(arc.jwt_secret.as_bytes()),
)
.unwrap();
.map_err(Error::JwtError)?;
Ok(HttpResponse::Ok().json(serde_json::json!({
"token": token,
+1 -1
View File
@@ -62,7 +62,7 @@ pub async fn exec(
.search_torrents(&torrent_search, Some(current_user.id))
.await?;
Ok(HttpResponse::Created().json(json!({
Ok(HttpResponse::Ok().json(json!({
"user":user,
"last_five_uploaded_torrents": uploaded_torrents.get("title_groups").unwrap(),
"last_five_snatched_torrents": snatched_torrents.get("title_groups").unwrap()
+3 -3
View File
@@ -160,7 +160,7 @@ async fn test_find_torrents_by_external_link(pool: PgPool) {
});
let req = test::TestRequest::post()
.uri("/api/search/torrent/lite")
.uri("/api/search/torrents/lite")
.insert_header(("X-Forwarded-For", "10.10.4.88"))
.insert_header(token)
.set_json(body)
@@ -200,7 +200,7 @@ async fn test_find_torrents_by_name(pool: PgPool) {
});
let req = test::TestRequest::post()
.uri("/api/search/torrent/lite")
.uri("/api/search/torrents/lite")
.insert_header(("X-Forwarded-For", "10.10.4.88"))
.insert_header(token)
.set_json(body)
@@ -240,7 +240,7 @@ async fn test_find_torrents_no_link_or_name_provided(pool: PgPool) {
});
let req = test::TestRequest::post()
.uri("/api/search/torrent/lite")
.uri("/api/search/torrents/lite")
.insert_header(("X-Forwarded-For", "10.10.4.88"))
.insert_header(token)
.set_json(body)
+1
View File
@@ -7,6 +7,7 @@ edition = "2024"
actix-web = "4"
actix-web-lab = "0.24.1"
chrono = { version = "0.4", features = ["serde"] }
jsonwebtoken = "9.3.1"
log = "0.4"
reqwest = "0.12"
musicbrainz_rs = "0.9.1"
+3
View File
@@ -125,6 +125,9 @@ pub enum Error {
#[error("invalid or expired refresh token")]
InvalidOrExpiredRefreshToken,
#[error("JWT error")]
JwtError(#[source] jsonwebtoken::errors::Error),
#[error("unsupported notification reason")]
UnsupportedNotification,
@@ -9,7 +9,7 @@ export const getExternalDatabaseData = async (item_id: string | number, database
return (await api.get('external-sources/isbn?isbn=' + item_id)).data
}
case 'comic_vine': {
return (await api.get('external-sources/comic_vine?url=' + item_id)).data
return (await api.get('external-sources/comic-vine?url=' + item_id)).data
}
case 'musicbrainz': {
return (await api.get('external-sources/musicbrainz?url=' + item_id)).data
+1 -1
View File
@@ -135,7 +135,7 @@ export const editTorrent = async (editedTorrent: EditedTorrent) => {
export type UploadInformation = components['schemas']['UploadInformation']
export const getUploadInformation = async () => {
return (await api.get<UploadInformation>('/upload-info')).data
return (await api.get<UploadInformation>('/torrents/upload-info')).data
}
export type TorrentToDelete = components['schemas']['TorrentToDelete']