diff --git a/backend/src/models/Notification.js b/backend/src/models/Notification.js index f3dab5a..6bba559 100644 --- a/backend/src/models/Notification.js +++ b/backend/src/models/Notification.js @@ -134,15 +134,16 @@ const Notification = sequelize.define('Notification', { }, { tableName: 'notifications', timestamps: true, + underscored: true, indexes: [ { - fields: ['user_id', 'createdAt'] + fields: ['user_id', 'created_at'] }, { fields: ['type', 'status'] }, { - fields: ['group_id', 'createdAt'] + fields: ['group_id', 'created_at'] }, { fields: ['status', 'scheduled_for'] @@ -209,7 +210,7 @@ Notification.getRecent = async function(userId, limit = 20) { return await this.findAll({ where: { user_id: userId }, - order: [['createdAt', 'DESC']], + order: [['created_at', 'DESC']], limit: limit, include: [ {