add copy strapi types script

This commit is contained in:
Schneider Roland 2025-01-11 21:24:01 +01:00
parent ea3a2e3366
commit 574d623746
23 changed files with 561 additions and 1 deletions

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
SCRIPT_DIR=$(readlink -f $(dirname $0))
PROJECT_ROOT_DIR=$(readlink -f "${SCRIPT_DIR}/..")
ROOT_DIR_APP="$(readlink -f ${PROJECT_ROOT_DIR})/yoga-app"
ROOT_DIR_STRAPI="$(readlink -f ${PROJECT_ROOT_DIR})/yoga-cms"
TYPES_DIR_STRAPI="$(readlink -f ${ROOT_DIR_STRAPI})/generated-strapi-interfaces"
TYPES_DIR_APP="$(readlink -f ${ROOT_DIR_APP})/src/types/"
echo "SCRIPT_DIR dir $SCRIPT_DIR"
echo "PROJECT_ROOT_DIR dir $PROJECT_ROOT_DIR"
echo "ROOT_DIR_APP dir $ROOT_DIR_APP"
echo "TYPES_DIR_STRAPI dir $TYPES_DIR_STRAPI"
echo "TYPES_DIR_APP dir $TYPES_DIR_APP"
CMD1="rm -rf "${TYPES_DIR_APP}"generated-strapi-interfaces"
CMD2="cp -r "${TYPES_DIR_STRAPI}" "${TYPES_DIR_APP}""
echo $CMD1
echo $CMD2
${CMD1}
${CMD2}
echo "done"

View File

@ -6,7 +6,8 @@
"dev": "next dev --turbopack -p 4081",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"copy-strapi-types": "bash copy-strapi-types.sh"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.7.2",

View File

@ -0,0 +1,34 @@
// Interface automatically generated by schemas-to-ts
import { Media } from '../components/shared/Media';
import { Media_Plain } from '../components/shared/Media';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface About {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: any;
image?: { data: Media };
};
}
export interface About_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: any;
image?: Media_Plain;
}
export interface About_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: any;
image?: number;
}
export interface About_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: any;
image?: AdminPanelRelationPropertyModification<Media_Plain>;
}

View File

@ -0,0 +1,54 @@
// Interface automatically generated by schemas-to-ts
import { Media } from '../components/shared/Media';
import { Author } from './author';
import { Category } from './category';
import { Media_Plain } from '../components/shared/Media';
import { Author_Plain } from './author';
import { Category_Plain } from './category';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface Article {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: string;
slug?: string;
cover?: { data: Media };
author?: { data: Author };
category?: { data: Category };
blocks?: any;
};
}
export interface Article_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: string;
slug?: string;
cover?: Media_Plain;
author?: Author_Plain;
category?: Category_Plain;
blocks?: any;
}
export interface Article_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: string;
slug?: string;
cover?: number;
author?: number;
category?: number;
blocks?: any;
}
export interface Article_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; title?: string;
description?: string;
slug?: string;
cover?: AdminPanelRelationPropertyModification<Media_Plain>;
author?: AdminPanelRelationPropertyModification<Author_Plain>;
category?: AdminPanelRelationPropertyModification<Category_Plain>;
blocks?: any;
}

View File

@ -0,0 +1,40 @@
// Interface automatically generated by schemas-to-ts
import { Media } from '../components/shared/Media';
import { Article } from './article';
import { Media_Plain } from '../components/shared/Media';
import { Article_Plain } from './article';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface Author {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
avatar?: { data: Media };
email?: string;
articles: { data: Article[] };
};
}
export interface Author_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
avatar?: Media_Plain;
email?: string;
articles: Article_Plain[];
}
export interface Author_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
avatar?: number;
email?: string;
articles: number[];
}
export interface Author_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
avatar?: AdminPanelRelationPropertyModification<Media_Plain>;
email?: string;
articles: AdminPanelRelationPropertyModification<Article_Plain>;
}

