Просмотр исходного кода

"SUPPORTED_EVENT_MODEL_TYPE" -> "SupportedEventModel"

Shun Miyazawa 3 лет назад
Родитель
Сommit
d8f993545f

+ 3 - 3
packages/app/src/interfaces/activity.ts

@@ -40,7 +40,7 @@ export const SupportedTargetModel = {
   MODEL_PAGE,
 } as const;
 
-export const SUPPORTED_EVENT_MODEL_TYPE = {
+export const SupportedEventModel = {
   MODEL_COMMENT,
 } as const;
 
@@ -111,7 +111,7 @@ export const CommentActions = Object.values({
  * Array
  */
 export const AllSupportedTargetModel = Object.values(SupportedTargetModel);
-export const AllSupportedEventModelType = Object.values(SUPPORTED_EVENT_MODEL_TYPE);
+export const AllSupportedEventModel = Object.values(SupportedEventModel);
 export const AllSupportedActionType = Object.values(SUPPORTED_ACTION_TYPE);
 export const AllSupportedActionToNotifiedType = Object.values(SUPPORTED_ACTION_TO_NOTIFIED_TYPE);
 
@@ -119,7 +119,7 @@ export const AllSupportedActionToNotifiedType = Object.values(SUPPORTED_ACTION_T
  * Type
  */
 export type SupportedTargetModelType = typeof SupportedTargetModel[keyof typeof SupportedTargetModel];
-export type SupportedEventModelType = typeof SUPPORTED_EVENT_MODEL_TYPE[keyof typeof SUPPORTED_EVENT_MODEL_TYPE];
+export type SupportedEventModelType = typeof SupportedEventModel[keyof typeof SupportedEventModel];
 export type SupportedActionType = typeof SUPPORTED_ACTION_TYPE[keyof typeof SUPPORTED_ACTION_TYPE];
 
 export type ISnapshot = Partial<Pick<IUser, 'username'>>

+ 2 - 2
packages/app/src/server/models/activity.ts

@@ -7,7 +7,7 @@ import mongoosePaginate from 'mongoose-paginate-v2';
 import {
   ISnapshot, AllSupportedActionType, SupportedActionType,
   AllSupportedTargetModel, SupportedTargetModelType,
-  AllSupportedEventModelType, SupportedEventModelType,
+  AllSupportedEventModel, SupportedEventModelType,
 } from '~/interfaces/activity';
 
 import loggerFactory from '../../utils/logger';
@@ -63,7 +63,7 @@ const activitySchema = new Schema<ActivityDocument, ActivityModel>({
   },
   eventModel: {
     type: String,
-    enum: AllSupportedEventModelType,
+    enum: AllSupportedEventModel,
   },
   event: {
     type: Schema.Types.ObjectId,

+ 2 - 2
packages/app/src/server/routes/comment.js

@@ -1,5 +1,5 @@
 
-import { SUPPORTED_ACTION_TYPE, SupportedTargetModel, SUPPORTED_EVENT_MODEL_TYPE } from '~/interfaces/activity';
+import { SUPPORTED_ACTION_TYPE, SupportedTargetModel, SupportedEventModel } from '~/interfaces/activity';
 import loggerFactory from '~/utils/logger';
 
 /**
@@ -264,7 +264,7 @@ module.exports = function(crowi, app) {
     const parameters = {
       targetModel: SupportedTargetModel.MODEL_PAGE,
       target: page,
-      eventModel: SUPPORTED_EVENT_MODEL_TYPE.MODEL_COMMENT,
+      eventModel: SupportedEventModel.MODEL_COMMENT,
       event: createdComment,
       action: SUPPORTED_ACTION_TYPE.ACTION_COMMENT_CREATE,
     };