mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
chore: move get CT with RW activated to utils
This commit is contained in:
parent
ddc3c98c25
commit
077631d18b
@ -1,8 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const { set, get, forEach, keys, pickBy, pipe } = require('lodash/fp');
|
||||
const { set, forEach, pipe } = require('lodash/fp');
|
||||
const { mapAsync } = require('@strapi/utils');
|
||||
const { getService } = require('../../utils');
|
||||
const { getContentTypeUIDsWithActivatedReviewWorkflows } = require('../../utils/review-workflows');
|
||||
|
||||
const defaultStages = require('../../constants/default-stages.json');
|
||||
const defaultWorkflow = require('../../constants/default-workflow.json');
|
||||
@ -13,13 +14,6 @@ const {
|
||||
} = require('../../migrations/review-workflows');
|
||||
const { getDefaultWorkflow } = require('../../utils/review-workflows');
|
||||
|
||||
const getContentTypeUIDsWithActivatedReviewWorkflows = pipe([
|
||||
// Pick only content-types with reviewWorkflows options set to true
|
||||
pickBy(get('options.reviewWorkflows')),
|
||||
// Get UIDs
|
||||
keys,
|
||||
]);
|
||||
|
||||
async function initDefaultWorkflow({ workflowsService, stagesService, strapi }) {
|
||||
const wfCount = await workflowsService.count();
|
||||
const stagesCount = await stagesService.count();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { get, keys, pickBy, pipe } = require('lodash/fp');
|
||||
const { WORKFLOW_MODEL_UID } = require('../constants/workflows');
|
||||
|
||||
/**
|
||||
@ -19,7 +20,15 @@ function hasReviewWorkflow({ strapi }, contentType) {
|
||||
const getDefaultWorkflow = async ({ strapi }) =>
|
||||
strapi.query(WORKFLOW_MODEL_UID).findOne({ populate: ['stages'] });
|
||||
|
||||
const getContentTypeUIDsWithActivatedReviewWorkflows = pipe([
|
||||
// Pick only content-types with reviewWorkflows options set to true
|
||||
pickBy(get('options.reviewWorkflows')),
|
||||
// Get UIDs
|
||||
keys,
|
||||
]);
|
||||
|
||||
module.exports = {
|
||||
hasReviewWorkflow,
|
||||
getDefaultWorkflow,
|
||||
getContentTypeUIDsWithActivatedReviewWorkflows,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user