Shun Miyazawa 4 лет назад
Родитель
Сommit
d43d805a80

+ 0 - 7
packages/app/src/interfaces/activity.ts

@@ -1,6 +1,5 @@
 // Model
 const MODEL_PAGE = 'Page';
-const MODEL_COMMENT = 'Comment';
 
 // Action
 const ACTION_PAGE_LIKE = 'PAGE_LIKE';
@@ -20,10 +19,6 @@ export const SUPPORTED_TARGET_MODEL_TYPE = {
   MODEL_PAGE,
 } as const;
 
-export const SUPPORTED_EVENT_MODEL_TYPE = {
-  MODEL_COMMENT,
-} as const;
-
 export const SUPPORTED_ACTION_TYPE = {
   ACTION_PAGE_LIKE,
   ACTION_PAGE_BOOKMARK,
@@ -40,9 +35,7 @@ export const SUPPORTED_ACTION_TYPE = {
 
 
 export const AllSupportedTargetModelType = Object.values(SUPPORTED_TARGET_MODEL_TYPE);
-export const AllSupportedEventModelType = Object.values(SUPPORTED_EVENT_MODEL_TYPE);
 export const AllSupportedActionType = Object.values(SUPPORTED_ACTION_TYPE);
 
 // type supportedTargetModelType = typeof SUPPORTED_TARGET_MODEL_NAMES[keyof typeof SUPPORTED_TARGET_MODEL_NAMES];
-// type supportedEventModelType = typeof SUPPORTED_EVENT_MODEL_NAMES[keyof typeof SUPPORTED_EVENT_MODEL_NAMES];
 // type supportedActionType = typeof SUPPORTED_ACTION_NAMES[keyof typeof SUPPORTED_ACTION_NAMES];

+ 1 - 11
packages/app/src/server/models/activity.ts

@@ -3,7 +3,7 @@ import {
   Types, Document, Model, Schema,
 } from 'mongoose';
 
-import { AllSupportedTargetModelType, AllSupportedEventModelType, AllSupportedActionType } from '~/interfaces/activity';
+import { AllSupportedTargetModelType, AllSupportedActionType } from '~/interfaces/activity';
 
 import loggerFactory from '../../utils/logger';
 import activityEvent from '../events/activity';
@@ -18,8 +18,6 @@ export interface ActivityDocument extends Document {
   targetModel: string
   target: Types.ObjectId
   action: string
-  event: Types.ObjectId
-  eventModel: string
 
   getNotificationTargetUsers(): Promise<any[]>
 }
@@ -50,14 +48,6 @@ const activitySchema = new Schema<ActivityDocument, ActivityModel>({
     require: true,
     enum: AllSupportedActionType,
   },
-  event: {
-    type: Schema.Types.ObjectId,
-    refPath: 'eventModel',
-  },
-  eventModel: {
-    type: String,
-    enum: AllSupportedEventModelType,
-  },
 }, {
   timestamps: {
     createdAt: true,

+ 1 - 3
packages/app/src/server/service/comment.ts

@@ -1,7 +1,7 @@
 import { getModelSafely } from '@growi/core';
 import { Types } from 'mongoose';
 
-import { SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_EVENT_MODEL_TYPE, SUPPORTED_ACTION_TYPE } from '~/interfaces/activity';
+import { SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_ACTION_TYPE } from '~/interfaces/activity';
 import { stringifySnapshot } from '~/models/serializers/in-app-notification-snapshot/page';
 
 import loggerFactory from '../../utils/logger';
@@ -84,8 +84,6 @@ class CommentService {
       user: comment.creator,
       targetModel: SUPPORTED_TARGET_MODEL_TYPE.MODEL_PAGE,
       target: comment.page,
-      eventModel: SUPPORTED_EVENT_MODEL_TYPE.MODEL_COMMENT,
-      event: comment._id,
       action,
     };
     const activity = await this.activityService.createByParameters(parameters);