refactor(production): 重构产品页代码

- 将Production的documents类型改写为单独的interface:ProductionDocument
This commit is contained in:
2025-09-04 14:55:32 +08:00
parent d8abb0a50e
commit ea409d49b0
5 changed files with 19 additions and 14 deletions

View File

@ -44,4 +44,6 @@ export interface StrapiResponse<T> {
total: number;
}
}
}
}
export type StrapiRelation<T, K extends keyof T = never> = Omit<T, K | keyof StrapiEntity> & StrapiEntity;

View File

@ -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<ProductionDocument, 'related_productions'>[];
questions: StrapiRelation<Question, 'related_productions'>[];
show_in_production_list: boolean;
}
export interface ProductionDocument extends StrapiEntity {
document: StrapiMedia;
related_productions: StrapiRelation<Production, 'production_documents'>[];
}

View File

@ -1,4 +1,5 @@
export interface Question extends StrapiEntity {
title: string;
content: string;
related_productions: StrapiRelation<Production, 'questions'>[];
}