This commit is contained in:
2026-01-29 19:47:55 +01:00
parent 506c8682fe
commit be9f9cf483
42 changed files with 756 additions and 2 deletions

16
cms/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM node:20-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
WORKDIR /opt/
COPY package.json ./
RUN npm install -g node-gyp
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . .
RUN NODE_ENV=production npm run build
EXPOSE 1337
CMD ["npm", "run", "develop"]

13
cms/config/admin.ts Normal file
View File

@@ -0,0 +1,13 @@
export default ({ env }) => ({
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
apiToken: {
salt: env('API_TOKEN_SALT'),
},
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
});

7
cms/config/api.ts Normal file
View File

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

14
cms/config/database.ts Normal file
View File

@@ -0,0 +1,14 @@
export default ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: env('DATABASE_HOST', '127.0.0.1'),
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),
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
});

10
cms/config/server.ts Normal file
View File

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

39
cms/package.json Normal file
View File

@@ -0,0 +1,39 @@
{
"name": "klz-cms",
"private": true,
"version": "0.1.0",
"description": "Strapi CMS for KLZ Cables",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"dependencies": {
"@strapi/strapi": "4.25.11",
"@strapi/plugin-users-permissions": "4.25.11",
"@strapi/plugin-i18n": "4.25.11",
"pg": "8.11.3",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^5.2.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@types/node": "^18.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^5.0.0"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "klz-cms"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}

View File

@@ -0,0 +1,38 @@
{
"kind": "collectionType",
"collectionName": "applications",
"info": {
"singularName": "application",
"pluralName": "applications",
"displayName": "Application"
},
"options": {
"draftAndPublish": false
},
"attributes": {
"job": {
"type": "relation",
"relation": "manyToOne",
"target": "api::job.job"
},
"name": {
"type": "string",
"required": true
},
"email": {
"type": "email",
"required": true
},
"resume": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"files"
]
},
"message": {
"type": "text"
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::application.application');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::application.application');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::application.application');

View File

@@ -0,0 +1,39 @@
{
"kind": "collectionType",
"collectionName": "categories",
"info": {
"singularName": "category",
"pluralName": "categories",
"displayName": "Category"
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"name": {
"type": "string",
"required": true,
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"slug": {
"type": "uid",
"targetField": "name",
"required": true
},
"products": {
"type": "relation",
"relation": "manyToMany",
"target": "api::product.product",
"mappedBy": "categories"
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::category.category');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::category.category');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::category.category');

View File

@@ -0,0 +1,29 @@
{
"kind": "collectionType",
"collectionName": "contact_messages",
"info": {
"singularName": "contact-message",
"pluralName": "contact-messages",
"displayName": "Contact Message"
},
"options": {
"draftAndPublish": false
},
"attributes": {
"name": {
"type": "string",
"required": true
},
"email": {
"type": "email",
"required": true
},
"subject": {
"type": "string"
},
"message": {
"type": "text",
"required": true
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::contact-message.contact-message');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::contact-message.contact-message');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::contact-message.contact-message');

View File

@@ -0,0 +1,44 @@
{
"kind": "collectionType",
"collectionName": "jobs",
"info": {
"singularName": "job",
"pluralName": "jobs",
"displayName": "Job"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"required": true,
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"description": {
"type": "richtext",
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"location": {
"type": "string",
"pluginOptions": {
"i18n": {
"localized": true
}
}
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::job.job');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::job.job');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::job.job');

View File

@@ -0,0 +1,80 @@
{
"kind": "collectionType",
"collectionName": "products",
"info": {
"singularName": "product",
"pluralName": "products",
"displayName": "Product",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"required": true,
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"sku": {
"type": "uid",
"targetField": "title",
"required": true
},
"description": {
"type": "text",
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"application": {
"type": "text",
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"content": {
"type": "richtext",
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"images": {
"type": "media",
"multiple": true,
"required": false,
"allowedTypes": [
"images"
]
},
"categories": {
"type": "relation",
"relation": "manyToMany",
"target": "api::category.category",
"inversedBy": "products"
},
"technicalData": {
"type": "json",
"pluginOptions": {
"i18n": {
"localized": true
}
}
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::product.product');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::product.product');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::product.product');

View File

@@ -0,0 +1,42 @@
{
"kind": "singleType",
"collectionName": "settings",
"info": {
"singularName": "setting",
"pluralName": "settings",
"displayName": "Setting"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"siteName": {
"type": "string",
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"siteDescription": {
"type": "text",
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"logo": {
"type": "media",
"multiple": false,
"allowedTypes": [
"images"
]
}
}
}

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::setting.setting');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::setting.setting');

View File

@@ -0,0 +1,2 @@
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::setting.setting');

18
cms/src/index.ts Normal file
View File

@@ -0,0 +1,18 @@
export default {
/**
* An asynchronous register function that runs before
* your application is initialized.
*
* This gives you an opportunity to extend code.
*/
register(/*{ 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 }*/) {},
};

22
cms/tsconfig.json Normal file
View File

@@ -0,0 +1,22 @@
{
"extends": "@strapi/typescript-utils/tsconfigs/server",
"compilerOptions": {
"outDir": "dist",
"rootDir": "."
},
"include": [
"src/**/*.ts",
"config/**/*.ts",
"src/**/*.tsx"
],
"exclude": [
"node_modules/",
"build/",
"dist/",
".cache/",
".tmp/",
"src/admin/",
"**/*.test.ts",
"src/plugins/**"
]
}