orbitx-core-models 11.17.0 → 11.18.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/dist/interfaces/addons.interface.d.ts +17 -0
- package/dist/interfaces/addons.interface.d.ts.map +1 -0
- package/dist/interfaces/addons.interface.js +2 -0
- package/dist/interfaces/plan-options.interface.d.ts +22 -0
- package/dist/interfaces/plan-options.interface.d.ts.map +1 -0
- package/dist/interfaces/plan-options.interface.js +2 -0
- package/dist/interfaces/plan.interface.d.ts +14 -0
- package/dist/interfaces/plan.interface.d.ts.map +1 -0
- package/dist/interfaces/plan.interface.js +2 -0
- package/dist/interfaces/product.interface.d.ts +9 -0
- package/dist/interfaces/product.interface.d.ts.map +1 -0
- package/dist/interfaces/product.interface.js +2 -0
- package/dist/models/addons.model.d.ts +9 -0
- package/dist/models/addons.model.d.ts.map +1 -0
- package/dist/models/addons.model.js +102 -0
- package/dist/models/plan-options.model.d.ts +9 -0
- package/dist/models/plan-options.model.d.ts.map +1 -0
- package/dist/models/plan-options.model.js +117 -0
- package/dist/models/plan.model.d.ts +9 -0
- package/dist/models/plan.model.d.ts.map +1 -0
- package/dist/models/plan.model.js +90 -0
- package/dist/models/product.model.d.ts +9 -0
- package/dist/models/product.model.d.ts.map +1 -0
- package/dist/models/product.model.js +67 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface IAddon {
|
|
2
|
+
uid: string;
|
|
3
|
+
name: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
stripePriceId?: string;
|
|
7
|
+
stripeProductId?: string;
|
|
8
|
+
price: number;
|
|
9
|
+
currency: string;
|
|
10
|
+
billingCycle: "monthly" | "yearly";
|
|
11
|
+
settings?: Map<string, any>;
|
|
12
|
+
displayOrder: number;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=addons.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addons.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/addons.interface.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,SAAS,GAAG,QAAQ,CAAC;IACnC,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Types } from "mongoose";
|
|
2
|
+
export interface IPlanOption {
|
|
3
|
+
planId: Types.ObjectId;
|
|
4
|
+
optionNumber?: number;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
stripePriceId?: string;
|
|
8
|
+
stripeProductId?: string;
|
|
9
|
+
price: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
billingCycle?: "monthly" | "yearly" | null;
|
|
12
|
+
quota?: number;
|
|
13
|
+
quotaType?: "visitors" | "leads" | null;
|
|
14
|
+
pricePerLead?: number;
|
|
15
|
+
isRecommended: boolean;
|
|
16
|
+
displayOrder: number;
|
|
17
|
+
metadata?: Map<string, any>;
|
|
18
|
+
isActive: boolean;
|
|
19
|
+
createdAt?: Date;
|
|
20
|
+
updatedAt?: Date;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=plan-options.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-options.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/plan-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Types } from "mongoose";
|
|
2
|
+
export interface IPlan {
|
|
3
|
+
productId: Types.ObjectId;
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
planType: "subscription" | "budget_inclusive" | "pay_per_lead";
|
|
7
|
+
description?: string;
|
|
8
|
+
options: Types.ObjectId[];
|
|
9
|
+
availableAddons: Types.ObjectId[];
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
updatedAt?: Date;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=plan.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/plan.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,cAAc,GAAG,kBAAkB,GAAG,cAAc,CAAC;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,eAAe,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/product.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { IAddon } from "../interfaces/addons.interface";
|
|
3
|
+
export declare const Addon: mongoose.Model<IAddon, {}, {}, {}, mongoose.Document<unknown, {}, IAddon, {}, {}> & IAddon & {
|
|
4
|
+
_id: mongoose.Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export default Addon;
|
|
9
|
+
//# sourceMappingURL=addons.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addons.model.d.ts","sourceRoot":"","sources":["../../src/models/addons.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAsExD,eAAO,MAAM,KAAK;;;;OAA+C,CAAC;AAClE,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Addon = void 0;
|
|
37
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
38
|
+
const addonSchema = new mongoose_1.Schema({
|
|
39
|
+
name: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: [true, "Addon name is required"],
|
|
42
|
+
trim: true,
|
|
43
|
+
},
|
|
44
|
+
slug: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: [true, "Addon slug is required"],
|
|
47
|
+
trim: true,
|
|
48
|
+
lowercase: true,
|
|
49
|
+
unique: true,
|
|
50
|
+
},
|
|
51
|
+
description: {
|
|
52
|
+
type: String,
|
|
53
|
+
trim: true,
|
|
54
|
+
},
|
|
55
|
+
stripePriceId: {
|
|
56
|
+
type: String,
|
|
57
|
+
trim: true,
|
|
58
|
+
},
|
|
59
|
+
stripeProductId: {
|
|
60
|
+
type: String,
|
|
61
|
+
trim: true,
|
|
62
|
+
},
|
|
63
|
+
price: {
|
|
64
|
+
type: Number,
|
|
65
|
+
required: [true, "Price is required"],
|
|
66
|
+
min: [0, "Price must be non-negative"],
|
|
67
|
+
},
|
|
68
|
+
currency: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "usd",
|
|
71
|
+
lowercase: true,
|
|
72
|
+
trim: true,
|
|
73
|
+
},
|
|
74
|
+
billingCycle: {
|
|
75
|
+
type: String,
|
|
76
|
+
enum: ["monthly", "yearly"],
|
|
77
|
+
default: "monthly",
|
|
78
|
+
},
|
|
79
|
+
settings: {
|
|
80
|
+
type: Map,
|
|
81
|
+
of: mongoose_1.Schema.Types.Mixed,
|
|
82
|
+
},
|
|
83
|
+
displayOrder: {
|
|
84
|
+
type: Number,
|
|
85
|
+
default: 0,
|
|
86
|
+
},
|
|
87
|
+
isActive: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: true,
|
|
90
|
+
},
|
|
91
|
+
}, {
|
|
92
|
+
timestamps: true,
|
|
93
|
+
toJSON: { virtuals: true },
|
|
94
|
+
toObject: { virtuals: true },
|
|
95
|
+
});
|
|
96
|
+
addonSchema.index({ productId: 1 });
|
|
97
|
+
addonSchema.index({ slug: 1 });
|
|
98
|
+
addonSchema.index({ displayOrder: 1 });
|
|
99
|
+
addonSchema.index({ isActive: 1 });
|
|
100
|
+
addonSchema.index({ stripePriceId: 1 });
|
|
101
|
+
exports.Addon = mongoose_1.default.model("Addon", addonSchema);
|
|
102
|
+
exports.default = exports.Addon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { IPlanOption } from "../interfaces/plan-options.interface";
|
|
3
|
+
export declare const PlanOption: mongoose.Model<IPlanOption, {}, {}, {}, mongoose.Document<unknown, {}, IPlanOption, {}, {}> & IPlanOption & {
|
|
4
|
+
_id: mongoose.Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export default PlanOption;
|
|
9
|
+
//# sourceMappingURL=plan-options.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-options.model.d.ts","sourceRoot":"","sources":["../../src/models/plan-options.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAqFnE,eAAO,MAAM,UAAU;;;;OAGtB,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PlanOption = void 0;
|
|
37
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
38
|
+
const planOptionSchema = new mongoose_1.Schema({
|
|
39
|
+
planId: {
|
|
40
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
41
|
+
ref: "Plan",
|
|
42
|
+
required: [true, "Plan ID is required"],
|
|
43
|
+
},
|
|
44
|
+
optionNumber: {
|
|
45
|
+
type: Number,
|
|
46
|
+
},
|
|
47
|
+
name: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: [true, "Option name is required"],
|
|
50
|
+
trim: true,
|
|
51
|
+
},
|
|
52
|
+
description: {
|
|
53
|
+
type: String,
|
|
54
|
+
trim: true,
|
|
55
|
+
},
|
|
56
|
+
stripePriceId: {
|
|
57
|
+
type: String,
|
|
58
|
+
trim: true,
|
|
59
|
+
},
|
|
60
|
+
stripeProductId: {
|
|
61
|
+
type: String,
|
|
62
|
+
trim: true,
|
|
63
|
+
},
|
|
64
|
+
price: {
|
|
65
|
+
type: Number,
|
|
66
|
+
required: [true, "Price is required"],
|
|
67
|
+
min: [0, "Price must be non-negative"],
|
|
68
|
+
},
|
|
69
|
+
currency: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "usd",
|
|
72
|
+
lowercase: true,
|
|
73
|
+
trim: true,
|
|
74
|
+
},
|
|
75
|
+
billingCycle: {
|
|
76
|
+
type: String,
|
|
77
|
+
enum: ["monthly", "yearly", null],
|
|
78
|
+
},
|
|
79
|
+
quota: {
|
|
80
|
+
type: Number,
|
|
81
|
+
min: [0, "Quota must be non-negative"],
|
|
82
|
+
},
|
|
83
|
+
quotaType: {
|
|
84
|
+
type: String,
|
|
85
|
+
enum: ["visitors", "leads", null],
|
|
86
|
+
},
|
|
87
|
+
pricePerLead: {
|
|
88
|
+
type: Number,
|
|
89
|
+
min: [0, "Price per lead must be non-negative"],
|
|
90
|
+
},
|
|
91
|
+
isRecommended: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
displayOrder: {
|
|
96
|
+
type: Number,
|
|
97
|
+
default: 0,
|
|
98
|
+
},
|
|
99
|
+
metadata: {
|
|
100
|
+
type: Map,
|
|
101
|
+
of: mongoose_1.Schema.Types.Mixed,
|
|
102
|
+
},
|
|
103
|
+
isActive: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: true,
|
|
106
|
+
},
|
|
107
|
+
}, {
|
|
108
|
+
timestamps: true,
|
|
109
|
+
toJSON: { virtuals: true },
|
|
110
|
+
toObject: { virtuals: true },
|
|
111
|
+
});
|
|
112
|
+
planOptionSchema.index({ planId: 1 });
|
|
113
|
+
planOptionSchema.index({ displayOrder: 1 });
|
|
114
|
+
planOptionSchema.index({ isActive: 1 });
|
|
115
|
+
planOptionSchema.index({ stripePriceId: 1 });
|
|
116
|
+
exports.PlanOption = mongoose_1.default.model("PlanOption", planOptionSchema);
|
|
117
|
+
exports.default = exports.PlanOption;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { IPlan } from "../interfaces/plan.interface";
|
|
3
|
+
export declare const Plan: mongoose.Model<IPlan, {}, {}, {}, mongoose.Document<unknown, {}, IPlan, {}, {}> & IPlan & {
|
|
4
|
+
_id: mongoose.Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export default Plan;
|
|
9
|
+
//# sourceMappingURL=plan.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.model.d.ts","sourceRoot":"","sources":["../../src/models/plan.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AA0DrD,eAAO,MAAM,IAAI;;;;OAA4C,CAAC;AAC9D,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Plan = void 0;
|
|
37
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
38
|
+
const planSchema = new mongoose_1.Schema({
|
|
39
|
+
productId: {
|
|
40
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
41
|
+
ref: "Product",
|
|
42
|
+
required: [true, "Product ID is required"],
|
|
43
|
+
},
|
|
44
|
+
name: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: [true, "Plan name is required"],
|
|
47
|
+
trim: true,
|
|
48
|
+
},
|
|
49
|
+
slug: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: [true, "Plan slug is required"],
|
|
52
|
+
trim: true,
|
|
53
|
+
lowercase: true,
|
|
54
|
+
},
|
|
55
|
+
planType: {
|
|
56
|
+
type: String,
|
|
57
|
+
enum: ["subscription", "budget_inclusive", "pay_per_lead"],
|
|
58
|
+
required: [true, "Plan type is required"],
|
|
59
|
+
},
|
|
60
|
+
description: {
|
|
61
|
+
type: String,
|
|
62
|
+
trim: true,
|
|
63
|
+
},
|
|
64
|
+
options: [
|
|
65
|
+
{
|
|
66
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
67
|
+
ref: "PlanOption",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
availableAddons: [
|
|
71
|
+
{
|
|
72
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
73
|
+
ref: "Addon",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
isActive: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: true,
|
|
79
|
+
},
|
|
80
|
+
}, {
|
|
81
|
+
timestamps: true,
|
|
82
|
+
toJSON: { virtuals: true },
|
|
83
|
+
toObject: { virtuals: true },
|
|
84
|
+
});
|
|
85
|
+
planSchema.index({ productId: 1 });
|
|
86
|
+
planSchema.index({ slug: 1 });
|
|
87
|
+
planSchema.index({ planType: 1 });
|
|
88
|
+
planSchema.index({ isActive: 1 });
|
|
89
|
+
exports.Plan = mongoose_1.default.model("Plan", planSchema);
|
|
90
|
+
exports.default = exports.Plan;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { IProduct } from "../interfaces/product.interface";
|
|
3
|
+
export declare const Product: mongoose.Model<IProduct, {}, {}, {}, mongoose.Document<unknown, {}, IProduct, {}, {}> & IProduct & {
|
|
4
|
+
_id: mongoose.Types.ObjectId;
|
|
5
|
+
} & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>;
|
|
8
|
+
export default Product;
|
|
9
|
+
//# sourceMappingURL=product.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.model.d.ts","sourceRoot":"","sources":["../../src/models/product.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAmC3D,eAAO,MAAM,OAAO;;;;OAAqD,CAAC;AAC1E,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Product = void 0;
|
|
37
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
38
|
+
const productSchema = new mongoose_1.Schema({
|
|
39
|
+
name: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: [true, "Product name is required"],
|
|
42
|
+
trim: true,
|
|
43
|
+
},
|
|
44
|
+
slug: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: [true, "Product slug is required"],
|
|
47
|
+
trim: true,
|
|
48
|
+
lowercase: true,
|
|
49
|
+
unique: true,
|
|
50
|
+
},
|
|
51
|
+
description: {
|
|
52
|
+
type: String,
|
|
53
|
+
trim: true,
|
|
54
|
+
},
|
|
55
|
+
isActive: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true,
|
|
58
|
+
},
|
|
59
|
+
}, {
|
|
60
|
+
timestamps: true,
|
|
61
|
+
toJSON: { virtuals: true },
|
|
62
|
+
toObject: { virtuals: true },
|
|
63
|
+
});
|
|
64
|
+
productSchema.index({ slug: 1 });
|
|
65
|
+
productSchema.index({ isActive: 1 });
|
|
66
|
+
exports.Product = mongoose_1.default.model("Product", productSchema);
|
|
67
|
+
exports.default = exports.Product;
|