|
@@ -1,6 +1,8 @@
|
|
|
|
|
+import { SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_ACTION_TYPE } from '~/interfaces/activity';
|
|
|
import { subscribeRuleNames } from '~/interfaces/in-app-notification';
|
|
import { subscribeRuleNames } from '~/interfaces/in-app-notification';
|
|
|
import loggerFactory from '~/utils/logger';
|
|
import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
|
|
|
|
+
|
|
|
import { apiV3FormValidator } from '../../middlewares/apiv3-form-validator';
|
|
import { apiV3FormValidator } from '../../middlewares/apiv3-form-validator';
|
|
|
|
|
|
|
|
const logger = loggerFactory('growi:routes:apiv3:pages'); // eslint-disable-line no-unused-vars
|
|
const logger = loggerFactory('growi:routes:apiv3:pages'); // eslint-disable-line no-unused-vars
|
|
@@ -339,6 +341,20 @@ module.exports = (crowi) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // create activity
|
|
|
|
|
+ try {
|
|
|
|
|
+ const parameters = {
|
|
|
|
|
+ user: req.user._id,
|
|
|
|
|
+ targetModel: SUPPORTED_TARGET_MODEL_TYPE.MODEL_PAGE,
|
|
|
|
|
+ target: createdPage,
|
|
|
|
|
+ action: SUPPORTED_ACTION_TYPE.PAGE_CREATE,
|
|
|
|
|
+ };
|
|
|
|
|
+ await crowi.activityService.createByParameter(parameters);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ logger.error('Failed to create activity', err);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// create subscription
|
|
// create subscription
|
|
|
try {
|
|
try {
|
|
|
await crowi.inAppNotificationService.createSubscription(req.user.id, createdPage._id, subscribeRuleNames.PAGE_CREATE);
|
|
await crowi.inAppNotificationService.createSubscription(req.user.id, createdPage._id, subscribeRuleNames.PAGE_CREATE);
|