mirror of
https://github.com/Alvin-Zilverstand/challenge-11.git
synced 2026-03-06 13:21:54 +01:00
Remove index.html, styles.css, favicon.svg, script.js, and tailwind.config.js files to streamline the project and eliminate unused resources.
This commit is contained in:
34
models/Contact.js
Normal file
34
models/Contact.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const contactSchema = new mongoose.Schema({
|
||||
customer: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'Customer',
|
||||
required: true
|
||||
},
|
||||
user: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User',
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
enum: ['phone', 'email', 'in-person', 'other'],
|
||||
required: true
|
||||
},
|
||||
notes: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
followUp: {
|
||||
required: Boolean,
|
||||
date: Date,
|
||||
notes: String
|
||||
},
|
||||
createdAt: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Contact', contactSchema);
|
||||
32
models/Customer.js
Normal file
32
models/Customer.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const customerSchema = new mongoose.Schema({
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true
|
||||
},
|
||||
phone: {
|
||||
type: String
|
||||
},
|
||||
carDetails: {
|
||||
make: String,
|
||||
model: String,
|
||||
year: Number,
|
||||
modifications: [String]
|
||||
},
|
||||
createdAt: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
},
|
||||
updatedAt: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Customer', customerSchema);
|
||||
24
models/User.js
Normal file
24
models/User.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const userSchema = new mongoose.Schema({
|
||||
username: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true
|
||||
},
|
||||
password: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
role: {
|
||||
type: String,
|
||||
enum: ['admin', 'staff'],
|
||||
default: 'staff'
|
||||
},
|
||||
createdAt: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('User', userSchema);
|
||||
Reference in New Issue
Block a user