first commit

This commit is contained in:
r2xrzh9q2z-lab
2026-02-02 11:07:09 +07:00
commit d1b931d547
286 changed files with 53992 additions and 0 deletions

32
models/department.js Normal file
View File

@@ -0,0 +1,32 @@
const mongoose = require('mongoose');
// Helper function to generate slug
function generateSlug(name) {
return name
.toLowerCase()
.trim()
.replace(/[^\w\s-]/g, '') // Remove special characters
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/-+/g, '-'); // Replace multiple - with single -
}
const departmentSchema = new mongoose.Schema({
name: {
type: String,
required: true,
trim: true,
unique: true,
lowercase: true
},
slug: {
type: String,
required: true,
unique: true,
lowercase: true,
index: true
}
}, {
timestamps: false // Thêm timestamps để theo dõi thời gian tạo/cập nhật
});
module.exports = mongoose.model('Department', departmentSchema);