@brimble/models 2.1.9 → 2.2.1
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/enum/index.d.ts +10 -2
- package/dist/enum/index.js +10 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -1
- package/dist/liscense.d.ts +56 -0
- package/dist/liscense.js +34 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/liscense.d.ts +9 -0
- package/dist/types/liscense.js +2 -0
- package/enum/index.ts +9 -0
- package/index.ts +5 -2
- package/liscense.ts +36 -0
- package/package.json +1 -1
- package/types/index.ts +1 -0
- package/types/liscense.ts +11 -0
package/dist/enum/index.d.ts
CHANGED
|
@@ -56,7 +56,8 @@ export declare enum SUBSCRIPTION_PLAN_TYPE {
|
|
|
56
56
|
FreePlan = "FREE_PLAN",
|
|
57
57
|
DeveloperPlan = "DEVELOPER_PLAN",
|
|
58
58
|
TeamPlan = "TEAM_PLAN",
|
|
59
|
-
DatabasePlan = "DATABASE_PLAN"
|
|
59
|
+
DatabasePlan = "DATABASE_PLAN",
|
|
60
|
+
LiscensePlan = "LISCENSE_PLAN"
|
|
60
61
|
}
|
|
61
62
|
export declare enum OAUTH_PERMISSIONS {
|
|
62
63
|
READ_USER = "read_user",
|
|
@@ -89,7 +90,8 @@ export declare enum PERMISSION_TYPE {
|
|
|
89
90
|
}
|
|
90
91
|
export declare enum ServiceType {
|
|
91
92
|
Database = "database",
|
|
92
|
-
WebService = "web-service"
|
|
93
|
+
WebService = "web-service",
|
|
94
|
+
Liscense = "liscense"
|
|
93
95
|
}
|
|
94
96
|
export declare enum DatabaseEngine {
|
|
95
97
|
MySQL = "mysql",
|
|
@@ -106,3 +108,9 @@ export declare enum JobStatus {
|
|
|
106
108
|
FAILED = "failed",
|
|
107
109
|
CANCELLED = "cancelled"
|
|
108
110
|
}
|
|
111
|
+
export declare enum LicenseStatus {
|
|
112
|
+
ACTIVE = "ACTIVE",
|
|
113
|
+
EXPIRED = "EXPIRED",
|
|
114
|
+
SUSPENDED = "SUSPENDED",
|
|
115
|
+
REVOKED = "REVOKED"
|
|
116
|
+
}
|
package/dist/enum/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.GIT_TYPE = void 0;
|
|
3
|
+
exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.PERMISSION_TYPE = exports.ROLES = exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.REQUEST_TYPE = exports.GIT_TYPE = void 0;
|
|
4
4
|
var GIT_TYPE;
|
|
5
5
|
(function (GIT_TYPE) {
|
|
6
6
|
GIT_TYPE["GITHUB"] = "GITHUB";
|
|
@@ -69,6 +69,7 @@ var SUBSCRIPTION_PLAN_TYPE;
|
|
|
69
69
|
SUBSCRIPTION_PLAN_TYPE["DeveloperPlan"] = "DEVELOPER_PLAN";
|
|
70
70
|
SUBSCRIPTION_PLAN_TYPE["TeamPlan"] = "TEAM_PLAN";
|
|
71
71
|
SUBSCRIPTION_PLAN_TYPE["DatabasePlan"] = "DATABASE_PLAN";
|
|
72
|
+
SUBSCRIPTION_PLAN_TYPE["LiscensePlan"] = "LISCENSE_PLAN";
|
|
72
73
|
})(SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_PLAN_TYPE || (exports.SUBSCRIPTION_PLAN_TYPE = {}));
|
|
73
74
|
var OAUTH_PERMISSIONS;
|
|
74
75
|
(function (OAUTH_PERMISSIONS) {
|
|
@@ -108,6 +109,7 @@ var ServiceType;
|
|
|
108
109
|
(function (ServiceType) {
|
|
109
110
|
ServiceType["Database"] = "database";
|
|
110
111
|
ServiceType["WebService"] = "web-service";
|
|
112
|
+
ServiceType["Liscense"] = "liscense";
|
|
111
113
|
})(ServiceType = exports.ServiceType || (exports.ServiceType = {}));
|
|
112
114
|
var DatabaseEngine;
|
|
113
115
|
(function (DatabaseEngine) {
|
|
@@ -126,3 +128,10 @@ var JobStatus;
|
|
|
126
128
|
JobStatus["FAILED"] = "failed";
|
|
127
129
|
JobStatus["CANCELLED"] = "cancelled";
|
|
128
130
|
})(JobStatus = exports.JobStatus || (exports.JobStatus = {}));
|
|
131
|
+
var LicenseStatus;
|
|
132
|
+
(function (LicenseStatus) {
|
|
133
|
+
LicenseStatus["ACTIVE"] = "ACTIVE";
|
|
134
|
+
LicenseStatus["EXPIRED"] = "EXPIRED";
|
|
135
|
+
LicenseStatus["SUSPENDED"] = "SUSPENDED";
|
|
136
|
+
LicenseStatus["REVOKED"] = "REVOKED";
|
|
137
|
+
})(LicenseStatus = exports.LicenseStatus || (exports.LicenseStatus = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export { default as Server } from "./server";
|
|
|
19
19
|
export { default as Wallet } from "./wallet";
|
|
20
20
|
export { default as DbImage } from "./db-image";
|
|
21
21
|
export { default as Job } from "./job";
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
22
|
+
export { default as Liscense } from "./liscense";
|
|
23
|
+
export { IUser, IGit, IProject, IPreview, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense } from "./types";
|
|
24
|
+
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, DatabaseEngine, JobStatus, LicenseStatus } from "./enum";
|
|
24
25
|
import mongoose from "mongoose";
|
|
25
26
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
26
27
|
export declare const db: mongoose.Connection;
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.closeMongo = exports.db = exports.connectToMongo = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.Preview = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
15
|
+
exports.closeMongo = exports.db = exports.connectToMongo = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.Liscense = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.Preview = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
16
16
|
var user_1 = require("./user");
|
|
17
17
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
|
|
18
18
|
var project_1 = require("./project");
|
|
@@ -56,6 +56,8 @@ var db_image_1 = require("./db-image");
|
|
|
56
56
|
Object.defineProperty(exports, "DbImage", { enumerable: true, get: function () { return __importDefault(db_image_1).default; } });
|
|
57
57
|
var job_1 = require("./job");
|
|
58
58
|
Object.defineProperty(exports, "Job", { enumerable: true, get: function () { return __importDefault(job_1).default; } });
|
|
59
|
+
var liscense_1 = require("./liscense");
|
|
60
|
+
Object.defineProperty(exports, "Liscense", { enumerable: true, get: function () { return __importDefault(liscense_1).default; } });
|
|
59
61
|
var enum_1 = require("./enum");
|
|
60
62
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
61
63
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -74,6 +76,7 @@ Object.defineProperty(exports, "REQUEST_TYPE", { enumerable: true, get: function
|
|
|
74
76
|
Object.defineProperty(exports, "ServiceType", { enumerable: true, get: function () { return enum_1.ServiceType; } });
|
|
75
77
|
Object.defineProperty(exports, "DatabaseEngine", { enumerable: true, get: function () { return enum_1.DatabaseEngine; } });
|
|
76
78
|
Object.defineProperty(exports, "JobStatus", { enumerable: true, get: function () { return enum_1.JobStatus; } });
|
|
79
|
+
Object.defineProperty(exports, "LicenseStatus", { enumerable: true, get: function () { return enum_1.LicenseStatus; } });
|
|
77
80
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
78
81
|
const utils_1 = require("@brimble/utils");
|
|
79
82
|
const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/aggregate" />
|
|
26
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/callback" />
|
|
27
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/collection" />
|
|
28
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/connection" />
|
|
29
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/cursor" />
|
|
30
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/document" />
|
|
31
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/error" />
|
|
32
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/expressions" />
|
|
33
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/helpers" />
|
|
34
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/middlewares" />
|
|
35
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/indexes" />
|
|
36
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/models" />
|
|
37
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/mongooseoptions" />
|
|
38
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/pipelinestage" />
|
|
39
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/populate" />
|
|
40
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/query" />
|
|
41
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/schemaoptions" />
|
|
42
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/schematypes" />
|
|
43
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/session" />
|
|
44
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/types" />
|
|
45
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/utility" />
|
|
46
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/validation" />
|
|
47
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/virtuals" />
|
|
48
|
+
/// <reference types="mongoose-delete/node_modules/mongoose" />
|
|
49
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
50
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/inferschematype" />
|
|
51
|
+
/// <reference types="mongoose-delete/node_modules/mongoose/types/inferrawdoctype" />
|
|
52
|
+
import { ILicense } from "./types/liscense";
|
|
53
|
+
declare const _default: import("mongoose").Model<ILicense, {}, {}, {}, import("mongoose").Document<unknown, {}, ILicense> & ILicense & {
|
|
54
|
+
_id: import("mongoose").Types.ObjectId;
|
|
55
|
+
}, any>;
|
|
56
|
+
export default _default;
|
package/dist/liscense.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const licenseSchema = new mongoose_1.Schema({
|
|
6
|
+
licenseKey: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
unique: true
|
|
10
|
+
},
|
|
11
|
+
userId: {
|
|
12
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
13
|
+
ref: 'User',
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
teamId: {
|
|
17
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
18
|
+
ref: 'Team',
|
|
19
|
+
required: false
|
|
20
|
+
},
|
|
21
|
+
subscriptionId: {
|
|
22
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
23
|
+
ref: 'Subscription',
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
status: {
|
|
27
|
+
type: String,
|
|
28
|
+
enum: Object.values(enum_1.LicenseStatus),
|
|
29
|
+
default: enum_1.LicenseStatus.ACTIVE
|
|
30
|
+
},
|
|
31
|
+
}, { timestamps: true });
|
|
32
|
+
licenseSchema.index({ userId: 1, status: 1 });
|
|
33
|
+
licenseSchema.index({ licenseKey: 1 });
|
|
34
|
+
exports.default = (0, mongoose_1.model)('License', licenseSchema, 'licenses');
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import mongoose, { Document } from "mongoose";
|
|
2
|
+
import { LicenseStatus } from "../enum";
|
|
3
|
+
export interface ILicense extends Document {
|
|
4
|
+
licenseKey: string;
|
|
5
|
+
userId: mongoose.Types.ObjectId;
|
|
6
|
+
teamId: mongoose.Types.ObjectId;
|
|
7
|
+
status: LicenseStatus;
|
|
8
|
+
subscriptionId: mongoose.Types.ObjectId;
|
|
9
|
+
}
|
package/enum/index.ts
CHANGED
|
@@ -65,6 +65,7 @@ export enum SUBSCRIPTION_PLAN_TYPE {
|
|
|
65
65
|
DeveloperPlan = 'DEVELOPER_PLAN',
|
|
66
66
|
TeamPlan = 'TEAM_PLAN',
|
|
67
67
|
DatabasePlan = 'DATABASE_PLAN',
|
|
68
|
+
LiscensePlan = 'LISCENSE_PLAN'
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export enum OAUTH_PERMISSIONS {
|
|
@@ -104,6 +105,7 @@ export enum PERMISSION_TYPE {
|
|
|
104
105
|
export enum ServiceType {
|
|
105
106
|
Database = 'database',
|
|
106
107
|
WebService = 'web-service',
|
|
108
|
+
Liscense = "liscense"
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
export enum DatabaseEngine {
|
|
@@ -122,3 +124,10 @@ export enum JobStatus {
|
|
|
122
124
|
FAILED = "failed",
|
|
123
125
|
CANCELLED = "cancelled",
|
|
124
126
|
}
|
|
127
|
+
|
|
128
|
+
export enum LicenseStatus {
|
|
129
|
+
ACTIVE = "ACTIVE",
|
|
130
|
+
EXPIRED = "EXPIRED",
|
|
131
|
+
SUSPENDED = "SUSPENDED",
|
|
132
|
+
REVOKED = "REVOKED"
|
|
133
|
+
}
|
package/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { default as Server } from "./server";
|
|
|
19
19
|
export { default as Wallet } from "./wallet";
|
|
20
20
|
export { default as DbImage } from "./db-image";
|
|
21
21
|
export { default as Job } from "./job";
|
|
22
|
+
export { default as Liscense } from "./liscense"
|
|
22
23
|
|
|
23
24
|
export {
|
|
24
25
|
IUser,
|
|
@@ -43,7 +44,8 @@ export {
|
|
|
43
44
|
IMemberPermission,
|
|
44
45
|
IWallet,
|
|
45
46
|
IDbImage,
|
|
46
|
-
IJob
|
|
47
|
+
IJob,
|
|
48
|
+
ILicense
|
|
47
49
|
} from "./types";
|
|
48
50
|
export {
|
|
49
51
|
GIT_TYPE,
|
|
@@ -62,7 +64,8 @@ export {
|
|
|
62
64
|
REQUEST_TYPE,
|
|
63
65
|
ServiceType,
|
|
64
66
|
DatabaseEngine,
|
|
65
|
-
JobStatus
|
|
67
|
+
JobStatus,
|
|
68
|
+
LicenseStatus
|
|
66
69
|
} from "./enum";
|
|
67
70
|
|
|
68
71
|
import mongoose from "mongoose";
|
package/liscense.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { ILicense } from "./types/liscense";
|
|
3
|
+
import { LicenseStatus } from "./enum";
|
|
4
|
+
|
|
5
|
+
const licenseSchema: Schema = new Schema({
|
|
6
|
+
licenseKey: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
unique: true
|
|
10
|
+
},
|
|
11
|
+
userId: {
|
|
12
|
+
type: Schema.Types.ObjectId,
|
|
13
|
+
ref: 'User',
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
teamId: {
|
|
17
|
+
type: Schema.Types.ObjectId,
|
|
18
|
+
ref: 'Team',
|
|
19
|
+
required: false
|
|
20
|
+
},
|
|
21
|
+
subscriptionId: {
|
|
22
|
+
type: Schema.Types.ObjectId,
|
|
23
|
+
ref: 'Subscription',
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
status: {
|
|
27
|
+
type: String,
|
|
28
|
+
enum: Object.values(LicenseStatus),
|
|
29
|
+
default: LicenseStatus.ACTIVE
|
|
30
|
+
},
|
|
31
|
+
}, { timestamps: true });
|
|
32
|
+
|
|
33
|
+
licenseSchema.index({ userId: 1, status: 1 });
|
|
34
|
+
licenseSchema.index({ licenseKey: 1 });
|
|
35
|
+
|
|
36
|
+
export default model<ILicense>('License', licenseSchema, 'licenses');
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import mongoose, { Document } from "mongoose";
|
|
2
|
+
import { LicenseStatus } from "../enum";
|
|
3
|
+
|
|
4
|
+
export interface ILicense extends Document {
|
|
5
|
+
licenseKey: string;
|
|
6
|
+
userId: mongoose.Types.ObjectId;
|
|
7
|
+
teamId: mongoose.Types.ObjectId;
|
|
8
|
+
status: LicenseStatus;
|
|
9
|
+
subscriptionId: mongoose.Types.ObjectId;
|
|
10
|
+
}
|
|
11
|
+
|