Commit ccaf9d52be3f55a01713393128bb04a6f9108b9c

Authored by ly525
Committed by 小小鲁班
1 parent fad25b88

chore: migrate strapi from 3.0.0-beta.13 to 3.0.0-beta.17.8

Too many changes to show.

To preserve performance only 7 of 8 files are displayed.

back-end/h5-api/api/work/controllers/Work.js
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2019-12-04 19:55:24 3 * @Date: 2019-12-04 19:55:24
4 * @LastEditors: ly525 4 * @LastEditors: ly525
5 - * @LastEditTime: 2019-12-14 21:34:57 5 + * @LastEditTime: 2019-12-15 18:56:44
6 * @FilePath: /luban-h5/back-end/h5-api/api/work/controllers/Work.js 6 * @FilePath: /luban-h5/back-end/h5-api/api/work/controllers/Work.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: 8 * @Description:
@@ -20,13 +20,12 @@ module.exports = { @@ -20,13 +20,12 @@ module.exports = {
20 // GET /previewOne 20 // GET /previewOne
21 // strapi-hook-ejs: https://github.com/strapi/strapi/tree/master/packages/strapi-hook-ejs 21 // strapi-hook-ejs: https://github.com/strapi/strapi/tree/master/packages/strapi-hook-ejs
22 previewOne: async (ctx) => { 22 previewOne: async (ctx) => {
23 - let work = await strapi.services.work.findOne(ctx.params);  
24 - work = work.toJSON(); 23 + const work = await strapi.services.work.findOne(ctx.params);
25 return ctx.render('engine', { work }); 24 return ctx.render('engine', { work });
26 }, 25 },
27 submitForm: async (ctx) => { 26 submitForm: async (ctx) => {
28 const work = await strapi.services.work.findOne(ctx.params); 27 const work = await strapi.services.work.findOne(ctx.params);
29 - const formData = ctx.request.body.fields; 28 + const formData = ctx.request.body;
30 // eslint-disable-next-line no-unused-vars 29 // eslint-disable-next-line no-unused-vars
31 const workform = await strapi.services.workform.create({ form: formData, work }); 30 const workform = await strapi.services.workform.create({ form: formData, work });
32 31
@@ -50,8 +49,7 @@ module.exports = { @@ -50,8 +49,7 @@ module.exports = {
50 return uuidMap2Name; 49 return uuidMap2Name;
51 } 50 }
52 51
53 - let work = await strapi.services.work.findOne(ctx.params);  
54 - work = work.toJSON(); 52 + const work = await strapi.services.work.findOne(ctx.params);
55 53
56 // learn the query from: https://github.com/strapi/foodadvisor/blob/master/api/api/restaurant/controllers/Restaurant.js#L40 54 // learn the query from: https://github.com/strapi/foodadvisor/blob/master/api/api/restaurant/controllers/Restaurant.js#L40
57 // eslint-disable-next-line no-undef 55 // eslint-disable-next-line no-undef
@@ -65,16 +63,14 @@ module.exports = { @@ -65,16 +63,14 @@ module.exports = {
65 return ctx.body = { uuidMap2Name, formRecords }; 63 return ctx.body = { uuidMap2Name, formRecords };
66 }, 64 },
67 setAsTemplate: async (ctx) => { 65 setAsTemplate: async (ctx) => {
68 - let work = await strapi.services.work.findOne(ctx.params);  
69 - work = work.toJSON(); 66 + const work = await strapi.services.work.findOne(ctx.params);
70 67
71 // eslint-disable-next-line no-unused-vars 68 // eslint-disable-next-line no-unused-vars
72 const templateWork = await strapi.services.work.create(); 69 const templateWork = await strapi.services.work.create();
73 return strapi.services.work.update({id: templateWork.id}, { pages: work.pages, is_template: true, cover_image_url: work.cover_image_url }); 70 return strapi.services.work.update({id: templateWork.id}, { pages: work.pages, is_template: true, cover_image_url: work.cover_image_url });
74 }, 71 },
75 useTemplate: async (ctx) => { 72 useTemplate: async (ctx) => {
76 - let templateWork = await strapi.services.work.findOne(ctx.params);  
77 - templateWork = templateWork.toJSON(); 73 + const templateWork = await strapi.services.work.findOne(ctx.params);
78 74
79 // eslint-disable-next-line no-unused-vars 75 // eslint-disable-next-line no-unused-vars
80 const work = await strapi.services.work.create(); 76 const work = await strapi.services.work.create();
back-end/h5-api/api/work/models/Work.settings.json
@@ -31,10 +31,6 @@ @@ -31,10 +31,6 @@
31 }, 31 },
32 "is_template": { 32 "is_template": {
33 "type": "boolean" 33 "type": "boolean"
34 - },  
35 - "workforms": {  
36 - "collection": "workform",  
37 - "via": "work"  
38 } 34 }
39 } 35 }
40 } 36 }
41 \ No newline at end of file 37 \ No newline at end of file
back-end/h5-api/api/workform/models/Workform.settings.json
@@ -7,7 +7,10 @@ @@ -7,7 +7,10 @@
7 }, 7 },
8 "options": { 8 "options": {
9 "increments": true, 9 "increments": true,
10 - "timestamps": true, 10 + "timestamps": [
  11 + "created_at",
  12 + "updated_at"
  13 + ],
11 "comment": "" 14 "comment": ""
12 }, 15 },
13 "attributes": { 16 "attributes": {
@@ -15,8 +18,7 @@ @@ -15,8 +18,7 @@
15 "type": "json" 18 "type": "json"
16 }, 19 },
17 "work": { 20 "work": {
18 - "model": "work",  
19 - "via": "workforms" 21 + "model": "work"
20 } 22 }
21 } 23 }
22 } 24 }
23 \ No newline at end of file 25 \ No newline at end of file
back-end/h5-api/config/environments/production/database.json
@@ -4,11 +4,22 @@ @@ -4,11 +4,22 @@
4 "default": { 4 "default": {
5 "connector": "strapi-hook-bookshelf", 5 "connector": "strapi-hook-bookshelf",
6 "settings": { 6 "settings": {
7 - "client": "sqlite",  
8 - "filename": ".tmp/data.db" 7 + "client": "mysql",
  8 + "host": "${process.env.DATABASE_HOST || 'localhost'}",
  9 + "port": "${process.env.DATABASE_PORT || '3306'}",
  10 + "database": "${process.env.DATABASE_NAME || 'lubanh5'}",
  11 + "username": "${process.env.DATABASE_USERNAME || ''}",
  12 + "password": "${process.env.DATABASE_PASSWORD || ''}"
9 }, 13 },
10 "options": { 14 "options": {
11 - "useNullAsDefault": true 15 + "debug": true,
  16 + "pool": {
  17 + "min": 0,
  18 + "max": 10,
  19 + "idleTimeoutMillis": 30000,
  20 + "createTimeoutMillis": 30000,
  21 + "acquireTimeoutMillis": 30000
  22 + }
12 } 23 }
13 } 24 }
14 } 25 }
back-end/h5-api/config/functions/bootstrap.js
@@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
6 * 6 *
7 * This gives you an opportunity to set up your data model, 7 * This gives you an opportunity to set up your data model,
8 * run jobs, or perform some special logic. 8 * run jobs, or perform some special logic.
  9 + *
  10 + * See more details here: https://strapi.io/documentation/3.0.0-beta.x/configurations/configurations.html#bootstrap
