Merge branch 'main' of ssh://gits.techvanguard.vn:8822/UKSOURCE/cms.hailearning.edu.vn

This commit is contained in:
2026-03-19 02:51:59 +00:00
3 changed files with 5 additions and 2 deletions

View File

@@ -26,6 +26,9 @@ exports.index = async (req, res) => {
if (req.query.dateFrom || req.query.dateTo) {
filter.createdAt = {};
if (req.query.dateFrom) {
filter.createdAt.$gte = new Date(req.query.dateFrom);
}
if (req.query.dateTo) {
const dateTo = new Date(req.query.dateTo);
dateTo.setHours(23, 59, 59, 999); // End of day

View File

@@ -61,4 +61,4 @@ const auditLogSchema = new mongoose.Schema({
},
});
module.exports = mongoose.model("AuditLog", auditLogSchema);
module.exports = mongoose.model("AuditLog", auditLogSchema); // Index for faster queries

View File

@@ -43,6 +43,6 @@ const HeaderMenuSchema = new mongoose.Schema({
// Indexes for optimization
HeaderMenuSchema.index({ order: 1 });
HeaderMenuSchema.index({ status: 1 });
HeaderMenuSchema.index({ parentId: 1, order: 1 }); // Useful for fetching children in order
HeaderMenuSchema.index({ parentId: 1, order: 1 });
module.exports = mongoose.model('HeaderMenu', HeaderMenuSchema);