Fix: 小修小补 & 优化代码结构
This commit is contained in:
41
app/types/strapi/common.ts
Normal file
41
app/types/strapi/common.ts
Normal file
@ -0,0 +1,41 @@
|
||||
export interface StrapiEntity {
|
||||
id?: number;
|
||||
documentId?: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
publishedAt?: string;
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export interface StrapiImage {
|
||||
id: number;
|
||||
url: string;
|
||||
alternativeText?: string;
|
||||
caption?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
formats?: {
|
||||
small?: StrapiImageFormat;
|
||||
medium?: StrapiImageFormat;
|
||||
thumbnail?: StrapiImageFormat;
|
||||
}
|
||||
}
|
||||
|
||||
export interface StrapiImageFormat {
|
||||
url: string;
|
||||
width: number;
|
||||
height: number;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface StrapiResponse<T> {
|
||||
data: T;
|
||||
meta?: {
|
||||
pagination?: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
pageCount: number;
|
||||
total: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
app/types/strapi/index.ts
Normal file
2
app/types/strapi/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './common';
|
||||
export * from './production';
|
||||
14
app/types/strapi/production.ts
Normal file
14
app/types/strapi/production.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import type { StrapiEntity, StrapiImage } from './common';
|
||||
|
||||
export interface ProductionType extends StrapiEntity {
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Production extends StrapiEntity {
|
||||
title: string;
|
||||
summary?: string;
|
||||
production_type?: ProductionType;
|
||||
production_image?: StrapiImage;
|
||||
production_details?: string;
|
||||
production_specs?: string | object;
|
||||
}
|
||||
Reference in New Issue
Block a user