assisweb 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +39 -0
  2. package/package.json +15 -0
package/index.js ADDED
@@ -0,0 +1,39 @@
1
+ const mongoose = require('mongoose')
2
+
3
+
4
+ mongoose.connect("mongodb+srv://Assis:200420082018@cluster0.el3tr.mongodb.net/myFirstDatabase?retryWrites=true&w=majority").then(() => {
5
+
6
+ }).catch(err => {
7
+ console.log(err)
8
+ })
9
+
10
+
11
+ const registerSchema = new mongoose.Schema({
12
+ MyEmail: String,
13
+ MyPass: String,
14
+ MyName: String,
15
+ MyDiscordID: String,
16
+ DiscordBotToken: String,
17
+ ChannelID: String,
18
+ MyID: String
19
+ })
20
+
21
+ const Users = mongoose.model("Users" , registerSchema)
22
+
23
+
24
+ module.exports = {
25
+ UserData : function(Email , Type) {
26
+ Users.findOne({MyEmail: Email} , (err , data) => {
27
+ if(err) {
28
+ return;
29
+ }
30
+
31
+ if(data) {
32
+ if(Type === "Name")return data.MyName
33
+ if(Type === "Email")return data.MyEmail
34
+ if(Type === "ID")return data.MyID
35
+ }else return console.log("Assis Error : Email Not Found")
36
+
37
+ })
38
+ }
39
+ }
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "dependencies": {
3
+ "mongoose": "^6.2.8"
4
+ },
5
+ "name": "assisweb",
6
+ "version": "1.0.0",
7
+ "main": "index.js",
8
+ "devDependencies": {},
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "author": "",
13
+ "license": "ISC",
14
+ "description": ""
15
+ }