diff --git a/docker-compose.yml b/docker-compose.yml index f2cf211..e43f878 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,13 @@ services: ports: - "6379:6379" + gs-meili: + image: "getmeili/meilisearch" + ports: + - "7700:7700" + environment: + - MEILI_MASTER_KEY=GuitarMasterKeys + gs_redis_commander: image: rediscommander/redis-commander:latest environment: diff --git a/package-lock.json b/package-lock.json index 19cd5b9..a1c3045 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "mysql": "2.18.1", "pg": "8.8.0", "strapi-plugin-import-export-entries": "1.18.0", + "strapi-plugin-meilisearch": "^0.9.1", "strapi-plugin-menus": "1.2.1", "strapi-plugin-populate-deep": "1.1.2" }, @@ -6950,6 +6951,14 @@ "yarn": ">=1" } }, + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dependencies": { + "node-fetch": "2.6.7" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -11209,6 +11218,14 @@ "node": ">= 0.6" } }, + "node_modules/meilisearch": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/meilisearch/-/meilisearch-0.30.0.tgz", + "integrity": "sha512-3y1hALOwTDpquYar+gDREqRasFPWKxkWAhk6h+RF+nKObPVf9N77wcTNvukGwOKbxRyJnKge0OPgAB1BkB9VVw==", + "dependencies": { + "cross-fetch": "^3.1.5" + } + }, "node_modules/memfs": { "version": "3.4.13", "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.4.13.tgz", @@ -15472,6 +15489,18 @@ "@strapi/strapi": "^4.0.0" } }, + "node_modules/strapi-plugin-meilisearch": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/strapi-plugin-meilisearch/-/strapi-plugin-meilisearch-0.9.1.tgz", + "integrity": "sha512-kSZjqYJuuXulqPsIc1ZcpCG7xNbYfCYCNDNRN6CI/aisWFL65dQYVG7HkVOAaJfxdUaboFKNu9c5R1hzbtJwTQ==", + "dependencies": { + "@strapi/utils": "^4.5.4", + "meilisearch": "^0.30.0" + }, + "engines": { + "npm": ">=6.0.0" + } + }, "node_modules/strapi-plugin-menus": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/strapi-plugin-menus/-/strapi-plugin-menus-1.2.1.tgz", diff --git a/package.json b/package.json index 2cc72af..3d3f265 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build": "strapi build", "strapi": "strapi", "build:staging": "npm run build", - "postbuild:staging": "node scripts/strapi/build-staging.js" + "generate:staging": "node scripts/strapi/build-staging.js" }, "dependencies": { "@strapi/plugin-i18n": "4.6.0", @@ -22,6 +22,7 @@ "mysql": "2.18.1", "pg": "8.8.0", "strapi-plugin-import-export-entries": "1.18.0", + "strapi-plugin-meilisearch": "^0.9.1", "strapi-plugin-menus": "1.2.1", "strapi-plugin-populate-deep": "1.1.2" }, diff --git a/scripts/strapi/build-staging.js b/scripts/strapi/build-staging.js index d6ae3cd..bd04bfb 100644 --- a/scripts/strapi/build-staging.js +++ b/scripts/strapi/build-staging.js @@ -2,8 +2,8 @@ const fs = require('fs'); const fse = require('fs-extra'); const path = require('path'); -fse.copySync(path.join(__dirname, '..', '..', 'apps/backend/public'), path.join(__dirname, '..', '..', 'dist', 'apps', 'backend/public')); -fs.copyFileSync(path.join(__dirname, '..', '..', 'apps/backend/.env.staging'), path.join(__dirname, '..', '..', 'dist', 'apps', 'backend/.env')); -fs.copyFileSync(path.join(__dirname, 'sources/server.js'), path.join(__dirname, '..', '..', 'dist', 'apps', 'backend/server.js')); -fs.copyFileSync(path.join(__dirname, 'sources/package.json'), path.join(__dirname, '..', '..', 'dist', 'apps', 'backend/package.json')); -fs.copyFileSync(path.join(__dirname, 'sources/.strapi-updater.json'), path.join(__dirname, '..', '..', 'dist', 'apps', 'backend/.strapi-updater.json')); +fse.copySync(path.join(__dirname, '..', '..', 'public'), path.join(__dirname, '..', '..', 'dist', 'strapi', 'public')); +fs.copyFileSync(path.join(__dirname, '..', '..', '.env.staging'), path.join(__dirname, '..', '..', 'dist', 'strapi', '.env')); +fs.copyFileSync(path.join(__dirname, 'sources/server.js'), path.join(__dirname, '..', '..', 'dist', 'strapi', 'server.js')); +fs.copyFileSync(path.join(__dirname, 'sources/package.json'), path.join(__dirname, '..', '..', 'dist', 'strapi', 'package.json')); +fs.copyFileSync(path.join(__dirname, 'sources/.strapi-updater.json'), path.join(__dirname, '..', '..', 'dist', 'strapi', '.strapi-updater.json')); diff --git a/scripts/strapi/sources/package.json b/scripts/strapi/sources/package.json index b44ac8d..2c8afce 100644 --- a/scripts/strapi/sources/package.json +++ b/scripts/strapi/sources/package.json @@ -5,15 +5,16 @@ "@strapi/strapi": "4.5.4" }, "dependencies": { - "@strapi/plugin-i18n": "4.5.4", - "@strapi/plugin-users-permissions": "4.5.4", + "@strapi/plugin-i18n": "4.6.0", + "@strapi/plugin-users-permissions": "4.6.0", "@strapi/provider-email-nodemailer": "4.5.6", - "@strapi/strapi": "4.5.4", + "@strapi/strapi": "^4.6.0", "@strapi/utils": "4.5.6", "better-sqlite3": "7.4.6", "mysql": "2.18.1", "pg": "8.8.0", "strapi-plugin-import-export-entries": "1.18.0", + "strapi-plugin-meilisearch": "^0.9.1", "strapi-plugin-menus": "1.2.1", "strapi-plugin-populate-deep": "1.1.2" }, diff --git a/src/api/article/content-types/article/schema.json b/src/api/article/content-types/article/schema.json new file mode 100644 index 0000000..7950aea --- /dev/null +++ b/src/api/article/content-types/article/schema.json @@ -0,0 +1,51 @@ +{ + "kind": "collectionType", + "collectionName": "articles", + "info": { + "singularName": "article", + "pluralName": "articles", + "displayName": "Article", + "description": "" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "title": { + "type": "string" + }, + "description": { + "type": "text" + }, + "content": { + "type": "richtext" + }, + "slug": { + "type": "uid", + "targetField": "title" + }, + "category": { + "type": "relation", + "relation": "manyToOne", + "target": "api::category.category", + "inversedBy": "articles" + }, + "image": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": false + }, + "author": { + "type": "relation", + "relation": "manyToOne", + "target": "api::writer.writer", + "inversedBy": "articles" + } + } +} diff --git a/src/api/article/controllers/article.ts b/src/api/article/controllers/article.ts new file mode 100644 index 0000000..f87024d --- /dev/null +++ b/src/api/article/controllers/article.ts @@ -0,0 +1,7 @@ +/** + * article controller + */ + +import { factories } from '@strapi/strapi' + +export default factories.createCoreController('api::article.article'); diff --git a/src/api/article/routes/article.ts b/src/api/article/routes/article.ts new file mode 100644 index 0000000..5c36ce3 --- /dev/null +++ b/src/api/article/routes/article.ts @@ -0,0 +1,7 @@ +/** + * article router + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::article.article'); diff --git a/src/api/article/services/article.ts b/src/api/article/services/article.ts new file mode 100644 index 0000000..29e9d27 --- /dev/null +++ b/src/api/article/services/article.ts @@ -0,0 +1,7 @@ +/** + * article service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::article.article'); diff --git a/src/api/category/content-types/category/schema.json b/src/api/category/content-types/category/schema.json new file mode 100644 index 0000000..6361f78 --- /dev/null +++ b/src/api/category/content-types/category/schema.json @@ -0,0 +1,39 @@ +{ + "kind": "collectionType", + "collectionName": "categories", + "info": { + "singularName": "category", + "pluralName": "categories", + "displayName": "Category", + "description": "" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string" + }, + "slug": { + "type": "uid", + "targetField": "name" + }, + "articles": { + "type": "relation", + "relation": "oneToMany", + "target": "api::article.article", + "mappedBy": "category" + }, + "image": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": false + } + } +} diff --git a/src/api/category/controllers/category.ts b/src/api/category/controllers/category.ts new file mode 100644 index 0000000..4f9f521 --- /dev/null +++ b/src/api/category/controllers/category.ts @@ -0,0 +1,7 @@ +/** + * category controller + */ + +import { factories } from '@strapi/strapi' + +export default factories.createCoreController('api::category.category'); diff --git a/src/api/category/routes/category.ts b/src/api/category/routes/category.ts new file mode 100644 index 0000000..29daf72 --- /dev/null +++ b/src/api/category/routes/category.ts @@ -0,0 +1,7 @@ +/** + * category router + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::category.category'); diff --git a/src/api/category/services/category.ts b/src/api/category/services/category.ts new file mode 100644 index 0000000..b4d79e2 --- /dev/null +++ b/src/api/category/services/category.ts @@ -0,0 +1,7 @@ +/** + * category service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::category.category'); diff --git a/src/api/writer/content-types/writer/schema.json b/src/api/writer/content-types/writer/schema.json new file mode 100644 index 0000000..5542ef9 --- /dev/null +++ b/src/api/writer/content-types/writer/schema.json @@ -0,0 +1,37 @@ +{ + "kind": "collectionType", + "collectionName": "writers", + "info": { + "singularName": "writer", + "pluralName": "writers", + "displayName": "Writer" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string" + }, + "picture": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": false + }, + "articles": { + "type": "relation", + "relation": "oneToMany", + "target": "api::article.article", + "mappedBy": "author" + }, + "email": { + "type": "string" + } + } +} diff --git a/src/api/writer/controllers/writer.ts b/src/api/writer/controllers/writer.ts new file mode 100644 index 0000000..76494d2 --- /dev/null +++ b/src/api/writer/controllers/writer.ts @@ -0,0 +1,7 @@ +/** + * writer controller + */ + +import { factories } from '@strapi/strapi' + +export default factories.createCoreController('api::writer.writer'); diff --git a/src/api/writer/routes/writer.ts b/src/api/writer/routes/writer.ts new file mode 100644 index 0000000..24b8389 --- /dev/null +++ b/src/api/writer/routes/writer.ts @@ -0,0 +1,7 @@ +/** + * writer router + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::writer.writer'); diff --git a/src/api/writer/services/writer.ts b/src/api/writer/services/writer.ts new file mode 100644 index 0000000..aeab1c3 --- /dev/null +++ b/src/api/writer/services/writer.ts @@ -0,0 +1,7 @@ +/** + * writer service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::writer.writer'); diff --git a/tsconfig.json b/tsconfig.json index b9532e3..fa8b4f5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "@strapi/typescript-utils/tsconfigs/server", "compilerOptions": { - "outDir": "dist", + "outDir": "dist/strapi/dist", "rootDir": "." }, "include": [