Merge branch 'master'

# Conflicts:
#	README.md
This commit is contained in:
Julian Krauser 2024-10-30 14:57:34 +01:00
commit 5caeae2338
64 changed files with 48358 additions and 1 deletions

21
.env.example Normal file
View file

@ -0,0 +1,21 @@
# Server
HOST=0.0.0.0
PORT=1337
# Secrets
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
TRANSFER_TOKEN_SALT=tobemodified
JWT_SECRET=tobemodified
# Database
DATABASE_CLIENT=mysql
DATABASE_HOST=localhost
DATABASE_PORT=3306
DATABASE_NAME=tobemodified
DATABASE_USERNAME=tobemodified
DATABASE_PASSWORD=tobemodified
DATABASE_SSL=false
DATABASE_FILENAME=

131
.gitignore vendored Normal file
View file

@ -0,0 +1,131 @@
############################
# OS X
############################
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*
############################
# Linux
############################
*~
############################
# Windows
############################
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
############################
# Packages
############################
*.7z
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.com
*.class
*.dll
*.exe
*.o
*.seed
*.so
*.swo
*.swp
*.swn
*.swm
*.out
*.pid
############################
# Logs and databases
############################
.tmp
*.log
*.sql
*.sqlite
*.sqlite3
############################
# Misc.
############################
*#
ssl
.idea
nbproject
public/uploads/*
!public/uploads/.gitkeep
.tsbuildinfo
.eslintcache
############################
# Node.js
############################
lib-cov
lcov.info
pids
logs
results
node_modules
.node_history
############################
# Package managers
############################
.yarn/*
!.yarn/cache
!.yarn/unplugged
!.yarn/patches
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
yarn-error.log
############################
# Tests
############################
coverage
############################
# Strapi
############################
.env
license.txt
exports
.strapi
dist
build
.strapi-updater.json
.strapi-cloud.json

View file

@ -1,3 +1,65 @@
# ff-webpage-cms
Strapi Content Management for ff-webpage
Strapi Content Management for ff-webpage
# 🚀 Getting started with Strapi
Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/dev-docs/cli) (CLI) which lets you scaffold and manage your project in seconds.
### `develop`
Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-develop)
```
npm run develop
# or
yarn develop
```
### `start`
Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-start)
```
npm run start
# or
yarn start
```
### `build`
Build your admin panel. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-build)
```
npm run build
# or
yarn build
```
## ⚙️ Deployment
Strapi gives you many possible deployment options for your project including [Strapi Cloud](https://cloud.strapi.io). Browse the [deployment section of the documentation](https://docs.strapi.io/dev-docs/deployment) to find the best solution for your use case.
```
yarn strapi deploy
```
## 📚 Learn more
- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
- [Strapi blog](https://strapi.io/blog) - Official Strapi blog containing articles made by the Strapi team and the community.
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
## ✨ Community
- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
- [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
---
<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>

17
config/admin.ts Normal file
View file

@ -0,0 +1,17 @@
export default ({ env }) => ({
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
apiToken: {
salt: env('API_TOKEN_SALT'),
},
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
flags: {
nps: env.bool('FLAG_NPS', true),
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
},
});

7
config/api.ts Normal file
View file

@ -0,0 +1,7 @@
export default {
rest: {
defaultLimit: 25,
maxLimit: 100,
withCount: true,
},
};

60
config/database.ts Normal file
View file

@ -0,0 +1,60 @@
import path from 'path';
export default ({ env }) => {
const client = env('DATABASE_CLIENT', 'sqlite');
const connections = {
mysql: {
connection: {
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 3306),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false) && {
key: env('DATABASE_SSL_KEY', undefined),
cert: env('DATABASE_SSL_CERT', undefined),
ca: env('DATABASE_SSL_CA', undefined),
capath: env('DATABASE_SSL_CAPATH', undefined),
cipher: env('DATABASE_SSL_CIPHER', undefined),
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
},
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
postgres: {
connection: {
connectionString: env('DATABASE_URL'),
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false) && {
key: env('DATABASE_SSL_KEY', undefined),
cert: env('DATABASE_SSL_CERT', undefined),
ca: env('DATABASE_SSL_CA', undefined),
capath: env('DATABASE_SSL_CAPATH', undefined),
cipher: env('DATABASE_SSL_CIPHER', undefined),
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
},
schema: env('DATABASE_SCHEMA', 'public'),
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
sqlite: {
connection: {
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
},
useNullAsDefault: true,
},
};
return {
connection: {
client,
...connections[client],
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
},
};
};

13
config/middlewares.ts Normal file
View file

@ -0,0 +1,13 @@
export default [
'strapi::logger',
'strapi::errors',
'strapi::security',
'strapi::cors',
'strapi::poweredBy',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
'global::deepPopulate'
];

1
config/plugins.ts Normal file
View file

@ -0,0 +1 @@
export default () => ({});

7
config/server.ts Normal file
View file

@ -0,0 +1,7 @@
export default ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
app: {
keys: env.array('APP_KEYS'),
},
});

View file

BIN
favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

35876
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

40
package.json Normal file
View file

@ -0,0 +1,40 @@
{
"name": "webpage-cms",
"version": "0.1.0",
"private": true,
"description": "A Strapi application",
"scripts": {
"build": "strapi build",
"deploy": "strapi deploy",
"develop": "strapi develop",
"start": "strapi start",
"strapi": "strapi"
},
"dependencies": {
"@offset-dev/strapi-calendar": "^1.0.0-beta.1",
"@strapi/plugin-cloud": "5.1.1",
"@strapi/plugin-color-picker": "^5.1.1",
"@strapi/plugin-documentation": "^5.1.1",
"@strapi/plugin-graphql": "^5.1.1",
"@strapi/plugin-users-permissions": "5.1.1",
"@strapi/strapi": "5.1.1",
"mysql2": "3.9.8",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.0.0",
"styled-components": "^6.0.0"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"typescript": "^5"
},
"engines": {
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"strapi": {
"uuid": "0e0f7176-9d34-4148-9fe9-3eecb109ce3a"
}
}

3
public/robots.txt Normal file
View file

@ -0,0 +1,3 @@
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
# User-Agent: *
# Disallow: /

0
public/uploads/.gitkeep Normal file
View file

37
src/admin/app.example.tsx Normal file
View file

@ -0,0 +1,37 @@
import type { StrapiApp } from '@strapi/strapi/admin';
export default {
config: {
locales: [
// 'ar',
// 'fr',
// 'cs',
// 'de',
// 'dk',
// 'es',
// 'he',
// 'id',
// 'it',
// 'ja',
// 'ko',
// 'ms',
// 'nl',
// 'no',
// 'pl',
// 'pt-BR',
// 'pt',
// 'ru',
// 'sk',
// 'sv',
// 'th',
// 'tr',
// 'uk',
// 'vi',
// 'zh-Hans',
// 'zh',
],
},
bootstrap(app: StrapiApp) {
console.log(app);
},
};

20
src/admin/tsconfig.json Normal file
View file

@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["../plugins/**/admin/src/**/*", "./"],
"exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"]
}

