diff --git a/app/pages/productions/[...slug].vue b/app/pages/productions/[...slug].vue index 62485d5..cc42f15 100644 --- a/app/pages/productions/[...slug].vue +++ b/app/pages/productions/[...slug].vue @@ -36,7 +36,7 @@ - + @@ -95,8 +95,8 @@ onMounted(async () => { questions: { populate: '*', }, - documents: { - populate: '*', + production_documents: { + populate: 'document', }, }, locale: strapiLocale, @@ -106,6 +106,7 @@ onMounted(async () => { production.value = { ...item, } + console.log('Fetched production:', production.value) } } catch (error) { console.error('Failed to fetch production:', error) diff --git a/app/pages/productions/index.vue b/app/pages/productions/index.vue index 4ca445e..745ab4d 100644 --- a/app/pages/productions/index.vue +++ b/app/pages/productions/index.vue @@ -19,8 +19,7 @@ v-for="(group, type) in groupedProductions" :key="type" :title="type || '未分
@@ -65,12 +64,9 @@ onMounted(async () => { cover: { populate: '*', }, - production_images: { - populate: '*', - }, production_type: { - populate: '*', - } + populate: '*' + }, }, filters: { show_in_production_list: { diff --git a/app/types/strapi/common.ts b/app/types/strapi/common.ts index 135802b..2299fb4 100644 --- a/app/types/strapi/common.ts +++ b/app/types/strapi/common.ts @@ -44,4 +44,6 @@ export interface StrapiResponse { total: number; } } -} \ No newline at end of file +} + +export type StrapiRelation = Omit & StrapiEntity; \ No newline at end of file diff --git a/app/types/strapi/production.ts b/app/types/strapi/production.ts index bf124f3..3ee3176 100644 --- a/app/types/strapi/production.ts +++ b/app/types/strapi/production.ts @@ -1,4 +1,4 @@ -import type { StrapiEntity, StrapiImage, StrapiMedia } from './common'; +import type { StrapiEntity, StrapiImage, StrapiMedia, StrapiRelation } from './common'; export interface ProductionType extends StrapiEntity { type: string; @@ -22,7 +22,12 @@ export interface Production extends StrapiEntity { production_images: StrapiImage[]; production_details: string; production_specs: ProductionSpecGroup[]; - questions: Question[]; - documents: StrapiMedia[]; + production_documents: StrapiRelation[]; + questions: StrapiRelation[]; show_in_production_list: boolean; +} + +export interface ProductionDocument extends StrapiEntity { + document: StrapiMedia; + related_productions: StrapiRelation[]; } \ No newline at end of file diff --git a/app/types/strapi/question.ts b/app/types/strapi/question.ts index 4204a28..564675f 100644 --- a/app/types/strapi/question.ts +++ b/app/types/strapi/question.ts @@ -1,4 +1,5 @@ export interface Question extends StrapiEntity { title: string; content: string; + related_productions: StrapiRelation[]; } \ No newline at end of file