-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.js
44 lines (31 loc) · 890 Bytes
/
model.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const mongoose = require("mongoose");
const passportLocalMongoose = require("passport-local-mongoose");
require("dotenv").config();
// Connecting with Database
// const DB =
// "mongodb+srv://" +
// process.env.mongo_Username +
// ":" +
// process.env.mongo_Password +
// "@cluster0.2lld6.mongodb.net/attendanceDB?retryWrites=true&w=majority";
const DB = "mongodb://localhost:27017/Attendance";
mongoose.connect(DB, function (err) {
if (err) {
console.log("No Connection");
console.log(err);
} else {
console.log("Connection Sucessful");
}
});
// Mongoose UserSchema
const userSchema = new mongoose.Schema({
name: String,
username: String,
googleId: String,
refresh_token: String,
scope: [String],
spreadsheets: [],
});
userSchema.plugin(passportLocalMongoose);
const User = new mongoose.model("User", userSchema);
module.exports = User;