orbitx-core-models 2.0.1 → 4.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/dist/index.d.ts CHANGED
@@ -3,11 +3,15 @@ import { Message } from "./models/message.model";
3
3
  import { User } from "./models/user.model";
4
4
  import { Vertical } from "./models/vertical.model";
5
5
  import { Macro } from "./models/macro.model";
6
+ import { Partner } from "./models/partner.model";
7
+ import { Company } from "./models/company.model";
6
8
  import { IChat } from "./interfaces/chat.interface";
7
9
  import { IMacro } from "./interfaces/macro.interface";
8
10
  import { IVertical } from "./interfaces/vertical.interface";
9
11
  import { IMessage } from "./interfaces/message.interface";
10
12
  import { IUser } from "./interfaces/user.interface";
11
- export { Chat, Message, User, Vertical, Macro };
12
- export type { IChat, IMessage, IUser, IVertical, IMacro };
13
+ import { IPartner } from "./interfaces/partner.interface";
14
+ import { ICompany } from "./interfaces/company.interface";
15
+ export { Chat, Message, User, Vertical, Macro, Partner, Company };
16
+ export type { IChat, IMessage, IUser, IVertical, IMacro, IPartner, ICompany };
13
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAChD,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAClE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
3
+ exports.Company = exports.Partner = exports.Macro = exports.Vertical = exports.User = exports.Message = exports.Chat = void 0;
4
4
  // MODELS
5
5
  const chat_model_1 = require("./models/chat.model");
6
6
  Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_model_1.Chat; } });
@@ -12,3 +12,7 @@ const vertical_model_1 = require("./models/vertical.model");
12
12
  Object.defineProperty(exports, "Vertical", { enumerable: true, get: function () { return vertical_model_1.Vertical; } });
13
13
  const macro_model_1 = require("./models/macro.model");
14
14
  Object.defineProperty(exports, "Macro", { enumerable: true, get: function () { return macro_model_1.Macro; } });
