real-estate-management
real-estate-management copied to clipboard
Add transaction type to properties "For Rent" and "For Sale"
Update the Real Estate Properties Model to include a transaction type field to clearly indicate if a property is "For Rent" or "For Sale".
Tasks:
Backend Changes are needed:
- The transactionType field should be of type String.
- It should accept only two values: "sale" and "rent".
- This field should be required.
- Add validation to ensure only sale and rent are accepted as values for the transactionType field.
Propose Schema Change:
const propertySchema = new mongoose.Schema(
{
...
transactionType: { type: String, enum: ['for_sale', 'for_rent'], required: true },
...
},
{
timestamps: true,
}
);
Frontend Changes are needed.
- Modify the property creation form and edit forms to include a field for selecting transactionType.
- Ensure that users can only select either "Sale" or "Rent".