@brimble/models 1.4.87 → 1.4.88

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,3 +1,3 @@
1
1
  yarn run v1.22.19
2
2
  $ tsc -p .
3
- Done in 1.79s.
3
+ Done in 2.20s.
package/dist/index.d.ts CHANGED
@@ -8,11 +8,11 @@ export { default as Token } from "./token";
8
8
  export { default as Team } from "./team";
9
9
  export { default as Member } from "./member";
10
10
  export { default as Log } from "./logs";
11
- export { default as SubscriptionPlan } from "./subscription_plan";
11
+ export { default as SubscriptionPlan } from "./subscription";
12
12
  export { default as Card } from "./card";
13
13
  export { default as Server } from "./server";
14
14
  export { default as Tenancy } from "./tenancy";
15
- export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IServer, ITenancy, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscriptionPlan, ICard } from "./types";
15
+ export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IServer, ITenancy, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard } from "./types";
16
16
  export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES } from "./enum";
17
17
  import mongoose from "mongoose";
18
18
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
package/dist/index.js CHANGED
@@ -33,8 +33,8 @@ var member_1 = require("./member");
33
33
  Object.defineProperty(exports, "Member", { enumerable: true, get: function () { return __importDefault(member_1).default; } });
34
34
  var logs_1 = require("./logs");
35
35
  Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return __importDefault(logs_1).default; } });
36
- var subscription_plan_1 = require("./subscription_plan");
37
- Object.defineProperty(exports, "SubscriptionPlan", { enumerable: true, get: function () { return __importDefault(subscription_plan_1).default; } });
36
+ var subscription_1 = require("./subscription");
37
+ Object.defineProperty(exports, "SubscriptionPlan", { enumerable: true, get: function () { return __importDefault(subscription_1).default; } });
38
38
  var card_1 = require("./card");
39
39
  Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return __importDefault(card_1).default; } });
40
40
  var server_1 = require("./server");
