import { VideoImportModel } from '../video/video-import'
import { UserNotificationListQueryBuilder } from './sql/user-notitication-list-query-builder'
import { UserModel } from './user'
+import { UserRegistrationModel } from './user-registration'
@Table({
tableName: 'userNotification',
[Op.ne]: null
}
}
+ },
+ {
+ fields: [ 'userRegistrationId' ],
+ where: {
+ userRegistrationId: {
+ [Op.ne]: null
+ }
+ }
}
] as (ModelIndexesOptions & { where?: WhereOptions })[]
})
})
Application: ApplicationModel
+ @ForeignKey(() => UserRegistrationModel)
+ @Column
+ userRegistrationId: number
+
+ @BelongsTo(() => UserRegistrationModel, {
+ foreignKey: {
+ allowNull: true
+ },
+ onDelete: 'cascade'
+ })
+ UserRegistration: UserRegistrationModel
+
static listForApi (userId: number, start: number, count: number, sort: string, unread?: boolean) {
const where = { userId }
? { latestVersion: this.Application.latestPeerTubeVersion }
: undefined
+ const registration = this.UserRegistration
+ ? { id: this.UserRegistration.id, username: this.UserRegistration.username }
+ : undefined
+
return {
id: this.id,
type: this.type,
actorFollow,
plugin,
peertube,
+ registration,
createdAt: this.createdAt.toISOString(),
updatedAt: this.updatedAt.toISOString()
}