done
This commit is contained in:
parent
f704d8e1f2
commit
fe8d8c7772
|
@ -6,9 +6,19 @@ import mongoose from "mongoose";
|
||||||
export const createProperty = async (req, res) => {
|
export const createProperty = async (req, res) => {
|
||||||
const propertyData = req.body;
|
const propertyData = req.body;
|
||||||
// console.log('Property received:', propertyData);
|
// console.log('Property received:', propertyData);
|
||||||
|
function generateRandomNumber() {
|
||||||
|
return Math.floor(Math.random() * 90000) + 10000;
|
||||||
|
}
|
||||||
|
const randomNumber = generateRandomNumber().toString();
|
||||||
|
const propertyId = `EFPI${randomNumber}`;
|
||||||
|
|
||||||
const newProperty = new PropertyModal({
|
const newProperty = new PropertyModal({
|
||||||
...propertyData,
|
...propertyData,
|
||||||
|
creator: req.userId,
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
publishedAt: new Date().toISOString(),
|
||||||
|
currentYear: new Date().getFullYear(),
|
||||||
|
propertyId: propertyId,
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -5,6 +5,20 @@ const propertySchema = mongoose.Schema({
|
||||||
title: {type: String, required: true },
|
title: {type: String, required: true },
|
||||||
yearBuild: {type: String, required: true },
|
yearBuild: {type: String, required: true },
|
||||||
totalSqft: {type: String, required: true },
|
totalSqft: {type: String, required: true },
|
||||||
|
creator: String,
|
||||||
|
propertyId: String,
|
||||||
|
createdAt: {
|
||||||
|
type: Date,
|
||||||
|
default: new Date(),
|
||||||
|
},
|
||||||
|
publishedAt: {
|
||||||
|
type: Date,
|
||||||
|
default: new Date(),
|
||||||
|
},
|
||||||
|
currentYear: {
|
||||||
|
type: Number,
|
||||||
|
default: new Date().getFullYear(),
|
||||||
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -42,7 +42,7 @@
|
||||||
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> -->
|
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
<script type="module" crossorigin src="/assets/index-CzD7WLXM.js"></script>
|
<script type="module" crossorigin src="/assets/index-DP5Z5_jo.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-BrT2kTNU.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-BrT2kTNU.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ const VerifyUser = () => {
|
||||||
<div className="contact_section_2">
|
<div className="contact_section_2">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-md-6">
|
<div className="col-md-6">
|
||||||
<br /><br /><br /><br /><br /><br /><br /><br />
|
<br /><br /><br /><br /><br />
|
||||||
<h1 className="card-title text-center">
|
<h1 className="card-title text-center">
|
||||||
<NavLink to="/login" className="glightbox play-btn mb-4">
|
<NavLink to="/login" className="glightbox play-btn mb-4">
|
||||||
{" "}
|
{" "}
|
||||||
|
|
Loading…
Reference in New Issue