@@ -0,0 +1,4 @@
1
+ /// <reference types="mongoose" />
2
+ import { ISubscription } from "./types";
3
+ declare const _default: import("mongoose").Model<ISubscription, {}, {}>;
4
+ export default _default;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("./enum");
5
+ const subscriptionPlanSchema = new mongoose_1.Schema({
6
+ team_id: {
7
+ type: mongoose_1.Schema.Types.ObjectId,
8
+ required: true,
9
+ ref: "Team",
10
+ },
11
+ admin_id: {
12
+ type: mongoose_1.Schema.Types.ObjectId,
13
+ required: true,
14
+ ref: "User",
15
+ },
16
+ plan_code: {
17
+ type: String,
18
+ required: true,
19
+ unique: true,
20
+ },
21
+ status: {
22
+ type: String,
23
+ enum: Object.values(enum_1.SUBSCRIPTION_STATUS),
24
+ default: enum_1.SUBSCRIPTION_STATUS.ACTIVE
25
+ },
26
+ specifications: {
27
+ type: Object,
28
+ default: {},
29
+ select: true
30
+ },
31
+ amount: Number,
32
+ debit_date: String,
33
+ start_date: String,
34
+ expiry_date: String,
35
+ reminder_date: String,
36
+ transaction_retries: Number,
37
+ }, {
38
+ timestamps: true,
39
+ collection: "subscriptions"
40
+ });
41
+ exports.default = (0, mongoose_1.model)("Subscription", subscriptionPlanSchema);
package/dist/team.js CHANGED
@@ -28,7 +28,7 @@ const teamSchema = new mongoose_1.Schema({
28
28
  subscription: {
29
29
  type: mongoose_1.Schema.Types.ObjectId,
30
30
  required: false,
31
- ref: "SubscriptionPlan",
31
+ ref: "Subscription",
32
32
  },
33
33
  tenant: { type: mongoose_1.Schema.Types.ObjectId, ref: "Tenancy", required: false }
34
34
  }, {
package/dist/tenancy.js CHANGED
@@ -24,10 +24,6 @@ const tenancySchema = new mongoose_1.Schema({
24
24
  type: String,
25
25
  required: true
26
26
  },
27
- directory: {
28
- type: String,
29
- required: true
30
- },
31
27
  storage_size: Number,
32
28
  memory: Number
33
29
  }, { timestamps: true });
@@ -10,7 +10,7 @@ export { ITeam } from "./team";
10
10
  export { IMember } from "./member";
11
11
  export { IInstalledIntegration } from "./installed_integration";
12
12
  export { ILog } from "./logs";
13
- export { ISubscriptionPlan } from "./subscription_plan";
13
+ export { ISubscription } from "./subscription";
14
14
  export { ICard } from "./card";
15
15
  export { ITenancy } from "./tenancy";
16
16
  export { IServer } from "./server";
@@ -8,4 +8,5 @@ export interface IServer extends Document {
8
8
  status: SERVER_STATUS;
9
9
  private_key: string;
10
10
  default: boolean;
11
+ directory: string;
11
12
  }
@@ -0,0 +1,16 @@
1
+ import { Document } from "mongoose";
2
+ import { SUBSCRIPTION_STATUS } from "../enum";
3
+ export interface ISubscription extends Document {
4
+ team_id: string;
5
+ admin_id: string;
6
+ plan_code: string;
7
+ status: SUBSCRIPTION_STATUS;
8
+ amount: number;
9
+ debit_date: string;
10
+ start_date: string;
11
+ expiry_date: string;
12
+ reminder_date: string;
13
+ specifications: {
14
+ [key: string]: any;
15
+ };
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import { Document } from "mongoose";
2
- import { IMember, IProject, ISubscriptionPlan, ITenancy } from "./";
2
+ import { IMember, IProject, ISubscription, ITenancy } from "./";
3
3
  export interface ITeam extends Document {
4
4
  name: string;
5
5
  description: string;
@@ -8,5 +8,5 @@ export interface ITeam extends Document {
8
8
  image: string;
9
9
  isCreator: boolean;
10
10
  tenant: ITenancy;
11
- subscription: ISubscriptionPlan;
11
+ subscription: ISubscription;
12
12
  }
package/index.ts CHANGED
@@ -8,7 +8,7 @@ export { default as Token } from "./token";
8
8
  export { default as Team } from "./team";
9
9
  export { default as Member } from "./member";
10
10
  export { default as Log } from "./logs";
11
- export { default as SubscriptionPlan } from "./subscription_plan";
11
+ export { default as SubscriptionPlan } from "./subscription";
12
12
  export { default as Card } from "./card";
13
13
  export { default as Server } from "./server";
14
14
  export { default as Tenancy } from "./tenancy";
@@ -28,7 +28,7 @@ export {
28
28
  ITeam,
29
29
  IInstalledIntegration,
30
30
  ILog,
31
- ISubscriptionPlan,
31
+ ISubscription,
32
32
  ICard
33
33
  } from "./types";
34
34
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.4.87",
3
+ "version": "1.4.88",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,5 +21,5 @@
21
21
  "ts-node": "^8.10.2",
22
22
  "typescript": "^4.9.4"
23
23
  },
24
- "gitHead": "35bdfc202d17e6b5763e3ee6704ba3c84b760151"
24
+ "gitHead": "a27fbadaa6239b541cc151b7e277f444b44720c9"
25
25
  }
@@ -1,6 +1,6 @@
1
1
  import { model, Schema } from "mongoose";
2
2
  import {SUBSCRIPTION_STATUS} from "./enum";
3
- import {ISubscriptionPlan} from "./types";
3
+ import {ISubscription} from "./types";
4
4
 
5
5
  const subscriptionPlanSchema: Schema = new Schema({
6
6
  team_id: {
@@ -31,13 +31,14 @@ const subscriptionPlanSchema: Schema = new Schema({
31
31
  amount: Number,
32
32
  debit_date: String,
33
33
  start_date: String,
34
+ expiry_date: String,
34
35
  reminder_date: String,
35
36
  transaction_retries: Number,
36
37
  },
37
38
  {
38
39
  timestamps: true,
39
- collection: "subscription_plans"
40
+ collection: "subscriptions"
40
41
  },
41
42
  );
42
43
 
43
- export default model<ISubscriptionPlan>("SubscriptionPlan", subscriptionPlanSchema);
44
+ export default model<ISubscription>("Subscription", subscriptionPlanSchema);
package/team.ts CHANGED
@@ -29,7 +29,7 @@ const teamSchema: Schema = new Schema(
29
29
  subscription: {
30
30
  type: Schema.Types.ObjectId,
31
31
  required: false,
32
- ref: "SubscriptionPlan",
32
+ ref: "Subscription",
33
33
  },
34
34
  tenant: { type: Schema.Types.ObjectId, ref: "Tenancy", required: false }
35
35
  },
package/tenancy.ts CHANGED
@@ -25,10 +25,6 @@ const tenancySchema = new Schema(
25
25
  type: String,
26
26
  required: true
27
27
  },
28
- directory: {
29
- type: String,
30
- required: true
31
- },
32
28
  storage_size: Number,
33
29
  memory: Number
34
30
  },
package/types/index.ts CHANGED
@@ -10,7 +10,7 @@ export { ITeam } from "./team";
10
10
  export { IMember } from "./member";
11
11
  export { IInstalledIntegration } from "./installed_integration";
12
12
  export { ILog } from "./logs";
13
- export { ISubscriptionPlan } from "./subscription_plan";
13
+ export { ISubscription } from "./subscription";
14
14
  export { ICard } from "./card";
15
15
  export { ITenancy } from "./tenancy";
16
16
  export { IServer } from "./server";
package/types/server.ts CHANGED
@@ -15,4 +15,6 @@ export interface IServer extends Document {
15
15
  private_key: string;
16
16
 
17
17
  default: boolean;
18
+
19
+ directory: string;
18
20
  }
@@ -1,6 +1,7 @@
1
1
  import { Document } from "mongoose";
2
2
  import {SUBSCRIPTION_STATUS} from "../enum";
3
- export interface ISubscriptionPlan extends Document {
3
+
4
+ export interface ISubscription extends Document {
4
5
  team_id: string;
5
6
  admin_id: string;
6
7
  plan_code: string;
@@ -8,6 +9,7 @@ export interface ISubscriptionPlan extends Document {
8
9
  amount: number;
9
10
  debit_date: string;
10
11
  start_date: string;
12
+ expiry_date: string;
11
13
  reminder_date: string;
12
14
  specifications: {
13
15
  [key: string]: any;
package/types/team.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Document } from "mongoose";
2
- import {IMember, IProject, ISubscriptionPlan, ITenancy} from "./";
2
+ import {IMember, IProject, ISubscription, ITenancy} from "./";
3
3
 
4
4
  export interface ITeam extends Document {
5
5
  name: string;
@@ -9,5 +9,5 @@ export interface ITeam extends Document {
9
9
  image: string;
10
10
  isCreator: boolean;
11
11
  tenant: ITenancy;
12
- subscription: ISubscriptionPlan;
12
+ subscription: ISubscription;
13
13
  }