@brimble/models 1.6.4 → 1.6.6

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.
@@ -3,6 +3,12 @@ export declare enum GIT_TYPE {
3
3
  GITLAB = "GITLAB",
4
4
  BITBUCKET = "BITBUCKET"
5
5
  }
6
+ export declare enum REQUEST_TYPE {
7
+ GET = "GET",
8
+ PUT = "PUT",
9
+ POST = "POST",
10
+ DELETE = "DELETE"
11
+ }
6
12
  export declare enum ENVIRONMENT {
7
13
  PREVIEW = "PREVIEW",
8
14
  PRODUCTION = "PRODUCTION"
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.GIT_TYPE = void 0;
3
+ 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";
7
7
  GIT_TYPE["GITLAB"] = "GITLAB";
8
8
  GIT_TYPE["BITBUCKET"] = "BITBUCKET";
9
9
  })(GIT_TYPE = exports.GIT_TYPE || (exports.GIT_TYPE = {}));
10
+ var REQUEST_TYPE;
11
+ (function (REQUEST_TYPE) {
12
+ REQUEST_TYPE["GET"] = "GET";
13
+ REQUEST_TYPE["PUT"] = "PUT";
14
+ REQUEST_TYPE["POST"] = "POST";
15
+ REQUEST_TYPE["DELETE"] = "DELETE";
16
+ })(REQUEST_TYPE = exports.REQUEST_TYPE || (exports.REQUEST_TYPE = {}));
10
17
  var ENVIRONMENT;
11
18
  (function (ENVIRONMENT) {
12
19
  ENVIRONMENT["PREVIEW"] = "PREVIEW";
@@ -5,7 +5,8 @@ const enum_1 = require("./enum");
5
5
  const permissionSchema = new mongoose_1.Schema({
6
6
  title: { type: String },
7
7
  role: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Role' }],
8
- route: { type: String, required: true },
9
- type: { type: String, enum: Object.values(enum_1.PERMISSION_TYPE) }
8
+ request: { type: Object },
9
+ type: { type: String, enum: Object.values(enum_1.PERMISSION_TYPE) },
10
+ enabled: { type: Boolean, default: false, select: true }
10
11
  });
11
12
  exports.default = (0, mongoose_1.model)("Permission", permissionSchema);
@@ -1,9 +1,13 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IRole } from "./role";
3
- import { PERMISSION_TYPE } from "../enum";
3
+ import { PERMISSION_TYPE, REQUEST_TYPE } from "../enum";
4
4
  export interface IPermission extends Document {
5
5
  title: string;
6
6
  role: IRole[];
7
7
  type: PERMISSION_TYPE;
8
- route: string;
8
+ request: {
9
+ route: string;
10
+ type: REQUEST_TYPE;
11
+ };
12
+ enabled: boolean;
9
13
  }
package/enum/index.ts CHANGED
@@ -4,6 +4,13 @@ export enum GIT_TYPE {
4
4
  BITBUCKET = "BITBUCKET",
5
5
  }
6
6
 
7
+ export enum REQUEST_TYPE {
8
+ GET = "GET",
9
+ PUT = "PUT",
10
+ POST = "POST",
11
+ DELETE = "DELETE"
12
+ }
13
+
7
14
  export enum ENVIRONMENT {
8
15
  PREVIEW = "PREVIEW",
9
16
  PRODUCTION = "PRODUCTION",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/permission.ts CHANGED
@@ -5,8 +5,9 @@ import { PERMISSION_TYPE } from "./enum";
5
5
  const permissionSchema = new Schema({
6
6
  title: { type: String },
7
7
  role: [{ type: Schema.Types.ObjectId, ref: 'Role' }],
8
- route: { type: String, required: true },
9
- type: { type: String, enum: Object.values(PERMISSION_TYPE) }
8
+ request: { type: Object },
9
+ type: { type: String, enum: Object.values(PERMISSION_TYPE) },
10
+ enabled: { type: Boolean, default: false, select: true }
10
11
  });
11
12
 
12
13
  export default model<IPermission>("Permission", permissionSchema);
package/project/index.ts CHANGED
@@ -112,6 +112,7 @@ const projectSchema = new Schema(
112
112
  },
113
113
  specs: Object,
114
114
  last_requested: Schema.Types.Date,
115
+ isPaused: Boolean,
115
116
  },
116
117
  { timestamps: true },
117
118
  );
@@ -29,6 +29,7 @@ const previewsSchema = new Schema(
29
29
  type: Schema.Types.ObjectId,
30
30
  },
31
31
  last_requested: Schema.Types.Date,
32
+ isPaused: Boolean,
32
33
  },
33
34
  { timestamps: true },
34
35
  );
package/server.ts CHANGED
@@ -5,43 +5,30 @@ import { SERVER_STATUS } from "./enum";
5
5
  const serverSchema = new Schema(
6
6
  {
7
7
  name: {
8
- type: Schema.Types.ObjectId,
9
- ref: "User",
10
- required: true,
11
- },
12
-
13
- url: {
14
8
  type: String,
15
9
  required: true,
16
10
  },
17
-
18
11
  ip_address: {
19
- ref: "Team",
20
- type: Schema.Types.ObjectId,
12
+ type: String,
13
+ required: true,
21
14
  },
22
-
15
+ url: String,
23
16
  server_type: String,
24
-
25
17
  status: {
26
18
  type: String,
27
19
  enum: Object.values(SERVER_STATUS),
28
20
  default: SERVER_STATUS.Active,
29
21
  },
30
-
31
22
  default: Boolean,
32
-
33
23
  is_custom_provision: {
34
24
  type: Boolean,
35
25
  default: true,
36
26
  },
37
-
38
27
  is_downscaled: {
39
28
  type: Boolean,
40
29
  default: false,
41
30
  },
42
-
43
31
  region: String,
44
-
45
32
  tag: String,
46
33
  },
47
34
  { timestamps: true },
@@ -1,6 +1,6 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IRole } from "./role";
3
- import { PERMISSION_TYPE } from "../enum";
3
+ import { PERMISSION_TYPE, REQUEST_TYPE } from "../enum";
4
4
 
5
5
  export interface IPermission extends Document {
6
6
  title: string;
@@ -9,5 +9,11 @@ export interface IPermission extends Document {
9
9
 
10
10
  type: PERMISSION_TYPE;
11
11
 
12
- route: string;
12
+ request: {
13
+ route: string;
14
+
15
+ type: REQUEST_TYPE;
16
+ };
17
+
18
+ enabled: boolean;
13
19
  }
@@ -60,4 +60,5 @@ export interface IProject extends Document {
60
60
  cpu: number;
61
61
  };
62
62
  last_requested: Date;
63
+ isPaused: boolean;
63
64
  }
@@ -17,4 +17,5 @@ export interface IPreview extends Document {
17
17
  status: PROJECT_STATUS;
18
18
  log: ILog;
19
19
  last_requested: Date;
20
+ isPaused: boolean;
20
21
  }