tango-api-schema 2.0.0 → 2.0.2
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/index.js +4 -0
- package/package.json +1 -1
- package/schema/otp.model.js +29 -0
- package/schema/store.model.js +108 -0
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import uniqueValidator from 'mongoose-unique-validator';
|
|
2
|
+
import mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
// schema
|
|
5
|
+
const collection = new mongoose.Schema( {
|
|
6
|
+
email: {
|
|
7
|
+
type: String,
|
|
8
|
+
trim: true,
|
|
9
|
+
unique: true,
|
|
10
|
+
},
|
|
11
|
+
otp: {
|
|
12
|
+
type: Number,
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: [ 'signup' ],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
timestamps: true,
|
|
21
|
+
strict: true,
|
|
22
|
+
versionKey: false,
|
|
23
|
+
} );
|
|
24
|
+
|
|
25
|
+
collection.plugin( uniqueValidator );
|
|
26
|
+
collection.index( { createdAt: 1 }, { expires: '1d' } );
|
|
27
|
+
collection.index( { type: 1, email: 1 } );
|
|
28
|
+
|
|
29
|
+
export default mongoose.model( 'otp', collection );
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import mongooseUniqueValidator from 'mongoose-unique-validator';
|
|
3
|
+
|
|
4
|
+
const store = new mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
storeId: {
|
|
7
|
+
type: String,
|
|
8
|
+
trim: true,
|
|
9
|
+
required: true,
|
|
10
|
+
unique: true,
|
|
11
|
+
},
|
|
12
|
+
storeName: {
|
|
13
|
+
type: String,
|
|
14
|
+
require: true,
|
|
15
|
+
},
|
|
16
|
+
appId: {
|
|
17
|
+
type: String,
|
|
18
|
+
trim: true,
|
|
19
|
+
required: true,
|
|
20
|
+
unique: true,
|
|
21
|
+
},
|
|
22
|
+
clientId: {
|
|
23
|
+
type: String,
|
|
24
|
+
trim: true,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
businessType: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
storeType: {
|
|
31
|
+
type: {
|
|
32
|
+
type: String,
|
|
33
|
+
},
|
|
34
|
+
name: {
|
|
35
|
+
type: String,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
storeProfile: {
|
|
40
|
+
storeCode: {
|
|
41
|
+
type: String,
|
|
42
|
+
},
|
|
43
|
+
address: {
|
|
44
|
+
type: String,
|
|
45
|
+
},
|
|
46
|
+
country: {
|
|
47
|
+
type: String,
|
|
48
|
+
},
|
|
49
|
+
state: {
|
|
50
|
+
type: String,
|
|
51
|
+
},
|
|
52
|
+
city: {
|
|
53
|
+
type: String,
|
|
54
|
+
},
|
|
55
|
+
pincode: {
|
|
56
|
+
type: String,
|
|
57
|
+
},
|
|
58
|
+
timeZone: {
|
|
59
|
+
type: String,
|
|
60
|
+
},
|
|
61
|
+
open: {
|
|
62
|
+
type: String,
|
|
63
|
+
},
|
|
64
|
+
close: {
|
|
65
|
+
type: String,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
edge: {
|
|
69
|
+
camDetails: {
|
|
70
|
+
cameras: {
|
|
71
|
+
type: String,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
spocDetails: [
|
|
76
|
+
{
|
|
77
|
+
name: {
|
|
78
|
+
type: String,
|
|
79
|
+
required: true,
|
|
80
|
+
},
|
|
81
|
+
email: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: true,
|
|
84
|
+
},
|
|
85
|
+
contact: {
|
|
86
|
+
type: String,
|
|
87
|
+
required: true,
|
|
88
|
+
},
|
|
89
|
+
designation: {
|
|
90
|
+
type: String,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
storeConnectionId: {
|
|
95
|
+
type: String,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
strict: true,
|
|
100
|
+
versionKey: false,
|
|
101
|
+
timestamps: true,
|
|
102
|
+
},
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
store.index( { storeId: 1, clientId: 1, appId: 1 } );
|
|
106
|
+
store.plugin( mongooseUniqueValidator );
|
|
107
|
+
|
|
108
|
+
export default mongoose.model( 'store', store );
|