@brimble/models 3.7.96 → 3.7.98
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 +17 -0
- package/dist/enum/index.js +21 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -2
- package/dist/invoice.d.ts +30 -0
- package/dist/invoice.js +28 -0
- package/dist/subscription.js +8 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/invoice.d.ts +15 -0
- package/dist/types/invoice.js +2 -0
- package/enum/index.ts +20 -0
- package/index.ts +7 -2
- package/invoice.ts +36 -0
- package/package.json +1 -1
- package/subscription.ts +8 -0
- package/types/index.ts +1 -0
- package/types/invoice.ts +16 -0
package/dist/enum/index.d.ts
CHANGED
|
@@ -190,3 +190,20 @@ export declare enum COLLAB_TOOLBAR_POSITION {
|
|
|
190
190
|
BOTTOM = "bottom",
|
|
191
191
|
RIGHT = "right"
|
|
192
192
|
}
|
|
193
|
+
export declare enum INVOICE_STATUS {
|
|
194
|
+
ACTIVE = "ACTIVE",
|
|
195
|
+
PAID = "PAID",
|
|
196
|
+
EXPIRED = "EXPIRED"
|
|
197
|
+
}
|
|
198
|
+
export declare enum INVOICE_PAYMENT_STATUS {
|
|
199
|
+
PENDING = "PENDING",
|
|
200
|
+
PROCESSING = "PROCESSING",
|
|
201
|
+
SUCCESSFUL = "SUCCESSFUL",
|
|
202
|
+
FAILED = "FAILED",
|
|
203
|
+
REFUNDED = "REFUNDED",
|
|
204
|
+
REFUND_PROCESSING = "REFUND_PROCESSING"
|
|
205
|
+
}
|
|
206
|
+
export declare enum INVOICE_TYPE {
|
|
207
|
+
INVOICE = "invoice",
|
|
208
|
+
RECEIPT = "receipt"
|
|
209
|
+
}
|
package/dist/enum/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.BRANCH_TYPE = exports.NomadDeploymentStatus = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = 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.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
3
|
+
exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.BRANCH_TYPE = exports.NomadDeploymentStatus = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SCALING_METRIC = exports.SCALING_STRATEGY = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REGION_CONTINENT = 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.BUILD_DISABLED_BY = exports.SERVER_PROTOCOL = exports.GIT_TYPE = void 0;
|
|
4
4
|
var GIT_TYPE;
|
|
5
5
|
(function (GIT_TYPE) {
|
|
6
6
|
GIT_TYPE["GITHUB"] = "GITHUB";
|
|
@@ -224,3 +224,23 @@ var COLLAB_TOOLBAR_POSITION;
|
|
|
224
224
|
COLLAB_TOOLBAR_POSITION["BOTTOM"] = "bottom";
|
|
225
225
|
COLLAB_TOOLBAR_POSITION["RIGHT"] = "right";
|
|
226
226
|
})(COLLAB_TOOLBAR_POSITION = exports.COLLAB_TOOLBAR_POSITION || (exports.COLLAB_TOOLBAR_POSITION = {}));
|
|
227
|
+
var INVOICE_STATUS;
|
|
228
|
+
(function (INVOICE_STATUS) {
|
|
229
|
+
INVOICE_STATUS["ACTIVE"] = "ACTIVE";
|
|
230
|
+
INVOICE_STATUS["PAID"] = "PAID";
|
|
231
|
+
INVOICE_STATUS["EXPIRED"] = "EXPIRED";
|
|
232
|
+
})(INVOICE_STATUS = exports.INVOICE_STATUS || (exports.INVOICE_STATUS = {}));
|
|
233
|
+
var INVOICE_PAYMENT_STATUS;
|
|
234
|
+
(function (INVOICE_PAYMENT_STATUS) {
|
|
235
|
+
INVOICE_PAYMENT_STATUS["PENDING"] = "PENDING";
|
|
236
|
+
INVOICE_PAYMENT_STATUS["PROCESSING"] = "PROCESSING";
|
|
237
|
+
INVOICE_PAYMENT_STATUS["SUCCESSFUL"] = "SUCCESSFUL";
|
|
238
|
+
INVOICE_PAYMENT_STATUS["FAILED"] = "FAILED";
|
|
239
|
+
INVOICE_PAYMENT_STATUS["REFUNDED"] = "REFUNDED";
|
|
240
|
+
INVOICE_PAYMENT_STATUS["REFUND_PROCESSING"] = "REFUND_PROCESSING";
|
|
241
|
+
})(INVOICE_PAYMENT_STATUS = exports.INVOICE_PAYMENT_STATUS || (exports.INVOICE_PAYMENT_STATUS = {}));
|
|
242
|
+
var INVOICE_TYPE;
|
|
243
|
+
(function (INVOICE_TYPE) {
|
|
244
|
+
INVOICE_TYPE["INVOICE"] = "invoice";
|
|
245
|
+
INVOICE_TYPE["RECEIPT"] = "receipt";
|
|
246
|
+
})(INVOICE_TYPE = exports.INVOICE_TYPE || (exports.INVOICE_TYPE = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -43,8 +43,9 @@ export { default as CollabSettings } from "./collab-settings";
|
|
|
43
43
|
export { default as CollabShareToken } from "./collab-share-token";
|
|
44
44
|
export { default as CollabPushSubscription } from "./collab-push-subscription";
|
|
45
45
|
export { default as AppMessage } from "./app-message";
|
|
46
|
-
export {
|
|
47
|
-
export {
|
|
46
|
+
export { default as Invoice } from "./invoice";
|
|
47
|
+
export { IUser, IGit, IProject, IPreview, IProjectConnection, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, IBranch, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice } from "./types";
|
|
48
|
+
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, REGION_CONTINENT, BUILD_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, NomadDeploymentStatus, BRANCH_TYPE, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE } from "./enum";
|
|
48
49
|
import mongoose from "mongoose";
|
|
49
50
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
50
51
|
export declare const db: mongoose.Connection;
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ 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.
|
|
16
|
-
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.BRANCH_TYPE = exports.NomadDeploymentStatus = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = 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 = void 0;
|
|
15
|
+
exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Branch = exports.Provider = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = exports.DomainRenewal = exports.LoadBalancerPort = exports.Settings = exports.Framework = exports.Volume = exports.Region = exports.ComputeChange = exports.AutoScalingGroup = exports.PlanConfiguration = 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.ProjectConnection = exports.Preview = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
16
|
+
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.BRANCH_TYPE = exports.NomadDeploymentStatus = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = 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 = void 0;
|
|
17
17
|
var user_1 = require("./user");
|
|
18
18
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
|
|
19
19
|
var project_1 = require("./project");
|
|
@@ -105,6 +105,8 @@ var collab_push_subscription_1 = require("./collab-push-subscription");
|
|
|
105
105
|
Object.defineProperty(exports, "CollabPushSubscription", { enumerable: true, get: function () { return __importDefault(collab_push_subscription_1).default; } });
|
|
106
106
|
var app_message_1 = require("./app-message");
|
|
107
107
|
Object.defineProperty(exports, "AppMessage", { enumerable: true, get: function () { return __importDefault(app_message_1).default; } });
|
|
108
|
+
var invoice_1 = require("./invoice");
|
|
109
|
+
Object.defineProperty(exports, "Invoice", { enumerable: true, get: function () { return __importDefault(invoice_1).default; } });
|
|
108
110
|
var enum_1 = require("./enum");
|
|
109
111
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
110
112
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -135,6 +137,9 @@ Object.defineProperty(exports, "COLLAB_ANNOTATION_STATUS", { enumerable: true, g
|
|
|
135
137
|
Object.defineProperty(exports, "COLLAB_INTEGRATION_TYPE", { enumerable: true, get: function () { return enum_1.COLLAB_INTEGRATION_TYPE; } });
|
|
136
138
|
Object.defineProperty(exports, "COLLAB_THEME", { enumerable: true, get: function () { return enum_1.COLLAB_THEME; } });
|
|
137
139
|
Object.defineProperty(exports, "COLLAB_TOOLBAR_POSITION", { enumerable: true, get: function () { return enum_1.COLLAB_TOOLBAR_POSITION; } });
|
|
140
|
+
Object.defineProperty(exports, "INVOICE_STATUS", { enumerable: true, get: function () { return enum_1.INVOICE_STATUS; } });
|
|
141
|
+
Object.defineProperty(exports, "INVOICE_PAYMENT_STATUS", { enumerable: true, get: function () { return enum_1.INVOICE_PAYMENT_STATUS; } });
|
|
142
|
+
Object.defineProperty(exports, "INVOICE_TYPE", { enumerable: true, get: function () { return enum_1.INVOICE_TYPE; } });
|
|
138
143
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
139
144
|
const utils_1 = require("@brimble/utils");
|
|
140
145
|
const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -0,0 +1,30 @@
|
|
|
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/types/inferschematype" />
|
|
26
|
+
import { IInvoice } from "./types";
|
|
27
|
+
declare const _default: import("mongoose").Model<IInvoice, {}, {}, {}, import("mongoose").Document<unknown, {}, IInvoice> & IInvoice & {
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
}, any>;
|
|
30
|
+
export default _default;
|
package/dist/invoice.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const invoiceSchema = new mongoose_1.Schema({
|
|
6
|
+
ref: String,
|
|
7
|
+
user_id: String,
|
|
8
|
+
subscription_id: String,
|
|
9
|
+
total_amount: Number,
|
|
10
|
+
due: Boolean,
|
|
11
|
+
type: {
|
|
12
|
+
type: String,
|
|
13
|
+
enum: Object.values(enum_1.INVOICE_TYPE),
|
|
14
|
+
},
|
|
15
|
+
status: {
|
|
16
|
+
type: String,
|
|
17
|
+
enum: Object.values(enum_1.INVOICE_STATUS),
|
|
18
|
+
},
|
|
19
|
+
payment_status: {
|
|
20
|
+
type: String,
|
|
21
|
+
enum: Object.values(enum_1.INVOICE_PAYMENT_STATUS),
|
|
22
|
+
},
|
|
23
|
+
billing_period: String,
|
|
24
|
+
}, {
|
|
25
|
+
timestamps: true,
|
|
26
|
+
collection: "invoices",
|
|
27
|
+
});
|
|
28
|
+
exports.default = (0, mongoose_1.model)("Invoice", invoiceSchema);
|
package/dist/subscription.js
CHANGED
|
@@ -7,6 +7,10 @@ const subscriptionSchema = new mongoose_1.Schema({
|
|
|
7
7
|
type: String,
|
|
8
8
|
required: true,
|
|
9
9
|
},
|
|
10
|
+
due_amount: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 0
|
|
13
|
+
},
|
|
10
14
|
team_id: {
|
|
11
15
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
12
16
|
ref: "Team",
|
|
@@ -49,6 +53,10 @@ const subscriptionSchema = new mongoose_1.Schema({
|
|
|
49
53
|
expiry_date: String,
|
|
50
54
|
reminder_date: String,
|
|
51
55
|
transaction_retries: Number,
|
|
56
|
+
downgraded: {
|
|
57
|
+
default: false,
|
|
58
|
+
type: Boolean
|
|
59
|
+
},
|
|
52
60
|
is_pending_downgrade: {
|
|
53
61
|
type: Boolean,
|
|
54
62
|
default: false,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -45,3 +45,4 @@ export type { ICollabSettings } from "./collab-settings";
|
|
|
45
45
|
export type { ICollabShareToken } from "./collab-share-token";
|
|
46
46
|
export type { ICollabPushSubscription } from "./collab-push-subscription";
|
|
47
47
|
export type { IAppMessage } from "./app-message";
|
|
48
|
+
export type { IInvoice } from "./invoice";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE } from "../enum";
|
|
3
|
+
export interface IInvoice extends Document {
|
|
4
|
+
ref: string;
|
|
5
|
+
user_id: string;
|
|
6
|
+
subscription_id: string;
|
|
7
|
+
total_amount: number;
|
|
8
|
+
due: boolean;
|
|
9
|
+
type: INVOICE_TYPE;
|
|
10
|
+
status: INVOICE_STATUS;
|
|
11
|
+
payment_status: INVOICE_PAYMENT_STATUS;
|
|
12
|
+
billing_period: string;
|
|
13
|
+
created_at: Date;
|
|
14
|
+
updated_at: Date;
|
|
15
|
+
}
|
package/enum/index.ts
CHANGED
|
@@ -220,3 +220,23 @@ export enum COLLAB_TOOLBAR_POSITION {
|
|
|
220
220
|
BOTTOM = "bottom",
|
|
221
221
|
RIGHT = "right",
|
|
222
222
|
}
|
|
223
|
+
|
|
224
|
+
export enum INVOICE_STATUS {
|
|
225
|
+
ACTIVE = "ACTIVE",
|
|
226
|
+
PAID = "PAID",
|
|
227
|
+
EXPIRED = "EXPIRED",
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export enum INVOICE_PAYMENT_STATUS {
|
|
231
|
+
PENDING = "PENDING",
|
|
232
|
+
PROCESSING = "PROCESSING",
|
|
233
|
+
SUCCESSFUL = "SUCCESSFUL",
|
|
234
|
+
FAILED = "FAILED",
|
|
235
|
+
REFUNDED = "REFUNDED",
|
|
236
|
+
REFUND_PROCESSING = "REFUND_PROCESSING",
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export enum INVOICE_TYPE {
|
|
240
|
+
INVOICE = "invoice",
|
|
241
|
+
RECEIPT = "receipt",
|
|
242
|
+
}
|
package/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ export { default as CollabSettings } from "./collab-settings";
|
|
|
43
43
|
export { default as CollabShareToken } from "./collab-share-token";
|
|
44
44
|
export { default as CollabPushSubscription } from "./collab-push-subscription";
|
|
45
45
|
export { default as AppMessage } from "./app-message";
|
|
46
|
+
export { default as Invoice } from "./invoice";
|
|
46
47
|
|
|
47
48
|
export {
|
|
48
49
|
IUser,
|
|
@@ -93,7 +94,8 @@ export {
|
|
|
93
94
|
ICollabSettings,
|
|
94
95
|
ICollabShareToken,
|
|
95
96
|
ICollabPushSubscription,
|
|
96
|
-
IAppMessage
|
|
97
|
+
IAppMessage,
|
|
98
|
+
IInvoice
|
|
97
99
|
} from "./types";
|
|
98
100
|
export {
|
|
99
101
|
GIT_TYPE,
|
|
@@ -124,7 +126,10 @@ export {
|
|
|
124
126
|
COLLAB_ANNOTATION_STATUS,
|
|
125
127
|
COLLAB_INTEGRATION_TYPE,
|
|
126
128
|
COLLAB_THEME,
|
|
127
|
-
COLLAB_TOOLBAR_POSITION
|
|
129
|
+
COLLAB_TOOLBAR_POSITION,
|
|
130
|
+
INVOICE_STATUS,
|
|
131
|
+
INVOICE_PAYMENT_STATUS,
|
|
132
|
+
INVOICE_TYPE
|
|
128
133
|
} from "./enum";
|
|
129
134
|
|
|
130
135
|
import mongoose from "mongoose";
|
package/invoice.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import {
|
|
3
|
+
INVOICE_STATUS,
|
|
4
|
+
INVOICE_PAYMENT_STATUS,
|
|
5
|
+
INVOICE_TYPE,
|
|
6
|
+
} from "./enum";
|
|
7
|
+
import { IInvoice } from "./types";
|
|
8
|
+
|
|
9
|
+
const invoiceSchema: Schema = new Schema(
|
|
10
|
+
{
|
|
11
|
+
ref: String,
|
|
12
|
+
user_id: String,
|
|
13
|
+
subscription_id: String,
|
|
14
|
+
total_amount: Number,
|
|
15
|
+
due: Boolean,
|
|
16
|
+
type: {
|
|
17
|
+
type: String,
|
|
18
|
+
enum: Object.values(INVOICE_TYPE),
|
|
19
|
+
},
|
|
20
|
+
status: {
|
|
21
|
+
type: String,
|
|
22
|
+
enum: Object.values(INVOICE_STATUS),
|
|
23
|
+
},
|
|
24
|
+
payment_status: {
|
|
25
|
+
type: String,
|
|
26
|
+
enum: Object.values(INVOICE_PAYMENT_STATUS),
|
|
27
|
+
},
|
|
28
|
+
billing_period: String,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
timestamps: true,
|
|
32
|
+
collection: "invoices",
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export default model<IInvoice>("Invoice", invoiceSchema);
|
package/package.json
CHANGED
package/subscription.ts
CHANGED
|
@@ -8,6 +8,10 @@ const subscriptionSchema: Schema = new Schema(
|
|
|
8
8
|
type: String,
|
|
9
9
|
required: true,
|
|
10
10
|
},
|
|
11
|
+
due_amount: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 0
|
|
14
|
+
},
|
|
11
15
|
team_id: {
|
|
12
16
|
type: Schema.Types.ObjectId,
|
|
13
17
|
ref: "Team",
|
|
@@ -50,6 +54,10 @@ const subscriptionSchema: Schema = new Schema(
|
|
|
50
54
|
expiry_date: String,
|
|
51
55
|
reminder_date: String,
|
|
52
56
|
transaction_retries: Number,
|
|
57
|
+
downgraded: {
|
|
58
|
+
default: false,
|
|
59
|
+
type: Boolean
|
|
60
|
+
},
|
|
53
61
|
is_pending_downgrade: {
|
|
54
62
|
type: Boolean,
|
|
55
63
|
default: false,
|
package/types/index.ts
CHANGED
|
@@ -45,3 +45,4 @@ export type { ICollabSettings } from "./collab-settings";
|
|
|
45
45
|
export type { ICollabShareToken } from "./collab-share-token";
|
|
46
46
|
export type { ICollabPushSubscription } from "./collab-push-subscription";
|
|
47
47
|
export type { IAppMessage } from "./app-message";
|
|
48
|
+
export type { IInvoice } from "./invoice";
|
package/types/invoice.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE } from "../enum";
|
|
3
|
+
|
|
4
|
+
export interface IInvoice extends Document {
|
|
5
|
+
ref: string;
|
|
6
|
+
user_id: string;
|
|
7
|
+
subscription_id: string;
|
|
8
|
+
total_amount: number;
|
|
9
|
+
due: boolean;
|
|
10
|
+
type: INVOICE_TYPE;
|
|
11
|
+
status: INVOICE_STATUS;
|
|
12
|
+
payment_status: INVOICE_PAYMENT_STATUS;
|
|
13
|
+
billing_period: string;
|
|
14
|
+
created_at: Date;
|
|
15
|
+
updated_at: Date;
|
|
16
|
+
}
|