diff options
Diffstat (limited to 'backend/src/models/Category.js')
-rw-r--r-- | backend/src/models/Category.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/backend/src/models/Category.js b/backend/src/models/Category.js new file mode 100644 index 0000000..bb28ba3 --- /dev/null +++ b/backend/src/models/Category.js @@ -0,0 +1,34 @@ +const mongoose = require('mongoose'); + +const categorySchema = new mongoose.Schema( + { + name: { + type: String, + required: [true, 'Category name is required'], + trim: true, + unique: true + }, + description: { + type: String, + trim: true + }, + image: { + type: String + }, + active: { + type: Boolean, + default: true + }, + displayOrder: { + type: Number, + default: 0 + } + }, + { + timestamps: true + } +); + +const Category = mongoose.model('Category', categorySchema); + +module.exports = Category;
\ No newline at end of file |