View file

@ -0,0 +1,12 @@
import { mergeConfig, type UserConfig } from 'vite';
export default (config: UserConfig) => {
// Important: always return the modified config
return mergeConfig(config, {
resolve: {
alias: {
'@': '/src',
},
},
});
};

0
src/api/.gitkeep Normal file
View file

View file

@ -0,0 +1,93 @@
{
"kind": "collectionType",
"collectionName": "articles",
"info": {
"singularName": "article",
"pluralName": "articles",
"displayName": "Articles",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"description": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "uid",
"targetField": "title"
},
"content": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "blocks"
},
"image": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
],
"pluginOptions": {
"i18n": {
"localized": false
}
}
},
"attachment": {
"type": "media",
"multiple": true,
"required": false,
"allowedTypes": [
"images",
"files",
"videos"
],
"pluginOptions": {
"i18n": {
"localized": false
}
}
},
"date": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "date",
"required": true
}
}
}

View file

@ -0,0 +1,7 @@
/**
* article controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::article.article');

View file

@ -0,0 +1,7 @@
/**
* article router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::article.article');

View file

@ -0,0 +1,7 @@
/**
* article service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::article.article');

View file

@ -0,0 +1,54 @@
{
"kind": "collectionType",
"collectionName": "events",
"info": {
"singularName": "event",
"pluralName": "events",
"displayName": "Events",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"description": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "uid",
"targetField": "title"
},
"date": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "datetime",
"required": true
}
}
}

View file

@ -0,0 +1,7 @@
/**
* event controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::event.event');

View file

@ -0,0 +1,7 @@
/**
* event router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::event.event');

View file

@ -0,0 +1,7 @@
/**
* event service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::event.event');

View file

@ -0,0 +1,40 @@
{
"kind": "singleType",
"collectionName": "globals",
"info": {
"singularName": "global",
"pluralName": "globals",
"displayName": "Global",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"navbar": {
"type": "component",
"repeatable": false,
"pluginOptions": {
"i18n": {
"localized": true
}
},
"component": "global.navbar"
},
"footer": {
"type": "component",
"repeatable": false,
"pluginOptions": {
"i18n": {
"localized": true
}
},
"component": "global.footer"
}
}
}

View file

@ -0,0 +1,7 @@
/**
* global controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::global.global');

View file

@ -0,0 +1,7 @@
/**
* global router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::global.global');

View file

@ -0,0 +1,7 @@
/**
* global service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::global.global');

View file

@ -0,0 +1,35 @@
{
"kind": "singleType",
"collectionName": "homepages",
"info": {
"singularName": "homepage",
"pluralName": "homepages",
"displayName": "Homepage",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"backdrop": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"images"
]
},
"content": {
"type": "dynamiczone",
"components": [
"dynamic-zone.gallery",
"dynamic-zone.full-text",
"dynamic-zone.full-image",
"dynamic-zone.emphasise-article",
"dynamic-zone.dual-column-text",
"dynamic-zone.column-image-text"
]
}
}
}

View file

@ -0,0 +1,7 @@
/**
* homepage controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::homepage.homepage');

View file

@ -0,0 +1,7 @@
/**
* homepage router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::homepage.homepage');

View file

@ -0,0 +1,7 @@
/**
* homepage service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::homepage.homepage');

View file

@ -0,0 +1,77 @@
{
"kind": "collectionType",
"collectionName": "operations",
"info": {
"singularName": "operation",
"pluralName": "operations",
"displayName": "Operations",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"description": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "uid",
"targetField": "title"
},
"content": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "blocks"
},
"attachment": {
"type": "media",
"multiple": true,
"required": false,
"allowedTypes": [
"images",
"files",
"videos"
],
"pluginOptions": {
"i18n": {
"localized": false
}
}
},
"date": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "datetime",
"required": true
}
}
}

View file

@ -0,0 +1,7 @@
/**
* operation controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::operation.operation');

View file

@ -0,0 +1,7 @@
/**
* operation router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::operation.operation');

View file

@ -0,0 +1,7 @@
/**
* operation service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::operation.operation');

View file

@ -0,0 +1,58 @@
{
"kind": "collectionType",
"collectionName": "pages",
"info": {
"singularName": "page",
"pluralName": "pages",
"displayName": "Pages",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "uid",
"default": "slug",
"required": true
},
"hero": {
"type": "component",
"repeatable": false,
"pluginOptions": {
"i18n": {
"localized": true
}
},
"component": "shared.hero",
"required": true
},
"content": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "dynamiczone",
"components": [
"shared.list",
"dynamic-zone.full-text",
"dynamic-zone.emphasise-article",
"dynamic-zone.full-image",
"dynamic-zone.gallery",
"dynamic-zone.dual-column-text",
"dynamic-zone.column-image-text"
]
}
}
}

View file

@ -0,0 +1,7 @@
/**
* page controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::page.page');

View file

@ -0,0 +1,7 @@
/**
* page router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::page.page');

View file

@ -0,0 +1,7 @@
/**
* page service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::page.page');

View file

@ -0,0 +1,28 @@
{
"collectionName": "components_dynamic_zone_column_image_texts",
"info": {
"displayName": "Column_Image_Text",
"icon": "bulletList",
"description": ""
},
"options": {},
"attributes": {
"image": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"images"
]
},
"text": {
"type": "blocks",
"required": true
},
"image_left": {
"type": "boolean",
"default": true,
"required": true
}
}
}

View file

@ -0,0 +1,18 @@
{
"collectionName": "components_dynamic_zone_dual_column_texts",
"info": {
"displayName": "Dual_Column_Text",
"icon": "stack"
},
"options": {},
"attributes": {
"left_side": {
"type": "blocks",
"required": true
},
"right_side": {
"type": "blocks",
"required": true
}
}
}

View file

@ -0,0 +1,23 @@
{
"collectionName": "components_dynamic_zone_emphasise_articles",
"info": {
"displayName": "Emphasise_Article",
"icon": "dashboard",
"description": ""
},
"options": {},
"attributes": {
"articles": {
"type": "relation",
"relation": "oneToMany",
"target": "api::article.article"
},
"titel": {
"type": "string",
"required": true
},
"description": {
"type": "text"
}
}
}

View file

@ -0,0 +1,19 @@
{
"collectionName": "components_dynamic_zone_full_images",
"info": {
"displayName": "Full_Image",
"icon": "dashboard",
"description": ""
},
"options": {},
"attributes": {
"image": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"images"
]
}
}
}

View file

@ -0,0 +1,15 @@
{
"collectionName": "components_dynamic_zone_full_texts",
"info": {
"displayName": "Full_Text",
"icon": "dashboard",
"description": ""
},
"options": {},
"attributes": {
"text": {
"type": "blocks",
"required": true
}
}
}

View file

@ -0,0 +1,18 @@
{
"collectionName": "components_dynamic_zone_galleries",
"info": {
"displayName": "Gallery",
"icon": "apps"
},
"options": {},
"attributes": {
"images": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
}
}
}

View file

@ -0,0 +1,22 @@
{
"collectionName": "components_global_footers",
"info": {
"displayName": "Footer",
"icon": "apps",
"description": ""
},
"options": {},
"attributes": {
"copyright": {
"type": "string"
},
"designed_developed_by": {
"type": "string"
},
"links": {
"type": "component",
"repeatable": true,
"component": "shared.link"
}
}
}

View file

@ -0,0 +1,24 @@
{
"collectionName": "components_global_navbars",
"info": {
"displayName": "Navbar",
"icon": "bold",
"description": ""
},
"options": {},
"attributes": {
"logo": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
},
"navbar_items": {
"type": "component",
"repeatable": true,
"component": "items.navbar-items"
}
}
}

View file

@ -0,0 +1,30 @@
{
"collectionName": "components_items_left_navbar_items",
"info": {
"displayName": "Navbar_Items",
"icon": "bulletList",
"description": ""
},
"options": {},
"attributes": {
"name": {
"type": "string"
},
"URL": {
"type": "string"
},
"default_URL": {
"type": "string"
},
"page": {
"type": "relation",
"relation": "oneToOne",
"target": "api::page.page"
},
"navbar_sub_items": {
"type": "component",
"repeatable": true,
"component": "items.navbar-sub-items"
}
}
}

View file

@ -0,0 +1,24 @@
{
"collectionName": "components_items_navbar_sub_items",
"info": {
"displayName": "Navbar_Sub_Items",
"icon": "bulletList",
"description": ""
},
"options": {},
"attributes": {
"name": {
"type": "string",
"required": true
},
"URL": {
"type": "string",
"required": true
},
"page": {
"type": "relation",
"relation": "oneToOne",
"target": "api::page.page"
}
}
}

View file

@ -0,0 +1,22 @@
{
"collectionName": "components_shared_heroes",
"info": {
"displayName": "hero",
"icon": "rocket"
},
"options": {},
"attributes": {
"banner": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
},
"titel": {
"type": "string",
"required": true
}
}
}

View file

@ -0,0 +1,30 @@
{
"collectionName": "components_shared_links",
"info": {
"displayName": "Link",
"icon": "link",
"description": ""
},
"options": {},
"attributes": {
"text": {
"type": "string",
"required": true
},
"URL": {
"type": "string",
"required": true
},
"target": {
"type": "enumeration",
"enum": [
"_blank",
"_self",
"_parent",
"_top"
],
"default": "_self",
"required": true
}
}
}

View file

@ -0,0 +1,25 @@
{
"collectionName": "components_shared_lists",
"info": {
"displayName": "list",
"icon": "apps",
"description": ""
},
"options": {},
"attributes": {
"list": {
"type": "enumeration",
"enum": [
"articles",
"events",
"operations"
],
"required": true
},
"enable_detail": {
"type": "boolean",
"default": false,
"required": true
}
}
}

0
src/extensions/.gitkeep Normal file
View file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

20
src/index.ts Normal file
View file

@ -0,0 +1,20 @@
// import type { Core } from '@strapi/strapi';
export default {
/**
* An asynchronous register function that runs before
* your application is initialized.
*
* This gives you an opportunity to extend code.
*/
register(/* { strapi }: { strapi: Core.Strapi } */) {},
/**
* An asynchronous bootstrap function that runs before
* your application gets started.
*
* This gives you an opportunity to set up your data model,
* run jobs, or perform some special logic.
*/
bootstrap(/* { strapi }: { strapi: Core.Strapi } */) {},
};

