Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnagithub03 committed Oct 28, 2023
2 parents 81b6bbd + 240271a commit d6a4420
Show file tree
Hide file tree
Showing 5 changed files with 1,522 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MONGO_URI = mongodb+srv://1010varun:[email protected]/
59 changes: 59 additions & 0 deletions backend/models.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const mongoose = require("mongoose");


const farmer = new mongoose.Schema({
aadharNumber: { type: String, required: true },
name: { type: String, required: true },
phone: { type: String, required: true },
location: { type: String, required: true },
products: [
{
type: mongoose.Schema.Types.ObjectId,
ref: "Product",
},
],
});

const product = new mongoose.Schema({
productID: { type: String, required: true },
name: { type: String, required: true },
quantity: { type: String, required: true },
prize_high: { type: String, required: true },
prize_low: { type: String, required: true },
// is_finished: { type: String, required: true },
});

const customer = new mongoose.Schema({
customerID: { type: String, required: true },
name: { type: String, required: true },
phone: { type: String, required: true },
email: { type: String, required: true },
address: { type: String, required: true },
orders: [
{
type: mongoose.Schema.Types.ObjectId,
ref: "Order",
},
],
});

const orders = new mongoose.Schema({
productID: { type: String, required: true },
quantity: { type: String, required: true },
isDelivered: { type: String, required: true },
date: { type: String, required: true },
});



const Farmer = mongoose.model("farmer", farmer);
const Customer = mongoose.model("customer", customer);
const Product = mongoose.model("product", product);
const Order = mongoose.model("order", orders);

module.exports = {
Farmer,
Customer,
Product,
Order
};
Loading

0 comments on commit d6a4420

Please sign in to comment.