From e158ec8cf50e4575b5e6d60219a80397347c7b4a Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 15 Oct 2025 16:45:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20directus=E7=B1=BB=E5=9E=8B=E6=A0=87?= =?UTF-8?q?=E6=B3=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用Directus-sdk-typegen生成Directus类型标注 --- app/types/directus/my-schema.ts | 52 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/app/types/directus/my-schema.ts b/app/types/directus/my-schema.ts index 706719b..ca919b7 100644 --- a/app/types/directus/my-schema.ts +++ b/app/types/directus/my-schema.ts @@ -1,5 +1,3 @@ -import type { JsonValue } from '../common'; - export interface CompanyProfile { /** @primaryKey */ id: number; @@ -28,20 +26,9 @@ export interface ContactInfoTranslation { content?: 'json' | null; } -export interface Document { - /** @primaryKey */ - id: number; - status?: 'published' | 'draft' | 'archived'; - file?: DirectusFile | string | null; - /** @description i18n字段 */ - translations?: DocumentsTranslation[] | null; - products?: ProductsDocument[] | string[]; -} - export interface DocumentsTranslation { /** @primaryKey */ id: number; - documents_id?: Document | string | null; languages_code?: Language | string | null; title?: string | null; } @@ -68,6 +55,22 @@ export interface Language { direction?: 'ltr' | 'rtl' | null; } +export interface ProductDocument { + /** @primaryKey */ + id: number; + status?: 'published' | 'draft' | 'archived'; + file?: DirectusFile | string | null; + translations?: ProductDocumentsTranslation[] | null; +} + +export interface ProductDocumentsTranslation { + /** @primaryKey */ + id: number; + product_documents_id?: ProductDocument | string | null; + languages_code?: Language | string | null; + title?: string | null; +} + export interface ProductImage { /** @primaryKey */ id: number; @@ -146,21 +149,20 @@ export interface Product { cover?: DirectusFile | string | null; homepage_recommend?: Homepage | string | null; recommend_sort?: number | null; - faqs?: ProductsQuestion[] | string[]; /** @description i18n字段 */ translations?: ProductsTranslation[] | null; + faqs?: ProductsQuestion[] | string[]; /** @description 在产品详情页中展示 */ images?: ProductsProductImage[] | string[]; - documents?: ProductsDocument[] | string[]; specs?: ProductSpecGroup[] | string[]; + documents?: ProductsProductDocument[] | string[]; } -export interface ProductsDocument { +export interface ProductsProductDocument { /** @primaryKey */ id: number; products_id?: Product | string | null; - documents_id?: Document | string | null; - sort?: number | null; + product_documents_id?: ProductDocument | string | null; } export interface ProductsProductImage { @@ -187,7 +189,7 @@ export interface ProductsTranslation { /** @required */ name: string; summary?: string | null; - description?: JsonValue | null; + description?: string | null; } export interface Question { @@ -206,7 +208,7 @@ export interface QuestionsTranslation { languages_code?: Language | string | null; /** @required */ title: string; - content?: 'json' | null; + content?: string | null; } export interface SolutionType { @@ -723,11 +725,12 @@ export interface Schema { company_profile_translations: CompanyProfileTranslation[]; contact_info: ContactInfo; contact_info_translations: ContactInfoTranslation[]; - documents: Document[]; documents_translations: DocumentsTranslation[]; homepage: Homepage; homepage_files: HomepageFile[]; languages: Language[]; + product_documents: ProductDocument[]; + product_documents_translations: ProductDocumentsTranslation[]; product_images: ProductImage[]; product_images_translations: ProductImagesTranslation[]; product_spec_groups: ProductSpecGroup[]; @@ -737,7 +740,7 @@ export interface Schema { product_types: ProductType[]; product_types_translations: ProductTypesTranslation[]; products: Product[]; - products_documents: ProductsDocument[]; + products_product_documents: ProductsProductDocument[]; products_product_images: ProductsProductImage[]; products_questions: ProductsQuestion[]; products_translations: ProductsTranslation[]; @@ -781,11 +784,12 @@ export enum CollectionNames { company_profile_translations = 'company_profile_translations', contact_info = 'contact_info', contact_info_translations = 'contact_info_translations', - documents = 'documents', documents_translations = 'documents_translations', homepage = 'homepage', homepage_files = 'homepage_files', languages = 'languages', + product_documents = 'product_documents', + product_documents_translations = 'product_documents_translations', product_images = 'product_images', product_images_translations = 'product_images_translations', product_spec_groups = 'product_spec_groups', @@ -795,7 +799,7 @@ export enum CollectionNames { product_types = 'product_types', product_types_translations = 'product_types_translations', products = 'products', - products_documents = 'products_documents', + products_product_documents = 'products_product_documents', products_product_images = 'products_product_images', products_questions = 'products_questions', products_translations = 'products_translations',