View file

@ -0,0 +1,97 @@
/**
* `deepPopulate` middleware
*/
import type { Core } from '@strapi/strapi';
import { UID } from '@strapi/types';
import { contentTypes } from '@strapi/utils';
import pluralize from 'pluralize';
interface Options {
/**
* Fields to select when populating relations
*/
relationalFields?: string[];
}
const { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants;
const extractPathSegment = (url: string) => url.match(/\/([^/?]+)(?:\?|$)/)?.[1] || '';
const getDeepPopulate = (uid: UID.Schema, opts: Options = {}) => {
const model = strapi.getModel(uid);
const attributes = Object.entries(model.attributes);
return attributes.reduce((acc: any, [attributeName, attribute]) => {
switch (attribute.type) {
case 'relation': {
const isMorphRelation = attribute.relation.toLowerCase().startsWith('morph');
if (isMorphRelation) {
break;
}
// Ignore not visible fields other than createdBy and updatedBy
const isVisible = contentTypes.isVisibleAttribute(model, attributeName);
const isCreatorField = [CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE].includes(attributeName);
if (isVisible) {
if (attributeName === 'testimonials') {
acc[attributeName] = { populate: "user.image" };
} else {
acc[attributeName] = { populate: "*" };
}
}
break;
}
case 'media': {
acc[attributeName] = { populate: "*" };
break;
}
case 'component': {
const populate = getDeepPopulate(attribute.component, opts);
acc[attributeName] = { populate };
break;
}
case 'dynamiczone': {
// Use fragments to populate the dynamic zone components
const populatedComponents = (attribute.components || []).reduce(
(acc: any, componentUID: UID.Component) => {
acc[componentUID] = { populate: getDeepPopulate(componentUID, opts) };
return acc;
},
{}
);
acc[attributeName] = { on: populatedComponents };
break;
}
default:
break;
}
return acc;
}, {});
};
export default (config, { strapi }: { strapi: Core.Strapi }) => {
return async (ctx, next) => {
if (ctx.request.url.startsWith('/api/') && ctx.request.method === 'GET' && !ctx.query.populate) {
strapi.log.info('Using custom Dynamic-Zone population Middleware...');
const contentType = extractPathSegment(ctx.request.url);
const singular = pluralize.singular(contentType)
const uid = `api::${singular}.${singular}`;
// @ts-ignores
ctx.query.populate = getDeepPopulate(uid);
}
await next();
};
};

43
tsconfig.json Normal file
View file

@ -0,0 +1,43 @@
{
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node",
"lib": ["ES2020"],
"target": "ES2019",
"strict": false,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"noEmitOnError": true,
"noImplicitThis": true,
"outDir": "dist",
"rootDir": "."
},
"include": [
// Include root files
"./",
// Include all ts files
"./**/*.ts",
// Include all js files
"./**/*.js",
// Force the JSON files in the src folder to be included
"src/**/*.json"
],
"exclude": [
"node_modules/",
"build/",
"dist/",
".cache/",
".tmp/",
// Do not include admin files in the server compilation
"src/admin/",
// Do not include test files
"**/*.test.*",
// Do not include plugins in the server compilation
"src/plugins/**"
]
}

