diff options
author | 2025-04-29 10:47:43 +0530 | |
---|---|---|
committer | 2025-04-29 10:47:43 +0530 | |
commit | a2e0a65b2599267efe94d665d6305f59b225bbd5 (patch) | |
tree | e2cef2031e3f7655e0c5f419020a3f1064c3b7b8 /backend/src/models/Category.js | |
parent | 570bf0f3f065d583d6f94ecfc61aae93ba3e43de (diff) | |
download | restaurant-a2e0a65b2599267efe94d665d6305f59b225bbd5.tar.gz restaurant-a2e0a65b2599267efe94d665d6305f59b225bbd5.tar.bz2 restaurant-a2e0a65b2599267efe94d665d6305f59b225bbd5.zip |
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 |