base config

This commit is contained in:
Julian Krauser 2024-10-30 14:50:13 +01:00
parent 578aca62e5
commit 3cc3a60046
46 changed files with 18085 additions and 45 deletions

View file

@ -1,7 +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=

View file

@ -9,4 +9,5 @@ export default [
'strapi::session',
'strapi::favicon',
'strapi::public',
'global::deepPopulate'
];

6124
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,11 @@
"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",

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
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

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();
};
};

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