mirror of
https://github.com/Alvin-Zilverstand/challenge-11.git
synced 2026-11-21 13:02:59 +01:00
Update customer management functionality by adding modification support, enhancing the customer model to include modifications, and improving the UI for customer and modification forms. Refactor API routes for better error handling and streamline customer data management.
This commit is contained in:
1 parent
ec07b89dab
commit
1ac852f2a1
5 files changed
+329
-145
No files matched your search
+28
-4
@@ -20,6 +20,7 @@ const customerSchema = new mongoose.Schema({
|
||||
},
|
||||
address: {
|
||||
type: String,
|
||||
required: true,
|
||||
trim: true
|
||||
},
|
||||
carModel: {
|
||||
@@ -28,10 +29,31 @@ const customerSchema = new mongoose.Schema({
|
||||
trim: true
|
||||
},
|
||||
carYear: {
|
||||
type: String,
|
||||
required: true,
|
||||
trim: true
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
modifications: [{
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
price: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
category: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
dateAdded: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
}
|
||||
}],
|
||||
createdAt: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
@@ -48,4 +70,6 @@ customerSchema.pre('save', function(next) {
|
||||
next();
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Customer', customerSchema);
|
||||
const Customer = mongoose.model('Customer', customerSchema);
|
||||
|
||||
module.exports = Customer;
|
||||
Reference in new issue
Block a user