strapi-plugin-comments 2.0.10 → 2.1.0
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.
- package/README.md +204 -124
- package/admin/src/components/ActionButton/styles.d.ts +2 -0
- package/admin/src/components/ActionButton/styles.js +13 -8
- package/admin/src/components/Avatar/index.d.ts +12 -0
- package/admin/src/components/Avatar/index.js +26 -0
- package/admin/src/components/ConfirmationDialog/index.d.ts +26 -0
- package/admin/src/components/ConfirmationDialog/index.js +36 -55
- package/admin/src/components/DiscussionStatus/index.d.ts +9 -0
- package/admin/src/components/DiscussionStatus/index.js +22 -31
- package/admin/src/components/DiscussionThread/index.d.ts +16 -0
- package/admin/src/components/DiscussionThread/index.js +39 -56
- package/admin/src/components/DiscussionThreadItem/index.d.ts +9 -0
- package/admin/src/components/DiscussionThreadItem/index.js +28 -52
- package/admin/src/components/DiscussionThreadItem/styles.d.ts +4 -0
- package/admin/src/components/DiscussionThreadItem/styles.js +16 -11
- package/admin/src/components/DiscussionThreadItemActions/index.d.ts +19 -0
- package/admin/src/components/DiscussionThreadItemActions/index.js +121 -158
- package/admin/src/components/DiscussionThreadItemActions/styles.d.ts +2 -0
- package/admin/src/components/DiscussionThreadItemActions/styles.js +13 -7
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +17 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +38 -48
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +2 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +12 -6
- package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +16 -0
- package/admin/src/components/DiscussionThreadItemFooter/index.js +34 -42
- package/admin/src/components/DiscussionThreadItemFooter/styles.d.ts +3 -0
- package/admin/src/components/DiscussionThreadItemFooter/styles.js +17 -12
- package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +30 -0
- package/admin/src/components/DiscussionThreadItemReviewAction/index.js +77 -91
- package/admin/src/components/FormSwitch/index.d.ts +7 -0
- package/admin/src/components/FormSwitch/index.js +15 -18
- package/admin/src/components/FormSwitch/styles.d.ts +2 -0
- package/admin/src/components/FormSwitch/styles.js +14 -8
- package/admin/src/components/IconButton/styles.d.ts +2 -0
- package/admin/src/components/IconButton/styles.js +16 -9
- package/admin/src/components/Initializer/index.d.ts +5 -0
- package/admin/src/components/Initializer/index.js +12 -24
- package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +3 -0
- package/admin/src/components/LoadingIndicatorOverlay/index.js +12 -15
- package/admin/src/components/LoadingIndicatorOverlay/styles.d.ts +3 -0
- package/admin/src/components/LoadingIndicatorOverlay/styles.js +22 -17
- package/admin/src/components/Nav/index.d.ts +7 -0
- package/admin/src/components/Nav/index.js +25 -48
- package/admin/src/components/PluginIcon/index.d.ts +3 -0
- package/admin/src/components/PluginIcon/index.js +10 -12
- package/admin/src/components/ReportsReviewModal/index.d.ts +21 -0
- package/admin/src/components/ReportsReviewModal/index.js +31 -46
- package/admin/src/components/ReportsReviewTable/index.d.ts +21 -0
- package/admin/src/components/ReportsReviewTable/index.js +120 -140
- package/admin/src/components/StatusBadge/index.d.ts +7 -0
- package/admin/src/components/StatusBadge/index.js +12 -17
- package/admin/src/components/StatusBadge/styles.d.ts +2 -0
- package/admin/src/components/StatusBadge/styles.js +19 -13
- package/admin/src/components/TableFilters/index.d.ts +10 -0
- package/admin/src/components/TableFilters/index.js +52 -49
- package/admin/src/components/TablePagination/index.d.ts +17 -0
- package/admin/src/components/TablePagination/index.js +27 -29
- package/admin/src/components/icons/comments.d.ts +6 -0
- package/admin/src/components/icons/comments.js +11 -8
- package/admin/src/components/icons/index.d.ts +6 -0
- package/admin/src/components/icons/index.js +15 -6
- package/admin/src/components/icons/lock.d.ts +7 -0
- package/admin/src/components/icons/lock.js +11 -21
- package/admin/src/components/icons/review.d.ts +7 -0
- package/admin/src/components/icons/review.js +11 -17
- package/admin/src/components/icons/unlock.d.ts +7 -0
- package/admin/src/components/icons/unlock.js +11 -19
- package/admin/src/hooks/useConfig.d.ts +8 -0
- package/admin/src/hooks/useConfig.js +40 -45
- package/admin/src/index.d.ts +7 -0
- package/admin/src/index.js +98 -92
- package/admin/src/pages/App/index.d.ts +4 -0
- package/admin/src/pages/App/index.js +43 -67
- package/admin/src/pages/App/reducer/actions.d.ts +8 -0
- package/admin/src/pages/App/reducer/actions.js +11 -7
- package/admin/src/pages/App/reducer/constants.d.ts +4 -0
- package/admin/src/pages/App/reducer/constants.js +7 -4
- package/admin/src/pages/App/reducer/index.d.ts +9 -0
- package/admin/src/pages/App/reducer/index.js +24 -22
- package/admin/src/pages/App/reducer/init.d.ts +3 -0
- package/admin/src/pages/App/reducer/init.js +6 -4
- package/admin/src/pages/App/reducer/selectors.d.ts +6 -0
- package/admin/src/pages/App/reducer/selectors.js +17 -34
- package/admin/src/pages/App/utils/api.d.ts +2 -0
- package/admin/src/pages/App/utils/api.js +14 -11
- package/admin/src/pages/ComingSoonPage/index.d.ts +3 -0
- package/admin/src/pages/ComingSoonPage/index.js +42 -24
- package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +18 -0
- package/admin/src/pages/Details/components/DetailsEntity/index.js +49 -77
- package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +12 -0
- package/admin/src/pages/Details/components/DetailsFilters/index.js +19 -26
- package/admin/src/pages/Details/components/DetailsFilters/styles.d.ts +2 -0
- package/admin/src/pages/Details/components/DetailsFilters/styles.js +14 -8
- package/admin/src/pages/Details/index.d.ts +4 -0
- package/admin/src/pages/Details/index.js +94 -133
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +20 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +128 -139
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +2 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +14 -8
- package/admin/src/pages/Discover/index.d.ts +4 -0
- package/admin/src/pages/Discover/index.js +129 -170
- package/admin/src/pages/Discover/utils/api.d.ts +2 -0
- package/admin/src/pages/Discover/utils/api.js +15 -13
- package/admin/src/pages/Discover/utils/filtersSchema.d.ts +11 -0
- package/admin/src/pages/Discover/utils/filtersSchema.js +8 -6
- package/admin/src/pages/Settings/components/RestartAlert/styles.d.ts +2 -0
- package/admin/src/pages/Settings/components/RestartAlert/styles.js +14 -8
- package/admin/src/pages/Settings/index.d.ts +3 -0
- package/admin/src/pages/Settings/index.js +225 -391
- package/admin/src/pages/Settings/utils/api.d.ts +7 -0
- package/admin/src/pages/Settings/utils/api.js +60 -55
- package/admin/src/pages/utils/api.d.ts +12 -0
- package/admin/src/pages/utils/api.js +58 -53
- package/admin/src/permissions.d.ts +28 -0
- package/admin/src/permissions.js +31 -17
- package/admin/src/pluginId.d.ts +2 -0
- package/admin/src/pluginId.js +29 -5
- package/admin/src/reducers.d.ts +7 -0
- package/admin/src/reducers.js +10 -6
- package/admin/src/translations/en.json +131 -131
- package/admin/src/translations/fr.json +132 -1
- package/admin/src/translations/pt-BR.json +130 -130
- package/admin/src/utils/axiosInstance.d.ts +3 -0
- package/admin/src/utils/axiosInstance.js +21 -27
- package/admin/src/utils/constants.d.ts +25 -0
- package/admin/src/utils/constants.js +23 -22
- package/admin/src/utils/getApiUrl.d.ts +3 -0
- package/admin/src/utils/getApiUrl.js +6 -5
- package/admin/src/utils/getMessage.d.ts +4 -0
- package/admin/src/utils/getMessage.js +15 -15
- package/admin/src/utils/getRelatedGroups.d.ts +4 -0
- package/admin/src/utils/getRelatedGroups.js +5 -3
- package/admin/src/utils/getUrl.d.ts +3 -0
- package/admin/src/utils/getUrl.js +6 -5
- package/admin/src/utils/handleAPIError.d.ts +4 -0
- package/admin/src/utils/handleAPIError.js +12 -11
- package/admin/src/utils/index.d.ts +12 -0
- package/admin/src/utils/index.js +29 -11
- package/admin/src/utils/parseRegExp.d.ts +6 -0
- package/admin/src/utils/parseRegExp.js +6 -5
- package/admin/src/utils/renderEntryTitle.d.ts +4 -0
- package/admin/src/utils/renderEntryTitle.js +11 -12
- package/admin/src/utils/renderInitials.d.ts +3 -0
- package/admin/src/utils/renderInitials.js +10 -5
- package/admin/src/utils/resolveCommentStatus.d.ts +4 -0
- package/admin/src/utils/resolveCommentStatus.js +17 -21
- package/admin/src/utils/resolveCommentStatusColor.d.ts +4 -0
- package/admin/src/utils/resolveCommentStatusColor.js +19 -19
- package/content-types/comment.d.ts +91 -0
- package/content-types/comment.js +87 -88
- package/content-types/index.d.ts +143 -0
- package/content-types/index.js +15 -10
- package/content-types/report.d.ts +48 -0
- package/content-types/report.js +44 -49
- package/package.json +24 -19
- package/permissions.d.ts +18 -0
- package/permissions.js +12 -13
- package/server/bootstrap.d.ts +4 -0
- package/server/bootstrap.js +56 -62
- package/server/config/index.d.ts +4 -0
- package/server/config/index.js +17 -15
- package/server/controllers/admin.d.ts +4 -0
- package/server/controllers/admin.js +134 -167
- package/server/controllers/client.d.ts +4 -0
- package/server/controllers/client.js +120 -112
- package/server/controllers/index.d.ts +6 -0
- package/server/controllers/index.js +12 -8
- package/server/controllers/utils/functions.d.ts +7 -0
- package/server/controllers/utils/functions.js +22 -17
- package/server/controllers/utils/parsers.d.ts +10 -0
- package/server/controllers/utils/parsers.js +47 -19
- package/server/destroy.d.ts +3 -0
- package/server/destroy.js +3 -4
- package/server/graphql/index.d.ts +4 -0
- package/server/graphql/index.js +27 -25
- package/server/graphql/mutations/createAbuseReport.d.ts +11 -0
- package/server/graphql/mutations/createAbuseReport.js +22 -24
- package/server/graphql/mutations/createComment.d.ts +14 -0
- package/server/graphql/mutations/createComment.js +22 -24
- package/server/graphql/mutations/index.d.ts +4 -0
- package/server/graphql/mutations/index.js +24 -19
- package/server/graphql/mutations/removeComment.d.ts +11 -0
- package/server/graphql/mutations/removeComment.js +22 -24
- package/server/graphql/mutations/updateComment.d.ts +11 -0
- package/server/graphql/mutations/updateComment.js +22 -24
- package/server/graphql/queries/findAllFlat.d.ts +19 -0
- package/server/graphql/queries/findAllFlat.js +36 -34
- package/server/graphql/queries/findAllInHierarchy.d.ts +17 -0
- package/server/graphql/queries/findAllInHierarchy.js +30 -30
- package/server/graphql/queries/index.d.ts +4 -0
- package/server/graphql/queries/index.js +20 -17
- package/server/graphql/resolvers-config.d.ts +23 -0
- package/server/graphql/resolvers-config.js +11 -11
- package/server/graphql/types/comment-author.d.ts +4 -0
- package/server/graphql/types/comment-author.js +10 -8
- package/server/graphql/types/comment-nested.d.ts +4 -0
- package/server/graphql/types/comment-nested.js +17 -15
- package/server/graphql/types/comment.d.ts +4 -0
- package/server/graphql/types/comment.js +16 -14
- package/server/graphql/types/create-comment-author.d.ts +4 -0
- package/server/graphql/types/create-comment-author.js +10 -8
- package/server/graphql/types/create-comment.d.ts +4 -0
- package/server/graphql/types/create-comment.js +10 -8
- package/server/graphql/types/create-report.d.ts +4 -0
- package/server/graphql/types/create-report.js +10 -8
- package/server/graphql/types/id.d.ts +4 -0
- package/server/graphql/types/id.js +24 -23
- package/server/graphql/types/identify-comment-author.d.ts +4 -0
- package/server/graphql/types/identify-comment-author.js +7 -5
- package/server/graphql/types/index.d.ts +4 -0
- package/server/graphql/types/index.js +36 -17
- package/server/graphql/types/remove-comment.d.ts +4 -0
- package/server/graphql/types/remove-comment.js +9 -7
- package/server/graphql/types/report-reason.d.ts +4 -0
- package/server/graphql/types/report-reason.js +10 -8
- package/server/graphql/types/report.d.ts +4 -0
- package/server/graphql/types/report.js +12 -10
- package/server/graphql/types/response-find-all.d.ts +4 -0
- package/server/graphql/types/response-find-all.js +8 -6
- package/server/graphql/types/response-meta.d.ts +4 -0
- package/server/graphql/types/response-meta.js +7 -5
- package/server/graphql/types/response-pagination.d.ts +4 -0
- package/server/graphql/types/response-pagination.js +12 -10
- package/server/graphql/types/update-comment.d.ts +4 -0
- package/server/graphql/types/update-comment.js +10 -8
- package/server/index.d.ts +26 -0
- package/server/index.js +24 -21
- package/server/register.d.ts +3 -0
- package/server/register.js +3 -4
- package/server/routes/admin.d.ts +4 -0
- package/server/routes/admin.js +103 -109
- package/server/routes/client.d.ts +4 -0
- package/server/routes/client.js +84 -46
- package/server/routes/index.d.ts +11 -0
- package/server/routes/index.js +18 -14
- package/server/services/admin.d.ts +5 -0
- package/server/services/admin.js +134 -161
- package/server/services/client.d.ts +5 -0
- package/server/services/client.js +164 -168
- package/server/services/common.d.ts +5 -0
- package/server/services/common.js +192 -202
- package/server/services/graphql.d.ts +5 -0
- package/server/services/graphql.js +117 -182
- package/server/services/index.d.ts +8 -0
- package/server/services/index.js +15 -12
- package/server/services/utils/functions.d.ts +13 -0
- package/server/services/utils/functions.js +105 -109
- package/server/utils/constants.d.ts +9 -0
- package/server/utils/constants.js +19 -23
- package/server/utils/error.d.ts +19 -0
- package/server/utils/error.js +23 -18
- package/server/utils/functions.d.ts +6 -0
- package/server/utils/functions.js +35 -18
- package/strapi-admin.d.ts +3 -0
- package/strapi-admin.js +8 -3
- package/strapi-server.d.ts +177 -0
- package/strapi-server.js +43 -46
- package/tsconfig.tsbuildinfo +1 -0
- package/types/contentTypes.d.ts +48 -0
- package/types/contentTypes.js +3 -0
- package/.husky/pre-commit +0 -4
- package/LICENSE.md +0 -7
- package/__mocks__/initSetup.js +0 -108
- package/jest.config.js +0 -7
- package/server/controllers/utils/__tests__/functions.test.js +0 -43
- package/server/controllers/utils/__tests__/parsers.test.js +0 -94
- package/server/services/__tests__/common.test.js +0 -399
- package/server/services/utils/__tests__/functions.test.js +0 -53
- package/server/utils/__tests__/functions.test.js +0 -17
|
@@ -1,23 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flatInput = void 0;
|
|
4
|
+
const flatInput = (payload) => {
|
|
5
|
+
const { relation, query, sort, pagination, fields } = payload;
|
|
6
|
+
const { populate = {}, ...restQuery } = query;
|
|
7
|
+
const filters = restQuery?.filters || restQuery;
|
|
8
|
+
const orOperator = (filters?.$or || []).filter((_) => !Object.keys(_).includes("removed"));
|
|
9
|
+
let basePopulate = {
|
|
10
|
+
...populate,
|
|
11
|
+
};
|
|
12
|
+
let threadOfPopulate = {
|
|
13
|
+
threadOf: {
|
|
14
|
+
populate: {
|
|
15
|
+
authorUser: true,
|
|
16
|
+
...populate,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
if (populate.author) {
|
|
21
|
+
const { author, ...restPopulate } = populate;
|
|
22
|
+
basePopulate = {
|
|
23
|
+
...restPopulate,
|
|
24
|
+
authorUser: author,
|
|
25
|
+
};
|
|
26
|
+
threadOfPopulate = {
|
|
14
27
|
threadOf: {
|
|
15
|
-
|
|
28
|
+
populate: {
|
|
29
|
+
authorUser: author,
|
|
30
|
+
...restPopulate,
|
|
31
|
+
},
|
|
16
32
|
},
|
|
17
|
-
},
|
|
18
|
-
pagination,
|
|
19
|
-
sort,
|
|
20
33
|
};
|
|
21
|
-
}
|
|
22
|
-
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
query: {
|
|
37
|
+
...filters,
|
|
38
|
+
$or: [...orOperator, { removed: { $null: true } }, { removed: false }],
|
|
39
|
+
related: relation,
|
|
40
|
+
},
|
|
41
|
+
populate: {
|
|
42
|
+
...basePopulate,
|
|
43
|
+
...threadOfPopulate,
|
|
44
|
+
},
|
|
45
|
+
pagination,
|
|
46
|
+
sort,
|
|
47
|
+
fields,
|
|
48
|
+
};
|
|
23
49
|
};
|
|
50
|
+
exports.flatInput = flatInput;
|
|
51
|
+
//# sourceMappingURL=parsers.js.map
|
package/server/destroy.js
CHANGED
package/server/graphql/index.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const types_1 = __importDefault(require("./types"));
|
|
6
|
+
const queries_1 = __importDefault(require("./queries"));
|
|
7
|
+
const mutations_1 = __importDefault(require("./mutations"));
|
|
8
|
+
const resolvers_config_1 = __importDefault(require("./resolvers-config"));
|
|
9
|
+
const functions_1 = require("../services/utils/functions");
|
|
10
|
+
module.exports = async ({ strapi, config }) => {
|
|
11
|
+
const extensionService = strapi.plugin("graphql").service("extension");
|
|
12
|
+
extensionService.shadowCRUD((0, functions_1.getModelUid)("comment")).disableQueries();
|
|
13
|
+
extensionService.shadowCRUD((0, functions_1.getModelUid)("comment")).disableMutations();
|
|
14
|
+
extensionService.shadowCRUD((0, functions_1.getModelUid)("comment-report")).disableQueries();
|
|
15
|
+
extensionService.shadowCRUD((0, functions_1.getModelUid)("comment-report")).disableMutations();
|
|
16
|
+
extensionService.use(({ strapi, nexus }) => {
|
|
17
|
+
const types = (0, types_1.default)({ strapi, nexus, config });
|
|
18
|
+
const queries = (0, queries_1.default)({ strapi, nexus, config });
|
|
19
|
+
const mutations = (0, mutations_1.default)({ strapi, nexus, config });
|
|
20
|
+
const resolversConfig = (0, resolvers_config_1.default)({ strapi, config });
|
|
21
|
+
return {
|
|
22
|
+
types: [types, queries, mutations],
|
|
23
|
+
resolversConfig,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StrapiRequestContext } from "strapi-typed";
|
|
2
|
+
import { NexusRequestProps, StrapiGraphQLContext, ToBeFixed } from "../../../types";
|
|
3
|
+
declare const _default: ({ nexus }: StrapiGraphQLContext) => {
|
|
4
|
+
type: any;
|
|
5
|
+
args: {
|
|
6
|
+
input: any;
|
|
7
|
+
};
|
|
8
|
+
resolve(_: Object, args: NexusRequestProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").CommentReport>;
|
|
9
|
+
};
|
|
10
|
+
export = _default;
|
|
11
|
+
//# sourceMappingURL=createAbuseReport.d.ts.map
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { getPluginService } = require('../../utils/functions');
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const functions_1 = require("../../utils/functions");
|
|
5
3
|
module.exports = ({ nexus }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
const { nonNull } = nexus;
|
|
5
|
+
return {
|
|
6
|
+
type: nonNull("Report"),
|
|
7
|
+
args: {
|
|
8
|
+
input: nonNull("CreateReport"),
|
|
9
|
+
},
|
|
10
|
+
async resolve(_, args, ctx) {
|
|
11
|
+
const { input } = args;
|
|
12
|
+
const { state: { user = undefined } = {} } = ctx;
|
|
13
|
+
const { commentId, relation, ...body } = input;
|
|
14
|
+
try {
|
|
15
|
+
return await (0, functions_1.getPluginService)("client").reportAbuse(commentId, relation, body, user);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
throw new Error(e);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=createAbuseReport.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StrapiRequestContext } from "strapi-typed";
|
|
2
|
+
import { StrapiGraphQLContext, ToBeFixed } from "../../../types";
|
|
3
|
+
declare type CreateCommentProps = {
|
|
4
|
+
input: ToBeFixed;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: ({ nexus }: StrapiGraphQLContext) => {
|
|
7
|
+
type: any;
|
|
8
|
+
args: {
|
|
9
|
+
input: any;
|
|
10
|
+
};
|
|
11
|
+
resolve(_: Object, args: CreateCommentProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").Comment<import("../../../types").CommentAuthor>>;
|
|
12
|
+
};
|
|
13
|
+
export = _default;
|
|
14
|
+
//# sourceMappingURL=createComment.d.ts.map
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { getPluginService } = require('../../utils/functions');
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const functions_1 = require("../../utils/functions");
|
|
5
3
|
module.exports = ({ nexus }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
const { nonNull } = nexus;
|
|
5
|
+
return {
|
|
6
|
+
type: nonNull("CommentSingle"),
|
|
7
|
+
args: {
|
|
8
|
+
input: nonNull("CreateComment"),
|
|
9
|
+
},
|
|
10
|
+
async resolve(_, args, ctx) {
|
|
11
|
+
const { input } = args;
|
|
12
|
+
const { state: { user = undefined } = {} } = ctx;
|
|
13
|
+
const { relation, ...body } = input;
|
|
14
|
+
try {
|
|
15
|
+
return await (0, functions_1.getPluginService)("client").create(relation, body, user);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
throw new Error(e);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=createComment.js.map
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const createComment_1 = __importDefault(require("./createComment"));
|
|
6
|
+
const updateComment_1 = __importDefault(require("./updateComment"));
|
|
7
|
+
const removeComment_1 = __importDefault(require("./removeComment"));
|
|
8
|
+
const createAbuseReport_1 = __importDefault(require("./createAbuseReport"));
|
|
3
9
|
module.exports = (context) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
});
|
|
10
|
+
const mutations = {
|
|
11
|
+
createComment: createComment_1.default,
|
|
12
|
+
updateComment: updateComment_1.default,
|
|
13
|
+
removeComment: removeComment_1.default,
|
|
14
|
+
createAbuseReport: createAbuseReport_1.default,
|
|
15
|
+
};
|
|
16
|
+
return context.nexus.extendType({
|
|
17
|
+
type: "Mutation",
|
|
18
|
+
definition(t) {
|
|
19
|
+
for (const [name, configFactory] of Object.entries(mutations)) {
|
|
20
|
+
const config = configFactory(context);
|
|
21
|
+
t.field(name, config);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
});
|
|
21
25
|
};
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StrapiRequestContext } from "strapi-typed";
|
|
2
|
+
import { NexusRequestProps, StrapiGraphQLContext, ToBeFixed } from "../../../types";
|
|
3
|
+
declare const _default: ({ nexus }: StrapiGraphQLContext) => {
|
|
4
|
+
type: any;
|
|
5
|
+
args: {
|
|
6
|
+
input: any;
|
|
7
|
+
};
|
|
8
|
+
resolve(_: Object, args: NexusRequestProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").Comment<import("../../../types").CommentAuthor>>;
|
|
9
|
+
};
|
|
10
|
+
export = _default;
|
|
11
|
+
//# sourceMappingURL=removeComment.d.ts.map
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { getPluginService } = require('../../utils/functions');
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const functions_1 = require("../../utils/functions");
|
|
5
3
|
module.exports = ({ nexus }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
const { nonNull } = nexus;
|
|
5
|
+
return {
|
|
6
|
+
type: nonNull("CommentSingle"),
|
|
7
|
+
args: {
|
|
8
|
+
input: nonNull("RemoveComment"),
|
|
9
|
+
},
|
|
10
|
+
async resolve(_, args, ctx) {
|
|
11
|
+
const { input } = args;
|
|
12
|
+
const { state: { user = undefined } = {} } = ctx;
|
|
13
|
+
const { id, relation, author } = input;
|
|
14
|
+
try {
|
|
15
|
+
return await (0, functions_1.getPluginService)("client").markAsRemoved(id, relation, author?.id, user);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
throw new Error(e);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=removeComment.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StrapiRequestContext } from "strapi-typed";
|
|
2
|
+
import { NexusRequestProps, StrapiGraphQLContext, ToBeFixed } from "../../../types";
|
|
3
|
+
declare const _default: ({ nexus }: StrapiGraphQLContext) => {
|
|
4
|
+
type: any;
|
|
5
|
+
args: {
|
|
6
|
+
input: any;
|
|
7
|
+
};
|
|
8
|
+
resolve(_: Object, args: NexusRequestProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").Comment<import("../../../types").CommentAuthor>>;
|
|
9
|
+
};
|
|
10
|
+
export = _default;
|
|
11
|
+
//# sourceMappingURL=updateComment.d.ts.map
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { getPluginService } = require('../../utils/functions');
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const functions_1 = require("../../utils/functions");
|
|
5
3
|
module.exports = ({ nexus }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
const { nonNull } = nexus;
|
|
5
|
+
return {
|
|
6
|
+
type: nonNull("CommentSingle"),
|
|
7
|
+
args: {
|
|
8
|
+
input: nonNull("UpdateComment"),
|
|
9
|
+
},
|
|
10
|
+
async resolve(_, args, ctx) {
|
|
11
|
+
const { input } = args;
|
|
12
|
+
const { state: { user = undefined } = {} } = ctx;
|
|
13
|
+
const { id, relation, ...body } = input;
|
|
14
|
+
try {
|
|
15
|
+
return await (0, functions_1.getPluginService)("client").update(id, relation, body, user);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
throw new Error(e);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=updateComment.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Id, StrapiGraphQLContext, ToBeFixed } from "../../../types";
|
|
2
|
+
declare type ResponseFindAllResolverProps = {
|
|
3
|
+
relation: Id;
|
|
4
|
+
filters: ToBeFixed;
|
|
5
|
+
sort: ToBeFixed;
|
|
6
|
+
pagination: ToBeFixed;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: ({ strapi, nexus }: StrapiGraphQLContext) => {
|
|
9
|
+
type: string;
|
|
10
|
+
args: {
|
|
11
|
+
relation: any;
|
|
12
|
+
filters: any;
|
|
13
|
+
pagination: any;
|
|
14
|
+
sort: any;
|
|
15
|
+
};
|
|
16
|
+
resolve(obj: Object, args: ResponseFindAllResolverProps): Promise<import("strapi-typed").StrapiPaginatedResponse<import("../../../types").Comment<import("../../../types").CommentAuthor>>>;
|
|
17
|
+
};
|
|
18
|
+
export = _default;
|
|
19
|
+
//# sourceMappingURL=findAllFlat.d.ts.map
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const comment_1 = __importDefault(require("../../../content-types/comment"));
|
|
7
|
+
const parsers_1 = require("../../controllers/utils/parsers");
|
|
8
|
+
const functions_1 = require("../../utils/functions");
|
|
8
9
|
module.exports = ({ strapi, nexus }) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
10
|
+
const { nonNull, stringArg } = nexus;
|
|
11
|
+
const { service: getService } = strapi.plugin("graphql");
|
|
12
|
+
const { args } = getService("internals");
|
|
13
|
+
return {
|
|
14
|
+
type: "ResponseFindAll",
|
|
15
|
+
args: {
|
|
16
|
+
relation: nonNull(stringArg()),
|
|
17
|
+
filters: (0, functions_1.getPluginService)("gql").buildContentTypeFilters(comment_1.default),
|
|
18
|
+
pagination: args.PaginationArg,
|
|
19
|
+
sort: args.SortArg,
|
|
20
|
+
},
|
|
21
|
+
async resolve(obj, args) {
|
|
22
|
+
const { relation, filters, sort, pagination } = args;
|
|
23
|
+
return await (0, functions_1.getPluginService)("common").findAllFlat((0, parsers_1.flatInput)({
|
|
24
|
+
relation,
|
|
25
|
+
query: (0, functions_1.getPluginService)("gql").graphQLFiltersToStrapiQuery(filters, comment_1.default),
|
|
26
|
+
sort,
|
|
27
|
+
pagination: pagination
|
|
28
|
+
? {
|
|
29
|
+
...pagination,
|
|
30
|
+
withCount: !(0, lodash_1.isEmpty)(pagination),
|
|
31
|
+
}
|
|
32
|
+
: undefined,
|
|
33
|
+
}), undefined);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=findAllFlat.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Id } from "strapi-typed";
|
|
2
|
+
import { StrapiGraphQLContext, ToBeFixed } from "../../../types";
|
|
3
|
+
declare type findAllInHierarchyProps = {
|
|
4
|
+
relation: Id;
|
|
5
|
+
filters: ToBeFixed;
|
|
6
|
+
sort: ToBeFixed;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: ({ strapi, nexus }: StrapiGraphQLContext) => {
|
|
9
|
+
type: any;
|
|
10
|
+
args: {
|
|
11
|
+
relation: any;
|
|
12
|
+
sort: any;
|
|
13
|
+
};
|
|
14
|
+
resolve(obj: Object, args: findAllInHierarchyProps): Promise<import("../../../types").Comment<import("../../../types").CommentAuthor>[]>;
|
|
15
|
+
};
|
|
16
|
+
export = _default;
|
|
17
|
+
//# sourceMappingURL=findAllInHierarchy.d.ts.map
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const comment_1 = __importDefault(require("../../../content-types/comment"));
|
|
6
|
+
const parsers_1 = require("../../controllers/utils/parsers");
|
|
7
|
+
const functions_1 = require("../../utils/functions");
|
|
7
8
|
module.exports = ({ strapi, nexus }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
9
|
+
const { nonNull, list, stringArg } = nexus;
|
|
10
|
+
const { service: getService } = strapi.plugin("graphql");
|
|
11
|
+
const { args } = getService("internals");
|
|
12
|
+
return {
|
|
13
|
+
type: nonNull(list("CommentNested")),
|
|
14
|
+
args: {
|
|
15
|
+
relation: nonNull(stringArg()),
|
|
16
|
+
sort: args.SortArg,
|
|
17
|
+
},
|
|
18
|
+
async resolve(obj, args) {
|
|
19
|
+
const { relation, filters, sort } = args;
|
|
20
|
+
return await (0, functions_1.getPluginService)("common").findAllInHierarchy({
|
|
21
|
+
...(0, parsers_1.flatInput)({
|
|
22
|
+
relation,
|
|
23
|
+
query: (0, functions_1.getPluginService)("gql").graphQLFiltersToStrapiQuery(filters, comment_1.default),
|
|
24
|
+
sort,
|
|
25
|
+
}),
|
|
26
|
+
dropBlockedThreads: true,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=findAllInHierarchy.js.map
|