strapi-plugin-comments 1.0.2-beta.1 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/.circleci/config.yml +2 -2
  2. package/README.md +71 -95
  3. package/admin/src/components/ConfirmationDialog/index.js +56 -0
  4. package/admin/src/components/DiscussionStatus/index.js +33 -0
  5. package/admin/src/components/DiscussionThread/index.js +58 -0
  6. package/admin/src/components/DiscussionThreadItem/index.js +87 -0
  7. package/admin/src/components/DiscussionThreadItem/styles.js +87 -0
  8. package/admin/src/components/DiscussionThreadItemActions/index.js +176 -0
  9. package/admin/src/components/DiscussionThreadItemActions/styles.js +22 -0
  10. package/admin/src/components/DiscussionThreadItemMeta/index.js +31 -0
  11. package/admin/src/components/DiscussionThreadItemWarnings/index.js +137 -0
  12. package/admin/src/components/DiscussionThreadItemWarnings/styles.js +7 -0
  13. package/admin/src/components/EntityDetails/index.js +53 -0
  14. package/admin/src/{containers → components}/Initializer/index.js +4 -4
  15. package/admin/src/components/LoadingIndicatorOverlay/index.js +15 -0
  16. package/admin/src/components/LoadingIndicatorOverlay/styles.js +20 -0
  17. package/admin/src/components/Nav/index.js +45 -0
  18. package/admin/src/components/PluginIcon/index.js +12 -0
  19. package/admin/src/components/ReportsReviewModal/index.js +45 -0
  20. package/admin/src/components/ReportsReviewTable/index.js +142 -0
  21. package/admin/src/components/TableFilters/index.js +53 -0
  22. package/admin/src/components/TablePagination/index.js +35 -0
  23. package/admin/src/components/icons/comments.js +9 -0
  24. package/admin/src/index.js +58 -42
  25. package/admin/src/pages/App/index.js +60 -0
  26. package/admin/src/pages/App/reducer/actions.js +8 -0
  27. package/admin/src/pages/App/reducer/constants.js +4 -0
  28. package/admin/src/pages/App/reducer/index.js +27 -0
  29. package/admin/src/pages/App/reducer/init.js +7 -0
  30. package/admin/src/pages/App/reducer/selectors.js +35 -0
  31. package/admin/src/pages/App/utils/api.js +20 -0
  32. package/admin/src/pages/ComingSoonPage/index.js +25 -0
  33. package/admin/src/pages/Details/index.js +109 -0
  34. package/admin/src/pages/Details/utils/api.js +41 -0
  35. package/admin/src/pages/Discover/index.js +203 -0
  36. package/admin/src/pages/Discover/utils/api.js +20 -0
  37. package/admin/src/pages/Discover/utils/filtersSchema.js +9 -0
  38. package/admin/src/permissions.js +13 -33
  39. package/admin/src/pluginId.js +2 -4
  40. package/admin/src/reducers.js +8 -0
  41. package/admin/src/translations/en.json +72 -33
  42. package/admin/src/translations/fr.json +1 -0
  43. package/admin/src/utils/axiosInstance.js +35 -0
  44. package/admin/src/utils/constants.js +28 -0
  45. package/admin/src/utils/getApiUrl.js +5 -0
  46. package/admin/src/utils/getMessage.js +14 -0
  47. package/admin/src/utils/getRelatedGroups.js +5 -0
  48. package/admin/src/utils/getUrl.js +5 -0
  49. package/admin/src/utils/handleAPIError.js +15 -0
  50. package/admin/src/utils/index.js +6 -0
  51. package/codecov.yml +2 -1
  52. package/content-types/comment.js +97 -0
  53. package/content-types/index.js +11 -0
  54. package/content-types/report.js +54 -0
  55. package/package.json +11 -25
  56. package/server/bootstrap.js +5 -0
  57. package/server/config/index.js +10 -0
  58. package/server/controllers/admin.js +134 -0
  59. package/server/controllers/client.js +109 -0
  60. package/server/controllers/index.js +9 -0
  61. package/{controllers → server/controllers}/utils/__tests__/functions.test.js +0 -0
  62. package/{controllers → server/controllers}/utils/functions.js +1 -1
  63. package/server/destroy.js +5 -0
  64. package/server/index.js +22 -0
  65. package/server/register.js +5 -0
  66. package/server/routes/admin.js +92 -0
  67. package/server/routes/client.js +52 -0
  68. package/server/routes/index.js +15 -0
  69. package/server/services/admin.js +186 -0
  70. package/server/services/client.js +227 -0
  71. package/server/services/common.js +191 -0
  72. package/server/services/index.js +11 -0
  73. package/{services → server/services}/utils/__tests__/functions.test.js +7 -9
  74. package/{services → server/services}/utils/functions.js +19 -8
  75. package/server/utils/constants.js +16 -0
  76. package/{services → server}/utils/error.js +0 -0
  77. package/server/utils/functions.js +19 -0
  78. package/strapi-admin.js +3 -0
  79. package/strapi-server.js +9 -0
  80. package/admin/src/assets/images/icon-cross-blue.svg +0 -1
  81. package/admin/src/assets/images/icon_remove.svg +0 -19
  82. package/admin/src/assets/images/logo.svg +0 -5
  83. package/admin/src/components/AbuseReportsPopUp/ItemPreviewContainer.js +0 -8
  84. package/admin/src/components/AbuseReportsPopUp/ModalFooter.js +0 -31
  85. package/admin/src/components/AbuseReportsPopUp/TableContainer.js +0 -63
  86. package/admin/src/components/AbuseReportsPopUp/index.js +0 -148
  87. package/admin/src/components/Container/index.js +0 -7
  88. package/admin/src/components/EmptyView/index.js +0 -25
  89. package/admin/src/components/Filters/index.js +0 -151
  90. package/admin/src/components/Filters/index.styled.js +0 -82
  91. package/admin/src/components/Filters/utils.js +0 -21
  92. package/admin/src/components/Item/CardItem.js +0 -30
  93. package/admin/src/components/Item/CardWrapper.js +0 -10
  94. package/admin/src/components/Item/index.js +0 -92
  95. package/admin/src/components/ItemDetails/CardItem.js +0 -33
  96. package/admin/src/components/ItemDetails/CardLevelCounter.js +0 -46
  97. package/admin/src/components/ItemDetails/CardLevelCounterLink.js +0 -24
  98. package/admin/src/components/ItemDetails/CardLevelWrapper.js +0 -22
  99. package/admin/src/components/ItemDetails/CardWrapper.js +0 -52
  100. package/admin/src/components/ItemDetails/index.js +0 -151
  101. package/admin/src/components/ItemFooter/CardItemAuthor.js +0 -10
  102. package/admin/src/components/ItemFooter/CardItemRelation.js +0 -18
  103. package/admin/src/components/ItemFooter/Wrapper.js +0 -20
  104. package/admin/src/components/ItemFooter/index.js +0 -87
  105. package/admin/src/components/ItemHeader/CardHeaderBlocked.js +0 -24
  106. package/admin/src/components/ItemHeader/CardHeaderIndicator.js +0 -30
  107. package/admin/src/components/ItemHeader/CardHeaderIndicatorBlue.js +0 -11
  108. package/admin/src/components/ItemHeader/CardHeaderIndicatorRed.js +0 -11
  109. package/admin/src/components/ItemHeader/CardHeaderIndicatorsContainer.js +0 -18
  110. package/admin/src/components/ItemHeader/CardHeaderReports.js +0 -40
  111. package/admin/src/components/ItemHeader/Wrapper.js +0 -16
  112. package/admin/src/components/ItemHeader/index.js +0 -80
  113. package/admin/src/components/ItemModeration/Wrapper.js +0 -19
  114. package/admin/src/components/ItemModeration/index.js +0 -47
  115. package/admin/src/components/List/Container.js +0 -20
  116. package/admin/src/components/List/index.js +0 -21
  117. package/admin/src/components/Search/index.js +0 -83
  118. package/admin/src/containers/App/Wrapper.js +0 -14
  119. package/admin/src/containers/App/index.js +0 -47
  120. package/admin/src/containers/DataManagerProvider/actions.js +0 -11
  121. package/admin/src/containers/DataManagerProvider/index.js +0 -280
  122. package/admin/src/containers/DataManagerProvider/init.js +0 -5
  123. package/admin/src/containers/DataManagerProvider/reducer.js +0 -59
  124. package/admin/src/containers/DetailsView/Wrapper.js +0 -18
  125. package/admin/src/containers/DetailsView/index.js +0 -100
  126. package/admin/src/containers/ListView/FadedWrapper.js +0 -42
  127. package/admin/src/containers/ListView/Footer.js +0 -53
  128. package/admin/src/containers/ListView/Wrapper.js +0 -17
  129. package/admin/src/containers/ListView/components.js +0 -138
  130. package/admin/src/containers/ListView/index.js +0 -45
  131. package/admin/src/containers/Panel/actions.js +0 -5
  132. package/admin/src/containers/Panel/index.js +0 -191
  133. package/admin/src/containers/Panel/index.styled.js +0 -6
  134. package/admin/src/containers/Panel/reducer.js +0 -44
  135. package/admin/src/contexts/DataManagerContext.js +0 -5
  136. package/admin/src/hooks/useDataManager.js +0 -6
  137. package/admin/src/lifecycles.js +0 -3
  138. package/admin/src/translations/index.js +0 -7
  139. package/admin/src/utils/getTrad.js +0 -5
  140. package/admin/src/utils/getTradId.js +0 -5
  141. package/config/functions/bootstrap.js +0 -48
  142. package/config/routes.json +0 -116
  143. package/config/schema.graphql.js +0 -270
  144. package/controllers/comments.js +0 -211
  145. package/models/comment.js +0 -8
  146. package/models/comment.settings.json +0 -98
  147. package/models/report.js +0 -8
  148. package/models/report.settings.json +0 -49
  149. package/services/comments.js +0 -486
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Comments Collection Type
3
+ */
4
+
5
+ module.exports = {
6
+ info: {
7
+ tableName: 'plugin-comments-comments',
8
+ singularName: 'comment',
9
+ pluralName: 'comments',
10
+ displayName: 'Comment',
11
+ description: 'Comment content type',
12
+ kind: 'collectionType',
13
+ },
14
+ options: {
15
+ draftAndPublish: false,
16
+ },
17
+ pluginOptions: {
18
+ 'content-manager': {
19
+ visible: false
20
+ },
21
+ 'content-type-builder': {
22
+ visible: false
23
+ }
24
+ },
25
+ attributes: {
26
+ content: {
27
+ type: 'text',
28
+ configurable: false,
29
+ required: true
30
+ },
31
+ blocked: {
32
+ type: 'boolean',
33
+ default: false,
34
+ configurable: false
35
+ },
36
+ blockedThread: {
37
+ type: 'boolean',
38
+ default: false,
39
+ configurable: false
40
+ },
41
+ blockReason: {
42
+ type: 'string',
43
+ configurable: false
44
+ },
45
+ authorUser: {
46
+ type: 'relation',
47
+ relation: 'oneToOne',
48
+ target: 'plugin::users-permissions.user',
49
+ configurable: false,
50
+ },
51
+ authorType: {
52
+ type: 'string',
53
+ configurable: false
54
+ },
55
+ authorId: {
56
+ type: 'string',
57
+ configurable: false
58
+ },
59
+ authorName: {
60
+ type: 'string',
61
+ configurable: false
62
+ },
63
+ authorEmail: {
64
+ type: 'email',
65
+ configurable: false
66
+ },
67
+ authorAvatar: {
68
+ type: 'string',
69
+ configurable: false
70
+ },
71
+ removed: {
72
+ type: 'boolean',
73
+ configurable: false
74
+ },
75
+ approvalStatus: {
76
+ type: 'string',
77
+ configurable: false
78
+ },
79
+ related: {
80
+ type: 'string',
81
+ configurable: false
82
+ },
83
+ reports: {
84
+ type: 'relation',
85
+ relation: 'oneToMany',
86
+ target: 'plugin::comments.comment-report',
87
+ mappedBy: 'related',
88
+ configurable: false,
89
+ },
90
+ threadOf: {
91
+ type: 'relation',
92
+ relation: 'oneToOne',
93
+ target: 'plugin::comments.comment',
94
+ configurable: false,
95
+ },
96
+ },
97
+ };
@@ -0,0 +1,11 @@
1
+ const CommentCT = require('./comment');
2
+ const ReportCT = require('./report');
3
+
4
+ module.exports = {
5
+ 'comment': {
6
+ schema: CommentCT,
7
+ },
8
+ 'comment-report': {
9
+ schema: ReportCT,
10
+ },
11
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Comments Collection Type
3
+ */
4
+
5
+ module.exports = {
6
+ info: {
7
+ tableName: 'plugin-comments-reports',
8
+ singularName: 'comment-report',
9
+ pluralName: 'comment-reports',
10
+ displayName: 'Reports',
11
+ description: 'Reports content type',
12
+ kind: 'collectionType',
13
+ },
14
+ options: {
15
+ draftAndPublish: false,
16
+ },
17
+ pluginOptions: {
18
+ 'content-manager': {
19
+ visible: false
20
+ },
21
+ 'content-type-builder': {
22
+ visible: false
23
+ }
24
+ },
25
+ attributes: {
26
+ content: {
27
+ type: 'text',
28
+ configurable: false
29
+ },
30
+ reason: {
31
+ type: 'enumeration',
32
+ enum: [
33
+ 'BAD_LANGUAGE',
34
+ 'DISCRIMINATION',
35
+ 'OTHER'
36
+ ],
37
+ default: 'OTHER',
38
+ configurable: false,
39
+ required: true
40
+ },
41
+ resolved: {
42
+ type: 'boolean',
43
+ default: false,
44
+ configurable: false
45
+ },
46
+ related: {
47
+ type: 'relation',
48
+ relation: 'manyToOne',
49
+ target: 'plugin::comments.comment',
50
+ inversedBy: 'reports',
51
+ configurable: false,
52
+ },
53
+ },
54
+ };
package/package.json CHANGED
@@ -1,41 +1,27 @@
1
1
  {
2
2
  "name": "strapi-plugin-comments",
3
- "version": "1.0.2-beta.1",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "Strapi - Comments plugin",
5
5
  "strapi": {
6
- "name": "Comments",
7
- "icon": "comments",
8
- "description": "Comments & audience engagement"
6
+ "name": "comments",
7
+ "description": "Comments & audience engagement",
8
+ "kind": "plugin"
9
+ },
10
+ "scripts": {
11
+ "test:unit": "jest --verbose --coverage"
9
12
  },
10
13
  "repository": {
11
14
  "type": "git",
12
15
  "url": "https://github.com/VirtusLab-Open-Source/strapi-plugin-comments"
13
16
  },
14
- "scripts": {
15
- "test:unit": "jest --verbose --coverage"
16
- },
17
17
  "dependencies": {
18
- "bad-words": "^3.0.3",
19
- "lodash": "^4.17.11",
20
- "react": "^16.9.0",
21
- "react-dom": "^16.9.0",
22
- "react-intl": "4.5.0",
23
- "react-redux": "^7.0.2",
24
- "react-router": "^5.0.0",
25
- "react-router-dom": "^5.0.0",
26
- "reactstrap": "8.4.1",
27
- "redux-saga": "^0.16.0",
28
- "request": "^2.83.0",
29
- "strapi-helper-plugin": "3.6.5",
30
- "strapi-utils": "3.6.5",
31
- "uuid": "^3.1.0"
18
+ "bad-words": "^3.0.4"
32
19
  },
33
20
  "devDependencies": {
34
- "koa": "^2.8.0",
21
+ "codecov": "^3.7.2",
35
22
  "jest": "^26.0.1",
36
23
  "jest-cli": "^26.0.1",
37
- "jest-styled-components": "^7.0.2",
38
- "codecov": "^3.7.2"
24
+ "jest-styled-components": "^7.0.2"
39
25
  },
40
26
  "author": {
41
27
  "name": "VirtusLab // Mateusz Ziarko",
@@ -55,7 +41,7 @@
55
41
  }
56
42
  ],
57
43
  "engines": {
58
- "node": ">=10.16.0",
44
+ "node": ">=12.x. <=16.x.x",
59
45
  "npm": ">=6.0.0"
60
46
  },
61
47
  "keywords": ["strapi", "plugin", "comments"],
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = ({ strapi }) => {
4
+ // bootstrap phase
5
+ };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ default: {
5
+ entryLabel: {
6
+ '*': ['Title', 'title', 'Name', 'name', 'Subject', 'subject']
7
+ }
8
+ },
9
+ validator() {},
10
+ };
@@ -0,0 +1,134 @@
1
+ 'use strict';
2
+
3
+ const { getPluginService } = require('./../utils/functions');
4
+ const { parseParams, throwError } = require('./utils/functions');
5
+ const _ = require('lodash');
6
+
7
+ module.exports = {
8
+
9
+ getService(name = 'admin') {
10
+ return getPluginService(name);
11
+ },
12
+
13
+ async findAll(ctx) {
14
+ return this.getService()
15
+ .findAll(ctx.query);
16
+ },
17
+
18
+ async findOne(ctx) {
19
+ const { params = {} } = ctx;
20
+ const { id } = parseParams(params);
21
+ try {
22
+ return await this.getService()
23
+ .findOneAndThread(id);
24
+ } catch (e) {
25
+ throwError(ctx, e);
26
+ }
27
+ },
28
+
29
+ async blockComment(ctx) {
30
+ const { params = {} } = ctx;
31
+ const { id } = parseParams(params);
32
+ try {
33
+ return await this.getService()
34
+ .blockComment(id, true);
35
+ } catch (e) {
36
+ throwError(ctx, e);
37
+ }
38
+ },
39
+
40
+ async unblockComment(ctx) {
41
+ const { params = {} } = ctx;
42
+ const { id } = parseParams(params);
43
+ try {
44
+ return await this.getService()
45
+ .blockComment(id, false);
46
+ } catch (e) {
47
+ throwError(ctx, e);
48
+ }
49
+ },
50
+
51
+ async blockCommentThread(ctx) {
52
+ const { params = {} } = ctx;
53
+ const { id } = parseParams(params);
54
+ try {
55
+ return await this.getService()
56
+ .blockCommentThread(id, true);
57
+ } catch (e) {
58
+ throwError(ctx, e);
59
+ }
60
+ },
61
+
62
+ async unblockCommentThread(ctx) {
63
+ const { params = {} } = ctx;
64
+ const { id } = parseParams(params);
65
+ try {
66
+ return await this.getService()
67
+ .blockCommentThread(id, false);
68
+ } catch (e) {
69
+ throwError(ctx, e);
70
+ }
71
+ },
72
+
73
+ async resolveAbuseReport(ctx) {
74
+ const { params = {} } = ctx;
75
+ const { id: commentId, reportId } = parseParams(params);
76
+ try {
77
+ return await this.getService()
78
+ .resolveAbuseReport(reportId, commentId);
79
+ } catch (e) {
80
+ throwError(ctx, e);
81
+ }
82
+ },
83
+
84
+ async approveComment(ctx) {
85
+ const { id } = parseParams(ctx.params || {});
86
+ try {
87
+ return await this.getService()
88
+ .approveComment(id);
89
+ } catch (e) {
90
+ throwError(ctx, e);
91
+ }
92
+ },
93
+
94
+ async rejectComment(ctx) {
95
+ const { id } = parseParams(ctx.params || {});
96
+ try {
97
+ return await this.getService()
98
+ .rejectComment(id);
99
+ } catch (e) {
100
+ throwError(ctx, e);
101
+ }
102
+ },
103
+
104
+ async config() {
105
+ try {
106
+ return await this.getService().config();
107
+ } catch (e) {
108
+ throwError(ctx, e);
109
+ }
110
+ },
111
+
112
+ getContentsTypes() {
113
+ return Object.entries(strapi.contentTypes)
114
+ .filter(([, contentType]) => (
115
+ contentType.associations || []).some(_ => _.plugin === 'comments' && _.collection === 'comment'),
116
+ )
117
+ .reduce((acc, [, contentType]) => [
118
+ ...acc,
119
+ { key: contentType.globalName, value: contentType.collectionName }],
120
+ [],
121
+ );
122
+ },
123
+
124
+ async contentTypeName(ctx) {
125
+ const { params: { contentTypeName } } = ctx;
126
+ try {
127
+ const result = await this.getService()
128
+ .contentTypeName(contentTypeName);
129
+ return { list: result };
130
+ } catch (e) {
131
+ throwError(ctx, e);
132
+ }
133
+ },
134
+ };
@@ -0,0 +1,109 @@
1
+ 'use strict';
2
+
3
+ const { getPluginService } = require('./../utils/functions');
4
+ const { parseParams, throwError } = require('./utils/functions');
5
+ const _ = require('lodash');
6
+
7
+ module.exports = {
8
+
9
+ getService(name = 'client') {
10
+ return getPluginService(name);
11
+ },
12
+
13
+ async findAllFlat(ctx) {
14
+ const { params = {}, query } = ctx;
15
+ const { relation } = parseParams(params);
16
+ try {
17
+ return this.getService('common')
18
+ .findAllFlat({
19
+ ...query,
20
+ related: relation,
21
+ });
22
+ } catch (e) {
23
+ throwError(ctx, e);
24
+ }
25
+ },
26
+
27
+ async findAllInHierarchy(ctx) {
28
+ const { params = {}, query } = ctx;
29
+ const { relation } = parseParams(params);
30
+ try {
31
+ return await this.getService('common')
32
+ .findAllInHierarchy({
33
+ query: {
34
+ ...query,
35
+ related: relation,
36
+ },
37
+ dropBlockedThreads: true,
38
+ });
39
+ } catch (e) {
40
+ throwError(ctx, e);
41
+ }
42
+ },
43
+
44
+ async post(ctx) {
45
+ const { request, params = {}, state = {} } = ctx;
46
+ const { relation } = parseParams(params);
47
+ const { user } = state;
48
+ const { body = {} } = request;
49
+ try {
50
+ const entity = await this.getService()
51
+ .create(relation, body, user);
52
+
53
+ if (entity) {
54
+ return entity;
55
+ }
56
+ } catch (e) {
57
+ throwError(ctx, e);
58
+ }
59
+ },
60
+
61
+ async put(ctx) {
62
+ const { request, state, params = {} } = ctx;
63
+ const { body = {} } = request;
64
+ const { user } = state;
65
+ const { commentId, relation } = parseParams(params);
66
+ try {
67
+ return await this.getService()
68
+ .update(commentId, relation, body, user);
69
+ } catch (e) {
70
+ throwError(ctx, e);
71
+ }
72
+ },
73
+
74
+ async reportAbuse(ctx) {
75
+ const { request, state, params = {} } = ctx;
76
+ const { body = {} } = request;
77
+ if (!body.content) {
78
+ return ctx.badRequest(null, 'Content field is required');
79
+ }
80
+ const { user } = state;
81
+ const { relation, commentId } = parseParams(params);
82
+ try {
83
+ return await this.getService()
84
+ .reportAbuse(commentId, relation, body, user);
85
+ } catch (e) {
86
+ throwError(ctx, e);
87
+ }
88
+ },
89
+
90
+ async removeComment(ctx) {
91
+ const { params: { relationId, commentId }, query: { authorId } } = ctx;
92
+ if (authorId) {
93
+ try {
94
+ return await this.getService()
95
+ .markAsRemoved(
96
+ relationId,
97
+ commentId,
98
+ authorId,
99
+ );
100
+ } catch (e) {
101
+ if (!e.isBoom) {
102
+ throwError(ctx, e);
103
+ }
104
+ throw e;
105
+ }
106
+ }
107
+ return ctx.badRequest('Not provided authorId');
108
+ },
109
+ };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const adminController = require('./admin');
4
+ const clientController = require('./client');
5
+
6
+ module.exports = {
7
+ admin: adminController,
8
+ client: clientController,
9
+ };
@@ -1,4 +1,4 @@
1
- const PluginError = require('../../services/utils/error');
1
+ const PluginError = require('./../../utils/error');
2
2
 
