Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
abhudaym committed Feb 27, 2021
0 parents commit caea18f
Show file tree
Hide file tree
Showing 6 changed files with 1,704 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
node_modules
.env
16 changes: 16 additions & 0 deletions config/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import mongoose from "mongoose";
const connectDB = async () => {
try {
const conn = await mongoose.connect(process.env.MONGO_URI, {
useUnifiedTopology: true,
useNewUrlParser: true,
useCreateIndex: true,
});
console.log(`Mongo DB connected: ${conn.connection.host}`);
} catch (error) {
console.error(`Error: ${error.message}`);
process.exit(1);
}
};

export default connectDB;
32 changes: 32 additions & 0 deletions models/userModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import mongoose from "mongoose";

const userSchema = mongoose.Schema(
{
userDetails: {
name: {
type: String,
required: true,
unique: true,
},
email: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
},
circleInfo: {
user: [
{ type: mongoose.Schema.Types.ObjectId, required: true, ref: "User" },
],
},
// medicalDocs: {
// id:
// }
},
{
timestamps: true,
}
);
Loading

0 comments on commit caea18f

Please sign in to comment.