@whatsveg/wv-data-model 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +35 -0
- package/src/index.js +1 -0
- package/src/models/User.js +6 -0
- package/src/models/index.js +3 -0
- package/src/schemas/UserSchema.js +32 -0
- package/src/schemas/index.js +3 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# wv-data-model
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@whatsveg/wv-data-model",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.js",
|
|
8
|
+
"./models": "./src/models/index.js",
|
|
9
|
+
"./schemas": "./src/schemas/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"check": "npm pack",
|
|
16
|
+
"version:patch": "npm version patch",
|
|
17
|
+
"version:minor": "npm version minor",
|
|
18
|
+
"version:major": "npm version major",
|
|
19
|
+
"publish:npm": "npm publish",
|
|
20
|
+
"release:patch": "npm version patch && npm publish",
|
|
21
|
+
"release:minor": "npm version minor && npm publish",
|
|
22
|
+
"release:major": "npm version major && npm publish"
|
|
23
|
+
},
|
|
24
|
+
"author": "Ravi Verma (Whatsveg)",
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"mongoose": "^9.7.3"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./models");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const UserSchema = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
userId: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
unique: true
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
name: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
email: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
lowercase: true
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
age: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 18
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
timestamps: true
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
module.exports = UserSchema;
|