204
types/generated/components.d.ts vendored Normal file
View file

@ -0,0 +1,204 @@
import type { Schema, Struct } from '@strapi/strapi';
export interface DynamicZoneColumnImageText extends Struct.ComponentSchema {
collectionName: 'components_dynamic_zone_column_image_texts';
info: {
description: '';
displayName: 'Column_Image_Text';
icon: 'bulletList';
};
attributes: {
image: Schema.Attribute.Media<'images'> & Schema.Attribute.Required;
image_left: Schema.Attribute.Boolean &
Schema.Attribute.Required &
Schema.Attribute.DefaultTo<true>;
text: Schema.Attribute.Blocks & Schema.Attribute.Required;
};
}
export interface DynamicZoneDualColumnText extends Struct.ComponentSchema {
collectionName: 'components_dynamic_zone_dual_column_texts';
info: {
displayName: 'Dual_Column_Text';
icon: 'stack';
};
attributes: {
left_side: Schema.Attribute.Blocks & Schema.Attribute.Required;
right_side: Schema.Attribute.Blocks & Schema.Attribute.Required;
};
}
export interface DynamicZoneEmphasiseArticle extends Struct.ComponentSchema {
collectionName: 'components_dynamic_zone_emphasise_articles';
info: {
description: '';
displayName: 'Emphasise_Article';
icon: 'dashboard';
};
attributes: {
articles: Schema.Attribute.Relation<'oneToMany', 'api::article.article'>;
description: Schema.Attribute.Text;
titel: Schema.Attribute.String & Schema.Attribute.Required;
};
}
export interface DynamicZoneFullImage extends Struct.ComponentSchema {
collectionName: 'components_dynamic_zone_full_images';
info: {
description: '';
displayName: 'Full_Image';
icon: 'dashboard';
};
attributes: {
image: Schema.Attribute.Media<'images'> & Schema.Attribute.Required;
};
}
export interface DynamicZoneFullText extends Struct.ComponentSchema {
collectionName: 'components_dynamic_zone_full_texts';
info: {
description: '';
displayName: 'Full_Text';
icon: 'dashboard';
};
attributes: {
text: Schema.Attribute.Blocks & Schema.Attribute.Required;
};
}
export interface DynamicZoneGallery extends Struct.ComponentSchema {
collectionName: 'components_dynamic_zone_galleries';
info: {
displayName: 'Gallery';
icon: 'apps';
};
attributes: {
images: Schema.Attribute.Media<'images'> & Schema.Attribute.Required;
};
}
export interface GlobalFooter extends Struct.ComponentSchema {
collectionName: 'components_global_footers';
info: {
description: '';
displayName: 'Footer';
icon: 'apps';
};
attributes: {
copyright: Schema.Attribute.String;
designed_developed_by: Schema.Attribute.String;
links: Schema.Attribute.Component<'shared.link', true>;
};
}
export interface GlobalNavbar extends Struct.ComponentSchema {
collectionName: 'components_global_navbars';
info: {
description: '';
displayName: 'Navbar';
icon: 'bold';
};
attributes: {
logo: Schema.Attribute.Media<'images'> & Schema.Attribute.Required;
navbar_items: Schema.Attribute.Component<'items.navbar-items', true>;
};
}
export interface ItemsNavbarItems extends Struct.ComponentSchema {
collectionName: 'components_items_left_navbar_items';
info: {
description: '';
displayName: 'Navbar_Items';
icon: 'bulletList';
};
attributes: {
default_URL: Schema.Attribute.String;
name: Schema.Attribute.String;
navbar_sub_items: Schema.Attribute.Component<
'items.navbar-sub-items',
true
>;
page: Schema.Attribute.Relation<'oneToOne', 'api::page.page'>;
URL: Schema.Attribute.String;
};
}
export interface ItemsNavbarSubItems extends Struct.ComponentSchema {
collectionName: 'components_items_navbar_sub_items';
info: {
description: '';
displayName: 'Navbar_Sub_Items';
icon: 'bulletList';
};
attributes: {
name: Schema.Attribute.String & Schema.Attribute.Required;
page: Schema.Attribute.Relation<'oneToOne', 'api::page.page'>;
URL: Schema.Attribute.String & Schema.Attribute.Required;
};
}
export interface SharedHero extends Struct.ComponentSchema {
collectionName: 'components_shared_heroes';
info: {
displayName: 'hero';
icon: 'rocket';
};
attributes: {
banner: Schema.Attribute.Media<'images'> & Schema.Attribute.Required;
titel: Schema.Attribute.String & Schema.Attribute.Required;
};
}
export interface SharedLink extends Struct.ComponentSchema {
collectionName: 'components_shared_links';
info: {
description: '';
displayName: 'Link';
icon: 'link';
};
attributes: {
target: Schema.Attribute.Enumeration<
['_blank', '_self', '_parent', '_top']
> &
Schema.Attribute.Required &
Schema.Attribute.DefaultTo<'_self'>;
text: Schema.Attribute.String & Schema.Attribute.Required;
URL: Schema.Attribute.String & Schema.Attribute.Required;
};
}
export interface SharedList extends Struct.ComponentSchema {
collectionName: 'components_shared_lists';
info: {
description: '';
displayName: 'list';
icon: 'apps';
};
attributes: {
enable_detail: Schema.Attribute.Boolean &
Schema.Attribute.Required &
Schema.Attribute.DefaultTo<false>;
list: Schema.Attribute.Enumeration<['articles', 'events', 'operations']> &
Schema.Attribute.Required;
};
}
declare module '@strapi/strapi' {
export module Public {
export interface ComponentSchemas {
'dynamic-zone.column-image-text': DynamicZoneColumnImageText;
'dynamic-zone.dual-column-text': DynamicZoneDualColumnText;
'dynamic-zone.emphasise-article': DynamicZoneEmphasiseArticle;
'dynamic-zone.full-image': DynamicZoneFullImage;
'dynamic-zone.full-text': DynamicZoneFullText;
'dynamic-zone.gallery': DynamicZoneGallery;
'global.footer': GlobalFooter;
'global.navbar': GlobalNavbar;
'items.navbar-items': ItemsNavbarItems;
'items.navbar-sub-items': ItemsNavbarSubItems;
'shared.hero': SharedHero;
'shared.link': SharedLink;
'shared.list': SharedList;
}
}
}

1233
types/generated/contentTypes.d.ts vendored Normal file

File diff suppressed because it is too large Load diff