Browse Source

fix migration value

shironegi39 1 year ago
parent
commit
c21e368034

+ 1 - 0
apps/app/src/interfaces/in-app-notification.ts

@@ -3,6 +3,7 @@ import type { IUser } from '@growi/core';
 import type { SupportedTargetModelType, SupportedActionType } from './activity';
 import type { SupportedTargetModelType, SupportedActionType } from './activity';
 
 
 export enum InAppNotificationStatuses {
 export enum InAppNotificationStatuses {
+  STATUS_UNREAD = 'UNREAD',
   STATUS_UNOPENED = 'UNOPENED',
   STATUS_UNOPENED = 'UNOPENED',
   STATUS_OPENED = 'OPENED',
   STATUS_OPENED = 'OPENED',
 }
 }

+ 4 - 3
apps/app/src/migrations/20240924181317-changed-status-in-inappnotifications-from-unread-to-unopened.js

@@ -1,3 +1,4 @@
+import { InAppNotificationStatuses } from '~/interfaces/in-app-notification';
 import loggerFactory from '~/utils/logger';
 import loggerFactory from '~/utils/logger';
 
 
 const logger = loggerFactory('growi:changed-status-in-inappnotifications-from-unread-to-unopened');
 const logger = loggerFactory('growi:changed-status-in-inappnotifications-from-unread-to-unopened');
@@ -6,13 +7,13 @@ module.exports = {
   async up(db) {
   async up(db) {
     logger.info('Apply migration');
     logger.info('Apply migration');
 
 
-    const unreadInAppnotifications = await await db.collection('inappnotifications');
+    const unreadInAppnotifications = await db.collection('inappnotifications');
     await unreadInAppnotifications.updateMany(
     await unreadInAppnotifications.updateMany(
-      { status: { $eq: 'UNREAD' } },
+      { status: { $eq: InAppNotificationStatuses.STATUS_UNREAD } },
       [
       [
         {
         {
           $set: {
           $set: {
-            status: 'UNOPENED',
+            status: InAppNotificationStatuses.STATUS_UNOPENED,
           },
           },
         },
         },
       ],
       ],