소스 검색

create interface

Shun Miyazawa 4 년 전
부모
커밋
e78eb89818
2개의 변경된 파일17개의 추가작업 그리고 9개의 파일을 삭제
  1. 10 0
      packages/app/src/interfaces/in-app-notification-settings.ts
  2. 7 9
      packages/app/src/server/models/in-app-notification-settings.ts

+ 10 - 0
packages/app/src/interfaces/in-app-notification-settings.ts

@@ -0,0 +1,10 @@
+import { Schema } from 'mongoose';
+
+export interface IDefaultSubscribeRule {
+  name: string,
+  isEnabled: boolean;
+}
+export interface IInAppNotificationSettings {
+  userId: Schema.Types.ObjectId;
+  defaultSubscribeRules: IDefaultSubscribeRule[];
+}

+ 7 - 9
packages/app/src/server/models/in-app-notification-settings.ts

@@ -1,21 +1,19 @@
 import { Schema, Model, Document } from 'mongoose';
 import { Schema, Model, Document } from 'mongoose';
 import { getOrCreateModel } from '../util/mongoose-utils';
 import { getOrCreateModel } from '../util/mongoose-utils';
 
 
-export interface IDefaultSubscribeRule {
-  name: string,
-  isEnabled: boolean;
-}
-export interface IInAppNotificationSettings {
-  userId: Schema.Types.ObjectId;
-  defaultSubscribeRules: IDefaultSubscribeRule[];
-}
+import { IInAppNotificationSettings } from '../../interfaces/in-app-notification-settings';
 
 
 export interface InAppNotificationSettingsDocument extends IInAppNotificationSettings, Document {}
 export interface InAppNotificationSettingsDocument extends IInAppNotificationSettings, Document {}
 export type InAppNotificationSettingsModel = Model<InAppNotificationSettingsDocument>
 export type InAppNotificationSettingsModel = Model<InAppNotificationSettingsDocument>
 
 
 const inAppNotificationSettingsSchema = new Schema<IInAppNotificationSettings>({
 const inAppNotificationSettingsSchema = new Schema<IInAppNotificationSettings>({
   userId: { type: String },
   userId: { type: String },
-  defaultSubscribeRules: [{ name: { type: String }, isEnabled: { type: Boolean } }],
+  defaultSubscribeRules: [
+    {
+      name: { type: String },
+      isEnabled: { type: Boolean },
+    },
+  ],
 });
 });
 
 
 // eslint-disable-next-line max-len
 // eslint-disable-next-line max-len