From 0cf8e24c1c62a4fbc718bfa482430606afbfa2f3 Mon Sep 17 00:00:00 2001 From: FrenchGithubUser Date: Wed, 3 Sep 2025 19:38:39 +0200 Subject: [PATCH] fixed type inconsistencies in between frontend and backend --- backend/api/src/api_doc.rs | 8 +++- .../src/handlers/forum/get_forum_thread.rs | 4 +- frontend/src/api-schema/schema.d.ts | 39 ++++++++++++++++++- .../artist/EditAffiliatedArtists.vue | 4 +- frontend/src/services/api/artistService.ts | 2 - frontend/src/services/api/forumService.ts | 6 +-- frontend/src/views/forum/ForumThreadView.vue | 4 +- 7 files changed, 52 insertions(+), 15 deletions(-) diff --git a/backend/api/src/api_doc.rs b/backend/api/src/api_doc.rs index f0d842d0..952c623f 100644 --- a/backend/api/src/api_doc.rs +++ b/backend/api/src/api_doc.rs @@ -3,7 +3,10 @@ use utoipa::{ Modify, OpenApi, }; -use crate::handlers::user_applications::get_user_applications::GetUserApplicationsQuery; +use crate::handlers::{ + search::search_torrent_requests::SearchTorrentRequestsQuery, + user_applications::get_user_applications::GetUserApplicationsQuery, +}; #[derive(OpenApi)] #[openapi( @@ -78,7 +81,8 @@ use crate::handlers::user_applications::get_user_applications::GetUserApplicatio crate::handlers::external_db::get_comic_vine_data::exec, ), components(schemas( - GetUserApplicationsQuery + GetUserApplicationsQuery, + SearchTorrentRequestsQuery ),) )] pub struct ApiDoc; diff --git a/backend/api/src/handlers/forum/get_forum_thread.rs b/backend/api/src/handlers/forum/get_forum_thread.rs index 6010950f..01a921ad 100644 --- a/backend/api/src/handlers/forum/get_forum_thread.rs +++ b/backend/api/src/handlers/forum/get_forum_thread.rs @@ -4,7 +4,7 @@ use actix_web::{ HttpResponse, }; use arcadia_common::error::Result; -use arcadia_storage::{models::forum::ForumThreadHierarchy, redis::RedisPoolInterface}; +use arcadia_storage::{models::forum::ForumThreadAndPosts, redis::RedisPoolInterface}; use serde::Deserialize; use utoipa::IntoParams; @@ -27,7 +27,7 @@ pub struct GetForumThreadQueryId { path = "/api/forum/thread", params(GetForumThreadQueryId), responses( - (status = 200, description = "Returns the thread and its posts", body=ForumThreadHierarchy) + (status = 200, description = "Returns the thread and its posts", body=ForumThreadAndPosts) ) )] pub async fn exec( diff --git a/frontend/src/api-schema/schema.d.ts b/frontend/src/api-schema/schema.d.ts index a93c0197..e6b6967b 100644 --- a/frontend/src/api-schema/schema.d.ts +++ b/frontend/src/api-schema/schema.d.ts @@ -1160,6 +1160,19 @@ export interface components { /** Format: date-time */ updated_at: string; }; + ForumPostHierarchy: { + content: string; + /** Format: date-time */ + created_at: string; + created_by: components["schemas"]["UserLiteAvatar"]; + /** Format: int64 */ + forum_thread_id: number; + /** Format: int64 */ + id: number; + sticky: boolean; + /** Format: date-time */ + updated_at: string; + }; ForumSubCategoryHierarchy: { category: components["schemas"]["ForumCategoryLite"]; forbidden_classes: string[]; @@ -1188,6 +1201,22 @@ export interface components { posts_amount: number; sticky: boolean; }; + ForumThreadAndPosts: { + /** Format: date-time */ + created_at: string; + /** Format: int64 */ + created_by_id: number; + /** Format: int32 */ + forum_sub_category_id: number; + /** Format: int64 */ + id: number; + locked: boolean; + name: string; + posts: components["schemas"]["ForumPostHierarchy"][]; + /** Format: int64 */ + posts_amount: number; + sticky: boolean; + }; ForumThreadHierarchy: { /** Format: date-time */ created_at: string; @@ -1402,6 +1431,14 @@ export interface components { password_verify: string; username: string; }; + SearchTorrentRequestsQuery: { + /** Format: int64 */ + page?: number | null; + /** Format: int64 */ + page_size?: number | null; + tags?: string[] | null; + title_group_name?: string | null; + }; SentInvitation: { message: string; receiver_email: string; @@ -2714,7 +2751,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["ForumThreadHierarchy"]; + "application/json": components["schemas"]["ForumThreadAndPosts"]; }; }; }; diff --git a/frontend/src/components/artist/EditAffiliatedArtists.vue b/frontend/src/components/artist/EditAffiliatedArtists.vue index 30d558e0..9f29b559 100644 --- a/frontend/src/components/artist/EditAffiliatedArtists.vue +++ b/frontend/src/components/artist/EditAffiliatedArtists.vue @@ -42,7 +42,7 @@ import { Button, InputText, MultiSelect } from 'primevue' import ArtistSearchBar from './ArtistSearchBar.vue' import { getArtistRoles } from '@/services/helpers' import { ref } from 'vue' -import type { AffiliatedArtist, AffiliatedArtistHierarchy, ArtistLite, UserCreatedAffiliatedArtist } from '@/services/api/artistService' +import type { AffiliatedArtistHierarchy, ArtistLite, UserCreatedAffiliatedArtist } from '@/services/api/artistService' import { useI18n } from 'vue-i18n' import type { ContentType } from '@/services/api/torrentService' import { onMounted } from 'vue' @@ -52,7 +52,7 @@ import { type UserCreatedArtist, createArtists } from '@/services/api/artistServ const { t } = useI18n() const affiliated_artists_names = ref([]) -const affiliated_artists = ref<(UserCreatedAffiliatedArtist | AffiliatedArtist)[]>([]) +const affiliated_artists = ref<(UserCreatedAffiliatedArtist | AffiliatedArtistHierarchy)[]>([]) const removedExistingAffiliatedArtistsIds: number[] = [] const props = defineProps<{ diff --git a/frontend/src/services/api/artistService.ts b/frontend/src/services/api/artistService.ts index 67b5feeb..61b03362 100644 --- a/frontend/src/services/api/artistService.ts +++ b/frontend/src/services/api/artistService.ts @@ -5,8 +5,6 @@ export type Artist = components['schemas']['Artist'] export type ArtistLite = components['schemas']['ArtistLite'] -export type AffiliatedArtist = components['schemas']['AffiliatedArtist'] - export type AffiliatedArtistHierarchy = components['schemas']['AffiliatedArtistHierarchy'] export type ArtistAndTitleGroupsLite = components['schemas']['ArtistAndTitleGroupsLite'] diff --git a/frontend/src/services/api/forumService.ts b/frontend/src/services/api/forumService.ts index 588c6a92..446154f4 100644 --- a/frontend/src/services/api/forumService.ts +++ b/frontend/src/services/api/forumService.ts @@ -26,12 +26,10 @@ export const searchForumThreads = async (params: { title: string; offset?: numbe return (await api.get(`/search/forum/thread?title=${params.title}`)).data } -export type ForumThreadsAndPosts = components['schemas']['ForumThreadAndPosts'] - export type ForumPostHierarchy = components['schemas']['ForumPostHierarchy'] -export const getForumThread = async (forumThreadId: number): Promise => { - return (await api.get('/forum/thread?id=' + forumThreadId)).data +export const getForumThread = async (forumThreadId: number): Promise => { + return (await api.get('/forum/thread?id=' + forumThreadId)).data } export type UserCreatedForumPost = components['schemas']['UserCreatedForumPost'] diff --git a/frontend/src/views/forum/ForumThreadView.vue b/frontend/src/views/forum/ForumThreadView.vue index 9de4ae2f..cdb98ed1 100644 --- a/frontend/src/views/forum/ForumThreadView.vue +++ b/frontend/src/views/forum/ForumThreadView.vue @@ -25,7 +25,7 @@