View File

@ -0,0 +1,41 @@
// Interface automatically generated by schemas-to-ts
import { Media } from '../components/shared/Media';
import { Quote } from '../components/shared/Quote';
import { Media_Plain } from '../components/shared/Media';
import { Quote_Plain } from '../components/shared/Quote';
import { Quote_NoRelations } from '../components/shared/Quote';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface Car {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
description?: string;
image?: { data: Media };
myquote: Quote[];
};
}
export interface Car_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
description?: string;
image?: Media_Plain;
myquote: Quote_Plain[];
}
export interface Car_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
description?: string;
image?: number;
myquote: Quote_NoRelations[];
}
export interface Car_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
description?: string;
image?: AdminPanelRelationPropertyModification<Media_Plain>;
myquote: Quote_Plain[];
}

View File

@ -0,0 +1,38 @@
// Interface automatically generated by schemas-to-ts
import { Article } from './article';
import { Article_Plain } from './article';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface Category {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
slug?: string;
articles: { data: Article[] };
description?: string;
};
}
export interface Category_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
slug?: string;
articles: Article_Plain[];
description?: string;
}
export interface Category_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
slug?: string;
articles: number[];
description?: string;
}
export interface Category_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
slug?: string;
articles: AdminPanelRelationPropertyModification<Article_Plain>;
description?: string;
}

View File

@ -0,0 +1,41 @@
// Interface automatically generated by schemas-to-ts
import { Media } from '../components/shared/Media';
import { Seo } from '../components/shared/Seo';
import { Media_Plain } from '../components/shared/Media';
import { Seo_Plain } from '../components/shared/Seo';
import { Seo_NoRelations } from '../components/shared/Seo';
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export interface Global {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; siteName: string;
favicon?: { data: Media };
siteDescription: string;
defaultSeo?: Seo;
};
}
export interface Global_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; siteName: string;
favicon?: Media_Plain;
siteDescription: string;
defaultSeo?: Seo_Plain;
}
export interface Global_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; siteName: string;
favicon?: number;
siteDescription: string;
defaultSeo?: Seo_NoRelations;
}
export interface Global_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; siteName: string;
favicon?: AdminPanelRelationPropertyModification<Media_Plain>;
siteDescription: string;
defaultSeo?: Seo_Plain;
}

View File

@ -0,0 +1,39 @@
// Interface automatically generated by schemas-to-ts
import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification';
export enum Template {
Homepage = 'homepage',}
export interface Page {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
title?: string;
template?: Template;
parent?: { data: Page };
};
}
export interface Page_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
title?: string;
template?: Template;
parent?: Page_Plain;
}
export interface Page_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
title?: string;
template?: Template;
parent?: number;
}
export interface Page_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
title?: string;
template?: Template;
parent?: AdminPanelRelationPropertyModification<Page_Plain>;
}

View File

@ -0,0 +1,30 @@
// Interface automatically generated by schemas-to-ts
export interface Person {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
firstname?: string;
lastname?: string;
};
}
export interface Person_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
firstname?: string;
lastname?: string;
}
export interface Person_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
firstname?: string;
lastname?: string;
}
export interface Person_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; name?: string;
firstname?: string;
lastname?: string;
}

View File

@ -0,0 +1,8 @@
// Interface automatically generated by schemas-to-ts
export interface AdminPanelRelationPropertyModification<T> {
connect: T[];
disconnect: T[];
}

View File

@ -0,0 +1,9 @@
// Interface automatically generated by schemas-to-ts
import { BeforeRunEvent } from './BeforeRunEvent';
export interface AfterRunEvent<TState, TResult> extends BeforeRunEvent<TState extends Record<string, unknown> ? TState : never> {
result: TResult;
}

View File

@ -0,0 +1,8 @@
// Interface automatically generated by schemas-to-ts
import { Event } from '@strapi/database/dist/lifecycles';
export interface BeforeRunEvent<TState extends Record<string, unknown>> extends Event {
state: TState;
}

