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

+ 1 - 1
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -69,7 +69,7 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
   }, []);
 
   const actionUsers = getActionUsers();
-  const pagePath = { path: notification.pageIdSnapshot };
+  const pagePath = { path: notification.snapshot };
 
   const actionType: string = notification.action;
   let actionMsg: string;

+ 1 - 1
packages/app/src/interfaces/in-app-notification.ts

@@ -16,7 +16,7 @@ export interface IInAppNotification {
   status: InAppNotificationStatuses
   actionUsers: IUser[]
   createdAt: Date
-  pageIdSnapshot: string
+  snapshot: string
 }
 
 /*

+ 2 - 2
packages/app/src/server/models/in-app-notification.ts

@@ -20,7 +20,7 @@ export interface InAppNotificationDocument extends Document {
   activities: ActivityDocument[]
   status: string
   createdAt: Date
-  pageIdSnapshot: string
+  snapshot: string
 }
 
 
@@ -74,7 +74,7 @@ const inAppNotificationSchema = new Schema<InAppNotificationDocument, InAppNotif
     type: Date,
     default: Date.now,
   },
-  pageIdSnapshot: {
+  snapshot: {
     type: String,
     require: true,
   },

+ 3 - 3
packages/app/src/server/service/in-app-notification.ts

@@ -53,7 +53,7 @@ export default class InAppNotificationService {
   }
 
   upsertByActivity = async function(
-      users: Types.ObjectId[], activity: ActivityDocument, pageIdSnapshot: string, createdAt?: Date | null,
+      users: Types.ObjectId[], activity: ActivityDocument, snapshot: string, createdAt?: Date | null,
   ): Promise<void> {
     const {
       _id: activityId, targetModel, target, action,
@@ -62,7 +62,7 @@ export default class InAppNotificationService {
     const lastWeek = subDays(now, 7);
     const operations = users.map((user) => {
       const filter = {
-        user, target, action, createdAt: { $gt: lastWeek }, pageIdSnapshot,
+        user, target, action, createdAt: { $gt: lastWeek }, snapshot,
       };
       const parameters = {
         user,
@@ -71,7 +71,7 @@ export default class InAppNotificationService {
         action,
         status: STATUS_UNREAD,
         createdAt: now,
-        pageIdSnapshot,
+        snapshot,
         $addToSet: { activities: activityId },
       };
       return {