strapi
This commit is contained in:
16
cms/Dockerfile
Normal file
16
cms/Dockerfile
Normal 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
13
cms/config/admin.ts
Normal 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
7
cms/config/api.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
rest: {
|
||||
defaultLimit: 25,
|
||||
maxLimit: 100,
|
||||
withCount: true,
|
||||
},
|
||||
};
|
||||
14
cms/config/database.ts
Normal file
14
cms/config/database.ts
Normal 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
10
cms/config/server.ts
Normal 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
39
cms/package.json
Normal 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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
cms/src/api/application/controllers/application.ts
Normal file
2
cms/src/api/application/controllers/application.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreController('api::application.application');
|
||||
2
cms/src/api/application/routes/application.ts
Normal file
2
cms/src/api/application/routes/application.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreRouter('api::application.application');
|
||||
2
cms/src/api/application/services/application.ts
Normal file
2
cms/src/api/application/services/application.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreService('api::application.application');
|
||||
39
cms/src/api/category/content-types/category/schema.json
Normal file
39
cms/src/api/category/content-types/category/schema.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
cms/src/api/category/controllers/category.ts
Normal file
2
cms/src/api/category/controllers/category.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreController('api::category.category');
|
||||
2
cms/src/api/category/routes/category.ts
Normal file
2
cms/src/api/category/routes/category.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreRouter('api::category.category');
|
||||
2
cms/src/api/category/services/category.ts
Normal file
2
cms/src/api/category/services/category.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreService('api::category.category');
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreController('api::contact-message.contact-message');
|
||||
2
cms/src/api/contact-message/routes/contact-message.ts
Normal file
2
cms/src/api/contact-message/routes/contact-message.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreRouter('api::contact-message.contact-message');
|
||||
2
cms/src/api/contact-message/services/contact-message.ts
Normal file
2
cms/src/api/contact-message/services/contact-message.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreService('api::contact-message.contact-message');
|
||||
44
cms/src/api/job/content-types/job/schema.json
Normal file
44
cms/src/api/job/content-types/job/schema.json
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
cms/src/api/job/controllers/job.ts
Normal file
2
cms/src/api/job/controllers/job.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreController('api::job.job');
|
||||
2
cms/src/api/job/routes/job.ts
Normal file
2
cms/src/api/job/routes/job.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreRouter('api::job.job');
|
||||
2
cms/src/api/job/services/job.ts
Normal file
2
cms/src/api/job/services/job.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreService('api::job.job');
|
||||
80
cms/src/api/product/content-types/product/schema.json
Normal file
80
cms/src/api/product/content-types/product/schema.json
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
cms/src/api/product/controllers/product.ts
Normal file
2
cms/src/api/product/controllers/product.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreController('api::product.product');
|
||||
2
cms/src/api/product/routes/product.ts
Normal file
2
cms/src/api/product/routes/product.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreRouter('api::product.product');
|
||||
2
cms/src/api/product/services/product.ts
Normal file
2
cms/src/api/product/services/product.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreService('api::product.product');
|
||||
42
cms/src/api/setting/content-types/setting/schema.json
Normal file
42
cms/src/api/setting/content-types/setting/schema.json
Normal 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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
2
cms/src/api/setting/controllers/setting.ts
Normal file
2
cms/src/api/setting/controllers/setting.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreController('api::setting.setting');
|
||||
2
cms/src/api/setting/routes/setting.ts
Normal file
2
cms/src/api/setting/routes/setting.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreRouter('api::setting.setting');
|
||||
2
cms/src/api/setting/services/setting.ts
Normal file
2
cms/src/api/setting/services/setting.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import { factories } from '@strapi/strapi';
|
||||
export default factories.createCoreService('api::setting.setting');
|
||||
18
cms/src/index.ts
Normal file
18
cms/src/index.ts
Normal 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
22
cms/tsconfig.json
Normal 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/**"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user