3
3
  module.exports = {
4
4
  parseParams: params => Object.keys(params).reduce((prev, curr) => {
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = ({ strapi }) => {
4
+ // destroy phase
5
+ };
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const register = require('./register');
4
+ const bootstrap = require('./bootstrap');
5
+ const destroy = require('./destroy');
6
+ const config = require('./config');
7
+ const controllers = require('./controllers');
8
+ const routes = require('./routes');
9
+ const services = require('./services');
10
+
11
+ module.exports = {
12
+ register,
13
+ bootstrap,
14
+ destroy,
15
+ config,
16
+ controllers,
17
+ routes,
18
+ services,
19
+ contentTypes: {},
20
+ policies: {},
21
+ middlewares: {},
22
+ };
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = ({ strapi }) => {
4
+ // registeration phase
5
+ };
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+
3
+ module.exports = [
4
+ {
5
+ method: 'GET',
6
+ path: '/moderate/config',
7
+ handler: 'admin.config',
8
+ config: {
9
+ policies: [],
10
+ },
11
+ },
12
+ {
13
+ method: 'GET',
14
+ path: '/moderate/config/content-types/:contentTypeName',
15
+ handler: 'admin.contentTypeName',
16
+ config: {
17
+ policies: [],
18
+ },
19
+ },
20
+ {
21
+ method: 'GET',
22
+ path: '/moderate/all',
23
+ handler: 'admin.findAll',
24
+ config: {
25
+ policies: [],
26
+ },
27
+ },
28
+ {
29
+ method: 'GET',
30
+ path: '/moderate/single/:id',
31
+ handler: 'admin.findOne',
32
+ config: {
33
+ policies: [],
34
+ },
35
+ },
36
+ {
37
+ method: 'PATCH',
38
+ path: '/moderate/single/:id/approve',
39
+ handler: 'admin.approveComment',
40
+ config: {
41
+ policies: [],
42
+ },
43
+ },
44
+ {
45
+ method: 'PATCH',
46
+ path: '/moderate/single/:id/reject',
47
+ handler: 'admin.rejectComment',
48
+ config: {
49
+ policies: [],
50
+ },
51
+ },
52
+ {
53
+ method: 'PATCH',
54
+ path: '/moderate/single/:id/block',
55
+ handler: 'admin.blockComment',
56
+ config: {
57
+ policies: [],
58
+ },
59
+ },
60
+ {
61
+ method: 'PATCH',
62
+ path: '/moderate/single/:id/unblock',
63
+ handler: 'admin.unblockComment',
64
+ config: {
65
+ policies: [],
66
+ },
67
+ },
68
+ {
69
+ method: 'PATCH',
70
+ path: '/moderate/single/:id/report/:reportId/resolve',
71
+ handler: 'admin.resolveAbuseReport',
72
+ config: {
73
+ policies: [],
74
+ },
75
+ },
76
+ {
77
+ method: 'PATCH',
78
+ path: '/moderate/thread/:id/block',
79
+ handler: 'admin.blockCommentThread',
80
+ config: {
81
+ policies: [],
82
+ },
83
+ },
84
+ {
85
+ method: 'PATCH',
86
+ path: '/moderate/thread/:id/unblock',
87
+ handler: 'admin.unblockCommentThread',
88
+ config: {
89
+ policies: [],
90
+ },
91
+ },
92
+ ];
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ module.exports = [
4
+ {
5
+ method: 'GET',
6
+ path: '/:relation',
7
+ handler: 'client.findAllInHierarchy',
8
+ config: {
9
+ policies: [],
10
+ },
11
+ },
12
+ {
13
+ method: 'POST',
14
+ path: '/:relation',
15
+ handler: 'client.post',
16
+ config: {
17
+ policies: [],
18
+ },
19
+ },
20
+ {
21
+ method: 'GET',
22
+ path: '/:relation/flat',
23
+ handler: 'client.findAllFlat',
24
+ config: {
25
+ policies: [],
26
+ },
27
+ },
28
+ {
29
+ method: 'PUT',
30
+ path: '/:relation/comment/:commentId',
31
+ handler: 'client.put',
32
+ config: {
33
+ policies: [],
34
+ },
35
+ },
36
+ {
37
+ method: 'POST',
38
+ path: '/:relation/comment/:commentId/report-abuse',
39
+ handler: 'client.reportAbuse',
40
+ config: {
41
+ policies: [],
42
+ },
43
+ },
44
+ {
45
+ method: 'DELETE',
46
+ path: '/:relationId/comment/:commentId',
47
+ handler: 'client.removeComment',
48
+ config: {
49
+ policies: [],
50
+ },
51
+ },
52
+ ];
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ const clientRoutes = require('./client');
4
+ const adminRoutes = require('./admin');
5
+
6
+ module.exports = {
7
+ 'content-api': {
8
+ type: 'content-api',
9
+ routes: clientRoutes,
10
+ },
11
+ admin: {
12
+ type: 'admin',
13
+ routes: adminRoutes,
14
+ },
15
+ };