View File

@ -0,0 +1,44 @@
// Interface automatically generated by schemas-to-ts
import { MediaFormat } from './MediaFormat';
export interface Media {
id: number;
attributes: {
name: string;
alternativeText: string;
caption: string;
width: number;
height: number;
formats: { thumbnail: MediaFormat; small: MediaFormat; medium: MediaFormat; large: MediaFormat; };
hash: string;
ext: string;
mime: string;
size: number;
url: string;
previewUrl: string;
provider: string;
createdAt: Date;
updatedAt: Date;
}
}
export interface Media_Plain {
id: number;
name: string;
alternativeText: string;
caption: string;
width: number;
height: number;
formats: { thumbnail: MediaFormat; small: MediaFormat; medium: MediaFormat; large: MediaFormat; };
hash: string;
ext: string;
mime: string;
size: number;
url: string;
previewUrl: string;
provider: string;
createdAt: Date;
updatedAt: Date;
}

View File

@ -0,0 +1,15 @@
// Interface automatically generated by schemas-to-ts
export interface MediaFormat {
name: string;
hash: string;
ext: string;
mime: string;
width: number;
height: number;
size: number;
path: string;
url: string;
}

View File

@ -0,0 +1,15 @@
// Interface automatically generated by schemas-to-ts
export interface Payload<T> {
data: T;
meta: {
pagination?: {
page: number;
pageSize: number;
pageCount: number;
total: number;
}
};
}

View File

@ -0,0 +1,26 @@
// Interface automatically generated by schemas-to-ts
export interface User {
id: number;
attributes: {
username: string;
email: string;
provider: string;
confirmed: boolean;
blocked: boolean;
createdAt: Date;
updatedAt: Date;
}
}
export interface User_Plain {
id: number;
username: string;
email: string;
provider: string;
confirmed: boolean;
blocked: boolean;
createdAt: Date;
updatedAt: Date;
}

View File

@ -0,0 +1,13 @@
// Interface automatically generated by schemas-to-ts
export interface Media {
file?: { data: Media };
}
export interface Media_Plain {
file?: Media_Plain;
}
export interface Media_NoRelations {
file?: number;
}

View File

@ -0,0 +1,13 @@
// Interface automatically generated by schemas-to-ts
export interface MyComponent {
testtext?: string;
}
export interface MyComponent_Plain {
testtext?: string;
}
export interface MyComponent_NoRelations {
testtext?: string;
}

View File

@ -0,0 +1,16 @@
// Interface automatically generated by schemas-to-ts
export interface Quote {
title?: string;
body?: string;
}
export interface Quote_Plain {
title?: string;
body?: string;
}
export interface Quote_NoRelations {
title?: string;
body?: string;
}

View File

@ -0,0 +1,13 @@
// Interface automatically generated by schemas-to-ts
export interface RichText {
body?: string;
}
export interface RichText_Plain {
body?: string;
}
export interface RichText_NoRelations {
body?: string;
}

View File

@ -0,0 +1,22 @@
// Interface automatically generated by schemas-to-ts
import { Media } from './Media';
import { Media_Plain } from './Media';
export interface Seo {
metaTitle: string;
metaDescription: string;
shareImage?: { data: Media };
}
export interface Seo_Plain {
metaTitle: string;
metaDescription: string;
shareImage?: Media_Plain;
}
export interface Seo_NoRelations {
metaTitle: string;
metaDescription: string;
shareImage?: number;
}

View File

@ -0,0 +1,16 @@
// Interface automatically generated by schemas-to-ts
import { Media } from './Media';
import { Media_Plain } from './Media';
export interface Slider {
files?: { data: Media[] };
}
export interface Slider_Plain {
files?: Media_Plain[];
}
export interface Slider_NoRelations {
files?: number[];
}