db case issues

This commit is contained in:
Deep Koluguri 2025-11-05 11:19:29 -05:00
parent a305fd0190
commit 3359484b15
1 changed files with 4 additions and 3 deletions

View File

@ -134,15 +134,16 @@ const Notification = sequelize.define('Notification', {
}, { }, {
tableName: 'notifications', tableName: 'notifications',
timestamps: true, timestamps: true,
underscored: true,
indexes: [ indexes: [
{ {
fields: ['user_id', 'createdAt'] fields: ['user_id', 'created_at']
}, },
{ {
fields: ['type', 'status'] fields: ['type', 'status']
}, },
{ {
fields: ['group_id', 'createdAt'] fields: ['group_id', 'created_at']
}, },
{ {
fields: ['status', 'scheduled_for'] fields: ['status', 'scheduled_for']
@ -209,7 +210,7 @@ Notification.getRecent = async function(userId, limit = 20) {
return await this.findAll({ return await this.findAll({
where: { user_id: userId }, where: { user_id: userId },
order: [['createdAt', 'DESC']], order: [['created_at', 'DESC']],
limit: limit, limit: limit,
include: [ include: [
{ {