estatesfunding/ef-api/controllers/property.js

27 lines
597 B
JavaScript

import PropertyModal from "../models/property.js";
import UserModal from "../models/user.js";
import mongoose from "mongoose";
import { v4 as uuidv4 } from "uuid";
export const createProperty = async (req, res) => {
const propertyData = req.body;
// console.log('Property received:', propertyData);
const newProperty = new PropertyModal({
...propertyData,
});
try {
await newProperty.save();
res.status(201).json(newProperty);
} catch (error) {
res.status(404).json({ message: "Something went wrong" });
}
};