Shun Miyazawa 3 лет назад
Родитель
Сommit
12e33eda0b
2 измененных файлов с 3 добавлено и 7 удалено
  1. 3 3
      packages/app/src/interfaces/activity.ts
  2. 0 4
      packages/app/src/server/models/activity.ts

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

@@ -70,9 +70,9 @@ export type ISnapshot = Partial<Pick<IUser, 'username'>>
 
 
 export type IActivity = {
 export type IActivity = {
   user?: IUser
   user?: IUser
-  targetModel: SupportedTargetModelType
-  target: string
-  action: SupportedActionType
+  targetModel?: SupportedTargetModelType
+  target?: string
+  action?: SupportedActionType
   createdAt: Date
   createdAt: Date
   snapshot?: ISnapshot
   snapshot?: ISnapshot
 }
 }

+ 0 - 4
packages/app/src/server/models/activity.ts

@@ -39,21 +39,17 @@ const activitySchema = new Schema<ActivityDocument, ActivityModel>({
     type: Schema.Types.ObjectId,
     type: Schema.Types.ObjectId,
     ref: 'User',
     ref: 'User',
     index: true,
     index: true,
-    required: true,
   },
   },
   targetModel: {
   targetModel: {
     type: String,
     type: String,
-    required: true,
     enum: AllSupportedTargetModelType,
     enum: AllSupportedTargetModelType,
   },
   },
   target: {
   target: {
     type: Schema.Types.ObjectId,
     type: Schema.Types.ObjectId,
     refPath: 'targetModel',
     refPath: 'targetModel',
-    required: true,
   },
   },
   action: {
   action: {
     type: String,
     type: String,
-    required: true,
     enum: AllSupportedActionType,
     enum: AllSupportedActionType,
   },
   },
   snapshot: snapshotSchema,
   snapshot: snapshotSchema,