import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { getBiggestActorImage } from '@server/lib/actor-image'
import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'
+import { forceNumber } from '@shared/core-utils'
import { uuidToShort } from '@shared/extra-utils'
import { UserNotification, UserNotificationType } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils'
offset: start,
limit: count,
sort,
- where,
- sequelize: this.sequelize
+ where
}
if (unread !== undefined) query.where['read'] = !unread
count === 0
? [] as UserNotificationModelForApi[]
- : new UserNotificationListQueryBuilder(query).listNotifications()
+ : new UserNotificationListQueryBuilder(this.sequelize, query).listNotifications()
]).then(([ total, data ]) => ({ total, data }))
}
}
static removeNotificationsOf (options: { id: number, type: 'account' | 'server', forUserId?: number }) {
- const id = parseInt(options.id + '', 10)
+ const id = forceNumber(options.id)
function buildAccountWhereQuery (base: string) {
const whereSuffix = options.forUserId