Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node-terminal",
"name": "Run Script: develop",
"request": "launch",
"command": "yarn run develop",
"cwd": "${workspaceFolder}"
}
]
}
118 changes: 72 additions & 46 deletions src/api/global-setting/content-types/global-setting/schema.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,72 @@
{
"kind": "collectionType",
"collectionName": "global_settings",
"info": {
"singularName": "global-setting",
"pluralName": "global-settings",
"displayName": "Global Settings",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"pages": {
"type": "relation",
"relation": "oneToMany",
"target": "api::page.page"
},
"site": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "enumeration",
"enum": ["cloud", "dotnet"],
"default": "dotnet",
"required": true
},
"Socials": {
"type": "component",
"repeatable": true,
"pluginOptions": {
"i18n": {
"localized": false
}
},
"component": "elements.social"
}
}
}
{
"kind": "collectionType",
"collectionName": "global_settings",
"info": {
"singularName": "global-setting",
"pluralName": "global-settings",
"displayName": "Global Settings",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"pages": {
"type": "relation",
"relation": "oneToMany",
"target": "api::page.page"
},
"site": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "enumeration",
"enum": [
"cloud",
"dotnet"
],
"default": "dotnet",
"required": true
},
"socials": {
"type": "component",
"repeatable": true,
"pluginOptions": {
"i18n": {
"localized": false
}
},
"component": "elements.social"
},
"algemeneVoorwaarden": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"straat": {
"type": "string",
"required": true
},
"postcode": {
"type": "string",
"required": true
},
"gemeente": {
"type": "string",
"required": true
}
}
}
31 changes: 31 additions & 0 deletions src/api/global-setting/middlewares/global-setting-populate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';

/**
* `global-setting-populate` middleware
*/

const populate = {
pages: {
fields: ['title_website', 'slug']
},
algemeneVoorwaarden: {
fields: ['url'],
},
socials: {
populate: {
icon: {
fields: ['url'],
},
},
}
}


module.exports = (config, { strapi }) => {
return async (ctx, next) => {
strapi.log.info('In global-setting-populate middleware.');
ctx.query.populate = populate;

await next();
};
};
12 changes: 7 additions & 5 deletions src/api/global-setting/routes/global-setting.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

/**
* global-setting router
*/

const { createCoreRouter } = require('@strapi/strapi').factories;

module.exports = createCoreRouter('api::global-setting.global-setting');
module.exports = createCoreRouter('api::global-setting.global-setting', {
config: {
find: {
middlewares: ['api::global-setting.global-setting-populate'],
},
},
});
55 changes: 32 additions & 23 deletions src/components/elements/social.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
{
"collectionName": "components_elements_socials",
"info": {
"displayName": "Social",
"icon": "heart"
},
"options": {},
"attributes": {
"title": {
"type": "string",
"required": true
},
"isEnabled": {
"type": "boolean",
"default": false,
"required": true
},
"link": {
"type": "string",
"required": true
}
}
}
{
"collectionName": "components_elements_socials",
"info": {
"displayName": "Social",
"icon": "heart",
"description": ""
},
"options": {},
"attributes": {
"title": {
"type": "string",
"required": true
},
"isEnabled": {
"type": "boolean",
"default": false,
"required": true
},
"link": {
"type": "string",
"required": true
},
"icon": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
}
}
}
2 changes: 2 additions & 0 deletions types/generated/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ export interface ElementsListItemWithIcon extends Struct.ComponentSchema {
export interface ElementsSocial extends Struct.ComponentSchema {
collectionName: 'components_elements_socials';
info: {
description: '';
displayName: 'Social';
icon: 'heart';
};
attributes: {
icon: Schema.Attribute.Media<'images'> & Schema.Attribute.Required;
isEnabled: Schema.Attribute.Boolean &
Schema.Attribute.Required &
Schema.Attribute.DefaultTo<false>;
Expand Down
9 changes: 8 additions & 1 deletion types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,21 @@ export interface ApiGlobalSettingGlobalSetting
};
};
attributes: {
algemeneVoorwaarden: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
> &
Schema.Attribute.Required;
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
gemeente: Schema.Attribute.String & Schema.Attribute.Required;
locale: Schema.Attribute.String;
localizations: Schema.Attribute.Relation<
'oneToMany',
'api::global-setting.global-setting'
>;
pages: Schema.Attribute.Relation<'oneToMany', 'api::page.page'>;
postcode: Schema.Attribute.String & Schema.Attribute.Required;
publishedAt: Schema.Attribute.DateTime;
site: Schema.Attribute.Enumeration<['cloud', 'dotnet']> &
Schema.Attribute.Required &
Expand All @@ -571,12 +577,13 @@ export interface ApiGlobalSettingGlobalSetting
};
}> &
Schema.Attribute.DefaultTo<'dotnet'>;
Socials: Schema.Attribute.Component<'elements.social', true> &
socials: Schema.Attribute.Component<'elements.social', true> &
Schema.Attribute.SetPluginOptions<{
i18n: {
localized: false;
};
}>;
straat: Schema.Attribute.String & Schema.Attribute.Required;
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
Expand Down