flykup_model_production 1.0.0 → 1.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/models/AdminEmail.model.js +33 -27
- package/models/admin.model.js +25 -21
- package/package.json +1 -1
|
@@ -1,36 +1,42 @@
|
|
|
1
|
-
import { Schema, model } from 'mongoose';
|
|
1
|
+
import { Schema, models, model } from 'mongoose';
|
|
2
2
|
|
|
3
|
-
const AdminEmailSchema = new Schema(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
isActive: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: true
|
|
14
|
-
},
|
|
15
|
-
permissions: {
|
|
16
|
-
shoppableVideo: {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
default: false
|
|
3
|
+
const AdminEmailSchema = new Schema(
|
|
4
|
+
{
|
|
5
|
+
email: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
unique: true,
|
|
9
|
+
lowercase: true,
|
|
10
|
+
trim: true,
|
|
19
11
|
},
|
|
20
|
-
|
|
12
|
+
isActive: {
|
|
21
13
|
type: Boolean,
|
|
22
|
-
default:
|
|
14
|
+
default: true,
|
|
23
15
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
permissions: {
|
|
17
|
+
shoppableVideo: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
productAccess: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
totalAccess: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
timestamps: true,
|
|
28
33
|
}
|
|
29
|
-
|
|
30
|
-
timestamps: true
|
|
31
|
-
});
|
|
34
|
+
);
|
|
32
35
|
|
|
33
36
|
// Index for faster querying
|
|
34
37
|
AdminEmailSchema.index({ email: 1, isActive: 1 });
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
// ✅ Use existing model if already compiled
|
|
40
|
+
const AdminEmail = models.AdminEmail || model('AdminEmail', AdminEmailSchema);
|
|
41
|
+
|
|
42
|
+
export default AdminEmail;
|
package/models/admin.model.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
import mongoose from
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
2
|
|
|
3
3
|
const AdminSchema = new mongoose.Schema(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
maskingSwitch: { type: Boolean, default: false },
|
|
4
|
+
{
|
|
5
|
+
name: { type: String, required: true },
|
|
6
|
+
role: { type: String, required: true, default: "admin" },
|
|
7
|
+
email: { type: String, required: true, unique: true },
|
|
8
|
+
mobileNumber: { type: String, required: true },
|
|
9
|
+
password: { type: String, required: true },
|
|
10
|
+
profilePicture: {
|
|
11
|
+
type: String,
|
|
12
|
+
default:
|
|
13
|
+
"https://img.freepik.com/free-vector/blue-circle-with-white-user_78370-4707.jpg",
|
|
14
|
+
},
|
|
15
|
+
contentAccess: {
|
|
16
|
+
users: { readOnly: Boolean, edit: Boolean },
|
|
17
|
+
pendingSellers: { readOnly: Boolean, edit: Boolean },
|
|
18
|
+
sellers: { readOnly: Boolean, edit: Boolean },
|
|
19
|
+
orders: { readOnly: Boolean, edit: Boolean },
|
|
20
|
+
category: { readOnly: Boolean, edit: Boolean },
|
|
22
21
|
},
|
|
23
|
-
{
|
|
22
|
+
maskingSwitch: { type: Boolean, default: false },
|
|
23
|
+
},
|
|
24
|
+
{ timestamps: true }
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
// ✅ Guard against recompile
|
|
28
|
+
const Admin =
|
|
29
|
+
mongoose.models.Admin || mongoose.model("Admin", AdminSchema);
|
|
30
|
+
|
|
27
31
|
export default Admin;
|