15
+ const partner_model_1 = require("./models/partner.model");
16
+ Object.defineProperty(exports, "Partner", { enumerable: true, get: function () { return partner_model_1.Partner; } });
17
+ const company_model_1 = require("./models/company.model");
18
+ Object.defineProperty(exports, "Company", { enumerable: true, get: function () { return company_model_1.Company; } });
@@ -0,0 +1,54 @@
1
+ import { Types } from "mongoose";
2
+ export type DayOfWeek = "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday";
3
+ export interface IHour {
4
+ day: DayOfWeek;
5
+ startTime: string;
6
+ endTime: string;
7
+ active?: boolean;
8
+ }
9
+ export interface IBasicInfo {
10
+ companyId: string;
11
+ host: string;
12
+ relationship?: "Customer" | "Partner";
13
+ website?: string;
14
+ language: string;
15
+ }
16
+ export interface IContactInfo {
17
+ name: string;
18
+ email: string;
19
+ phoneNumber?: string;
20
+ alternatePhoneNumber?: string;
21
+ officialBusinessName: string;
22
+ address: string;
23
+ city: string;
24
+ state: string;
25
+ zipcode: string;
26
+ country: string;
27
+ coverageArea?: string;
28
+ }
29
+ export interface ICallSettings {
30
+ timezone?: string;
31
+ phoneNumber?: string;
32
+ transcriptEmail?: string;
33
+ smsChatNumber?: string;
34
+ visitorGreeting?: string;
35
+ visitorGreetingDelay?: number;
36
+ businessGreeting?: string;
37
+ businessGreetingDelay?: number;
38
+ transcriptOverride?: boolean;
39
+ useCallConnectNumberForCallerId?: boolean;
40
+ companyNumberFirst?: boolean;
41
+ override?: boolean;
42
+ officeHoursMonitoring?: boolean;
43
+ }
44
+ export interface ICompany {
45
+ _id?: Types.ObjectId;
46
+ basicInfo: IBasicInfo;
47
+ contactInfo: IContactInfo;
48
+ callSettings: ICallSettings;
49
+ callConnectHours?: IHour[];
50
+ officeHours?: IHour[];
51
+ createdAt?: Date;
52
+ updatedAt?: Date;
53
+ }
54
+ //# sourceMappingURL=company.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/company.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,SAAS,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAC1C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,SAAS,EAAE,UAAU,CAAC;IACtB,WAAW,EAAE,YAAY,CAAC;IAC1B,YAAY,EAAE,aAAa,CAAC;IAC5B,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,38 @@
1
+ import { Types } from "mongoose";
2
+ export interface IAccountInfo {
3
+ firmName: string;
4
+ firmWebsite?: string;
5
+ firmOwner: string;
6
+ ownerPhone: string;
7
+ ownerEmail: string;
8
+ firmRepresentative?: string;
9
+ representativePhone?: string;
10
+ representativeEmail?: string;
11
+ firmAddress: string;
12
+ city: string;
13
+ state: string;
14
+ country: string;
15
+ taxId?: string;
16
+ registrationNo?: string;
17
+ businessType?: string;
18
+ }
19
+ export interface IPayoutInfo {
20
+ bankName?: string;
21
+ accountNumber?: string;
22
+ branchDetails?: string;
23
+ linkedCard?: string;
24
+ }
25
+ export interface IPayoutTier {
26
+ payoutInfo: IPayoutInfo;
27
+ tier: "Bronze" | "Silver" | "Gold";
28
+ featureAccess?: string[];
29
+ }
30
+ export interface IPartner {
31
+ _id?: Types.ObjectId;
32
+ accountInfo: IAccountInfo;
33
+ payoutTier: IPayoutTier;
34
+ status: "Active" | "Inactive";
35
+ createdAt?: Date;
36
+ updatedAt?: Date;
37
+ }
38
+ //# sourceMappingURL=partner.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/partner.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,WAAW,CAAC;IACxB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,WAAW,EAAE,YAAY,CAAC;IAC1B,UAAU,EAAE,WAAW,CAAC;IACxB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+ import { ICompany } from "../interfaces/company.interface";
3
+ export declare const Company: mongoose.Model<ICompany, {}, {}, {}, mongoose.Document<unknown, {}, ICompany, {}, {}> & ICompany & Required<{
4
+ _id: mongoose.Types.ObjectId;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ export default Company;
9
+ //# sourceMappingURL=company.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company.model.d.ts","sourceRoot":"","sources":["../../src/models/company.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;AAqLzC,eAAO,MAAM,OAAO;;;;OAAqD,CAAC;AAC1E,eAAe,OAAO,CAAC"}
@@ -0,0 +1,190 @@
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.Company = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const daysOfWeek = [
39
+ "Sunday",
40
+ "Monday",
41
+ "Tuesday",
42
+ "Wednesday",
43
+ "Thursday",
44
+ "Friday",
45
+ "Saturday",
46
+ ];
47
+ // Hour Schema
48
+ const hourSchema = new mongoose_1.Schema({
49
+ day: { type: String, enum: daysOfWeek, required: true },
50
+ startTime: {
51
+ type: String,
52
+ required: true,
53
+ match: [/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format. Use HH:mm."],
54
+ },
55
+ endTime: {
56
+ type: String,
57
+ required: true,
58
+ match: [/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format. Use HH:mm."],
59
+ },
60
+ active: { type: Boolean, default: false },
61
+ }, { _id: false });
62
+ // Company Schema
63
+ const companySchema = new mongoose_1.Schema({
64
+ basicInfo: {
65
+ companyId: {
66
+ type: String,
67
+ required: true,
68
+ unique: true,
69
+ trim: true,
70
+ },
71
+ host: { type: String, required: true, trim: true },
72
+ relationship: {
73
+ type: String,
74
+ enum: ["Customer", "Partner"],
75
+ },
76
+ website: {
77
+ type: String,
78
+ trim: true,
79
+ validate: {
80
+ validator: (v) => !v ? true : /^https?:\/\/[^\s$.?#].[^\s]*$/.test(v),
81
+ message: "Invalid URL format",
82
+ },
83
+ },
84
+ language: { type: String, required: true, trim: true },
85
+ },
86
+ contactInfo: {
87
+ name: { type: String, required: true, trim: true },
88
+ email: {
89
+ type: String,
90
+ required: true,
91
+ lowercase: true,
92
+ trim: true,
93
+ match: [/^\S+@\S+\.\S+$/, "Invalid email format"],
94
+ },
95
+ phoneNumber: {
96
+ type: String,
97
+ trim: true,
98
+ validate: {
99
+ validator: (v) => (!v ? true : /^\+?[\d\s-]{7,15}$/.test(v)),
100
+ message: "Invalid phone number format",
101
+ },
102
+ },
103
+ alternatePhoneNumber: {
104
+ type: String,
105
+ trim: true,
106
+ validate: {
107
+ validator: (v) => (!v ? true : /^\+?[\d\s-]{7,15}$/.test(v)),
108
+ message: "Invalid alternate phone number format",
109
+ },
110
+ },
111
+ officialBusinessName: {
112
+ type: String,
113
+ required: true,
114
+ trim: true,
115
+ lowercase: true,
116
+ },
117
+ address: { type: String, required: true, trim: true },
118
+ city: { type: String, required: true, trim: true },
119
+ state: { type: String, required: true, trim: true },
120
+ zipcode: { type: String, required: true, trim: true },
121
+ country: { type: String, required: true, trim: true },
122
+ coverageArea: { type: String, trim: true },
123
+ },
124
+ callSettings: {
125
+ timezone: { type: String, trim: true },
126
+ phoneNumber: {
127
+ type: String,
128
+ trim: true,
129
+ validate: {
130
+ validator: (v) => (!v ? true : /^\+?[\d\s-]{7,15}$/.test(v)),
131
+ message: "Invalid call connect phone number format",
132
+ },
133
+ },
134
+ transcriptEmail: {
135
+ type: String,
136
+ trim: true,
137
+ lowercase: true,
138
+ match: [/^\S+@\S+\.\S+$/, "Invalid transcript email format"],
139
+ },
140
+ smsChatNumber: {
141
+ type: String,
142
+ trim: true,
143
+ validate: {
144
+ validator: (v) => (!v ? true : /^\+?[\d\s-]{7,15}$/.test(v)),
145
+ message: "Invalid SMS chat number format",
146
+ },
147
+ },
148
+ visitorGreeting: { type: String, trim: true },
149
+ visitorGreetingDelay: { type: Number, min: 0, default: 0 },
150
+ businessGreeting: { type: String, trim: true },
151
+ businessGreetingDelay: { type: Number, min: 0, default: 0 },
152
+ transcriptOverride: { type: Boolean, default: false },
153
+ useCallConnectNumberForCallerId: { type: Boolean, default: false },
154
+ companyNumberFirst: { type: Boolean, default: false },
155
+ override: { type: Boolean, default: false },
156
+ officeHoursMonitoring: { type: Boolean, default: false },
157
+ },
158
+ callConnectHours: {
159
+ type: [hourSchema],
160
+ validate: {
161
+ validator: (arr) => {
162
+ const days = arr.map((h) => h.day);
163
+ return days.length === new Set(days).size;
164
+ },
165
+ message: "Duplicate days in call connect hours",
166
+ },
167
+ },
168
+ officeHours: {
169
+ type: [hourSchema],
170
+ validate: {
171
+ validator: (arr) => {
172
+ const days = arr.map((h) => h.day);
173
+ return days.length === new Set(days).size;
174
+ },
175
+ message: "Duplicate days in office hours",
176
+ },
177
+ },
178
+ }, {
179
+ timestamps: true,
180
+ toJSON: { virtuals: true },
181
+ toObject: { virtuals: true },
182
+ });
183
+ // Indexes
184
+ companySchema.index({ "contactInfo.officialBusinessName": 1 });
185
+ companySchema.index({ status: 1 });
186
+ companySchema.index({ "basicInfo.host": 1 });
187
+ companySchema.index({ "basicInfo.website": 1 });
188
+ companySchema.index({ "contactInfo.state": 1 });
189
+ exports.Company = mongoose_1.default.model("Company", companySchema);
190
+ exports.default = exports.Company;
@@ -0,0 +1,9 @@
1
+ import mongoose from "mongoose";
2
+ import { IPartner } from "../interfaces/partner.interface";
3
+ export declare const Partner: mongoose.Model<IPartner, {}, {}, {}, mongoose.Document<unknown, {}, IPartner, {}, {}> & IPartner & Required<{
4
+ _id: mongoose.Types.ObjectId;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
8
+ export default Partner;
9
+ //# sourceMappingURL=partner.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner.model.d.ts","sourceRoot":"","sources":["../../src/models/partner.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;AAyGzC,eAAO,MAAM,OAAO;;;;OAAqD,CAAC;AAC1E,eAAe,OAAO,CAAC"}
@@ -0,0 +1,122 @@
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.Partner = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const accountInfoSchema = new mongoose_1.Schema({
39
+ firmName: { type: String, required: true, trim: true },
40
+ firmWebsite: {
41
+ type: String,
42
+ trim: true,
43
+ validate: {
44
+ validator: (v) => !v ? true : /^https?:\/\/[^\s$.?#].[^\s]*$/.test(v),
45
+ message: "Invalid URL format",
46
+ },
47
+ },
48
+ firmOwner: { type: String, required: true, trim: true },
49
+ ownerPhone: {
50
+ type: String,
51
+ required: true,
52
+ trim: true,
53
+ validate: {
54
+ validator: (v) => /^\+?[\d\s-]{7,15}$/.test(v),
55
+ message: "Invalid phone number format",
56
+ },
57
+ },
58
+ ownerEmail: {
59
+ type: String,
60
+ required: true,
61
+ lowercase: true,
62
+ match: [/^\S+@\S+\.\S+$/, "Invalid email format"],
63
+ },
64
+ firmRepresentative: { type: String, trim: true },
65
+ representativePhone: {
66
+ type: String,
67
+ trim: true,
68
+ validate: {
69
+ validator: (v) => (!v ? true : /^\+?[\d\s-]{7,15}$/.test(v)),
70
+ message: "Invalid phone number format",
71
+ },
72
+ },
73
+ representativeEmail: {
74
+ type: String,
75
+ trim: true,
76
+ lowercase: true,
77
+ match: [/^\S+@\S+\.\S+$/, "Invalid email format"],
78
+ },
79
+ firmAddress: { type: String, required: true, trim: true },
80
+ city: { type: String, required: true, trim: true },
81
+ state: { type: String, required: true, trim: true },
82
+ country: { type: String, required: true, trim: true },
83
+ taxId: { type: String, trim: true },
84
+ registrationNo: { type: String, trim: true },
85
+ businessType: { type: String, trim: true },
86
+ });
87
+ const payoutTierSchema = new mongoose_1.Schema({
88
+ payoutInfo: {
89
+ bankName: { type: String, trim: true },
90
+ accountNumber: { type: String, trim: true },
91
+ branchDetails: { type: String, trim: true },
92
+ linkedCard: { type: String, trim: true },
93
+ },
94
+ tier: {
95
+ type: String,
96
+ enum: ["Bronze", "Silver", "Gold"],
97
+ default: "Bronze",
98
+ },
99
+ featureAccess: {
100
+ type: [String],
101
+ default: [],
102
+ },
103
+ });
104
+ const partnerSchema = new mongoose_1.Schema({
105
+ accountInfo: accountInfoSchema,
106
+ payoutTier: payoutTierSchema,
107
+ status: {
108
+ type: String,
109
+ enum: ["Active", "Inactive"],
110
+ default: "Active",
111
+ },
112
+ }, {
113
+ timestamps: true,
114
+ toJSON: { virtuals: true },
115
+ toObject: { virtuals: true },
116
+ });
117
+ // Indexes
118
+ partnerSchema.index({ "accountInfo.firmName": 1 });
119
+ partnerSchema.index({ "accountInfo.firmOwner": 1 });
120
+ partnerSchema.index({ "accountInfo.firmWebsite": 1 });
121
+ exports.Partner = mongoose_1.default.model("Partner", partnerSchema);
122
+ exports.default = exports.Partner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orbitx-core-models",
3
- "version": "2.0.1",
3
+ "version": "4.0.0",
4
4
  "description": "Shared Mongoose models and interfaces for OrbitX services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",