Kaynağa Gözat

fix snapshot prop

Shun Miyazawa 3 yıl önce
ebeveyn
işleme
47a82bda35
1 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. 6 3
      packages/app/src/server/models/activity.ts

+ 6 - 3
packages/app/src/server/models/activity.ts

@@ -3,7 +3,7 @@ import {
   Types, Document, Model, Schema,
 } from 'mongoose';
 
-import { AllSupportedTargetModelType, AllSupportedActionType } from '~/interfaces/activity';
+import { AllSupportedTargetModelType, AllSupportedActionType, ISnapshot } from '~/interfaces/activity';
 
 import loggerFactory from '../../utils/logger';
 import activityEvent from '../events/activity';
@@ -18,7 +18,7 @@ export interface ActivityDocument extends Document {
   targetModel: string
   target: Types.ObjectId
   action: string
-  snapshot: string
+  snapshot: ISnapshot
 
   getNotificationTargetUsers(): Promise<any[]>
 }
@@ -26,6 +26,7 @@ export interface ActivityDocument extends Document {
 export interface ActivityModel extends Model<ActivityDocument> {
   getActionUsersFromActivities(activities: ActivityDocument[]): any[]
 }
+
 // TODO: add revision id
 const activitySchema = new Schema<ActivityDocument, ActivityModel>({
   user: {
@@ -50,7 +51,9 @@ const activitySchema = new Schema<ActivityDocument, ActivityModel>({
     enum: AllSupportedActionType,
   },
   snapshot: {
-    type: String,
+    type: {
+      username: String,
+    },
   },
 }, {
   timestamps: {