-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
465 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import mongoose from 'mongoose'; | ||
const contactUsSchema = new mongoose.Schema( | ||
{ | ||
mail: { | ||
type: String, | ||
required: true, | ||
match: /^[^\s@]+@[^\s@]+\.[^\s@]+$/, // Email format validation | ||
}, | ||
subject: { | ||
type: String, | ||
required: true, | ||
}, | ||
message: { | ||
type: String, | ||
required: true, | ||
}, | ||
dateSubmitted: { | ||
type: Date, | ||
default: Date.now, // Automatically set the current date when the form is submitted | ||
}, | ||
}, | ||
{ timestamps: true } // Automatically add createdAt and updatedAt fields | ||
); | ||
|
||
// Create a model based on the schema | ||
const ContactUs = mongoose.model('Contact', contactUsSchema); | ||
|
||
|
||
export default ContactUs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import express from 'express'; | ||
const router = express.Router(); | ||
import { createContactUs } from "../controllers/contactusController.js"; | ||
import { createContactUs} from "../controllers/contactusController.js"; | ||
|
||
router.post("/contactus", createContactUs); | ||
|
||
export default router; |
Oops, something went wrong.