瀏覽代碼

Model des Notification

Vincent GUFFON 4 年之前
父節點
當前提交
dc7bcc463a
共有 3 個文件被更改,包括 58 次插入0 次删除
  1. 24 0
      models/Core/Notification.ts
  2. 17 0
      models/Core/NotificationMessage.ts
  3. 17 0
      models/Core/NotificationUsers.ts

+ 24 - 0
models/Core/Notification.ts

@@ -0,0 +1,24 @@
+import {Attr, Str, Model, HasOne, Uid} from '@vuex-orm/core'
+import {NotificationMessage} from "~/models/Core/NotificationMessage";
+
+export class Notification extends Model {
+  static entity = 'notifications'
+
+  @Uid()
+  id!: number | null
+
+  @Str('', { nullable: true })
+  name!: string
+
+  @HasOne(() => NotificationMessage, 'id')
+  message!: NotificationMessage | null
+
+  @Str('', { nullable: true })
+  type!: string
+
+  @Str('', { nullable: true })
+  link!: string
+
+  @Attr({})
+  notificationUsers!: Array<string>
+}

+ 17 - 0
models/Core/NotificationMessage.ts

@@ -0,0 +1,17 @@
+import {Str, Model, Uid} from '@vuex-orm/core'
+
+export class NotificationMessage extends Model {
+  static entity = 'notification_messages'
+
+  @Uid()
+  id!: number | null
+
+  @Str('', { nullable: true })
+  about!: string
+
+  @Str('', { nullable: true })
+  action!: string
+
+  @Str('', { nullable: true })
+  fileName!: string
+}

+ 17 - 0
models/Core/NotificationUsers.ts

@@ -0,0 +1,17 @@
+import { Str, Model, Bool, Uid } from '@vuex-orm/core'
+
+export class NotificationUsers extends Model {
+  static entity = 'notification_users'
+
+  @Uid()
+  id!: number | null
+
+  @Str('', { nullable: true })
+  notification!: string
+
+  @Str('', { nullable: true })
+  access!: string
+
+  @Bool(false, { nullable: false })
+  isRead!: boolean
+}