9 */ 11 */
10 12
11 -module.exports = cb => {  
12 - cb();  
13 -}; 13 +module.exports = () => {};
back-end/h5-api/config/hook.json
1 { 1 {
2 - "timeout": 3000, 2 + "timeout": 30000,
3 "load": { 3 "load": {
4 "before": [], 4 "before": [],
5 "order": [ 5 "order": [
back-end/h5-api/package.json
@@ -19,22 +19,22 @@ @@ -19,22 +19,22 @@
19 "eslint-plugin-react": "^7.14.0" 19 "eslint-plugin-react": "^7.14.0"
20 }, 20 },
21 "dependencies": { 21 "dependencies": {
22 - "knex": "latest",  
23 "lodash": "^4.17.5", 22 "lodash": "^4.17.5",
24 "psd": "^3.2.0", 23 "psd": "^3.2.0",
25 - "sqlite3": "latest",  
26 - "strapi": "3.0.0-beta.13",  
27 - "strapi-admin": "3.0.0-beta.13",  
28 - "strapi-hook-bookshelf": "3.0.0-beta.13",  
29 - "strapi-hook-ejs": "3.0.0-alpha.13",  
30 - "strapi-hook-knex": "3.0.0-beta.13",  
31 - "strapi-plugin-content-manager": "3.0.0-beta.13",  
32 - "strapi-plugin-content-type-builder": "3.0.0-beta.13",  
33 - "strapi-plugin-email": "3.0.0-beta.13",  
34 - "strapi-plugin-settings-manager": "3.0.0-beta.13",  
35 - "strapi-plugin-upload": "3.0.0-beta.13",  
36 - "strapi-plugin-users-permissions": "3.0.0-beta.13",  
37 - "strapi-utils": "3.0.0-beta.13" 24 + "strapi-hook-ejs": "3.0.0-beta.17.8",
  25 + "strapi": "3.0.0-beta.17.8",
  26 + "strapi-admin": "3.0.0-beta.17.8",
  27 + "strapi-utils": "3.0.0-beta.17.8",
  28 + "strapi-plugin-content-type-builder": "3.0.0-beta.17.8",
  29 + "strapi-plugin-content-manager": "3.0.0-beta.17.8",
  30 + "strapi-plugin-users-permissions": "3.0.0-beta.17.8",
  31 + "strapi-plugin-email": "3.0.0-beta.17.8",
  32 + "strapi-plugin-upload": "3.0.0-beta.17.8",
  33 + "strapi-hook-bookshelf": "3.0.0-beta.17.8",
  34 + "strapi-hook-knex": "3.0.0-beta.17.8",
  35 + "knex": "latest",
  36 + "mysql": "latest",
  37 + "sqlite3": "latest"
38 }, 38 },
39 "author": { 39 "author": {
40 "name": "A Strapi developer" 40 "name": "A Strapi developer"