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