@brimble/models 1.5.41 → 1.6.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/.turbo/turbo-build.log +0 -0
- package/dist/enum/index.d.ts +12 -4
- package/dist/enum/index.js +15 -6
- package/dist/index.d.ts +5 -2
- package/dist/index.js +8 -1
- package/dist/member-permission.d.ts +4 -0
- package/dist/member-permission.js +10 -0
- package/dist/member.js +1 -0
- package/dist/permission.d.ts +4 -0
- package/dist/permission.js +10 -0
- package/dist/project/index.js +2 -4
- package/dist/project/preview.js +0 -2
- package/dist/role.d.ts +4 -0
- package/dist/role.js +10 -0
- package/dist/server.js +7 -4
- package/dist/types/index.d.ts +3 -0
- package/dist/types/member-permission.d.ts +8 -0
- package/dist/types/member-permission.js +2 -0
- package/dist/types/member.d.ts +2 -0
- package/dist/types/permission.d.ts +8 -0
- package/dist/types/permission.js +2 -0
- package/dist/types/project/index.d.ts +0 -2
- package/dist/types/project/preview.d.ts +0 -2
- package/dist/types/role.d.ts +9 -0
- package/dist/types/role.js +2 -0
- package/dist/types/server.d.ts +0 -2
- package/enum/index.ts +14 -5
- package/index.ts +7 -0
- package/member-permission.ts +11 -0
- package/member.ts +1 -0
- package/package.json +1 -1
- package/permission.ts +11 -0
- package/project/index.ts +0 -1
- package/project/preview.ts +0 -1
- package/role.ts +11 -0
- package/server.ts +16 -3
- package/types/index.ts +3 -0
- package/types/member-permission.ts +11 -0
- package/types/member.ts +2 -0
- package/types/permission.ts +11 -0
- package/types/project/index.ts +0 -1
- package/types/project/preview.ts +0 -1
- package/types/role.ts +13 -0
- package/types/server.ts +0 -2
- package/brimble.json +0 -3
package/.turbo/turbo-build.log
CHANGED
|
File without changes
|
package/dist/enum/index.d.ts
CHANGED
|
@@ -28,10 +28,6 @@ export declare enum INTEGRATION_PROVIDERS {
|
|
|
28
28
|
Netlify = "NETLIFY",
|
|
29
29
|
GoogleAnalytics = "GOOGLE_ANALYTICS"
|
|
30
30
|
}
|
|
31
|
-
export declare enum ROLES {
|
|
32
|
-
CREATOR = "CREATOR",
|
|
33
|
-
MEMBER = "MEMBER"
|
|
34
|
-
}
|
|
35
31
|
export declare enum CARD_TYPES {
|
|
36
32
|
MASTERCARD = "MASTERCARD",
|
|
37
33
|
VISA = "VISA",
|
|
@@ -72,3 +68,15 @@ export declare enum DNS_TYPE {
|
|
|
72
68
|
MX = "MX",
|
|
73
69
|
SPF = "SPF"
|
|
74
70
|
}
|
|
71
|
+
export declare enum ROLES {
|
|
72
|
+
CREATOR = "CREATOR",
|
|
73
|
+
ADMINISTRATOR = "ADMINISTRATOR",
|
|
74
|
+
MEMBER = "MEMBER"
|
|
75
|
+
}
|
|
76
|
+
export declare enum PERMISSION_TYPE {
|
|
77
|
+
DOMAIN = "DOMAIN",
|
|
78
|
+
BILLING = "BILLING",
|
|
79
|
+
PROJECT = "PROJECT",
|
|
80
|
+
DNS = "DNS",
|
|
81
|
+
USERS = "USERS"
|
|
82
|
+
}
|
package/dist/enum/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.
|
|
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;
|
|
4
4
|
var GIT_TYPE;
|
|
5
5
|
(function (GIT_TYPE) {
|
|
6
6
|
GIT_TYPE["GITHUB"] = "GITHUB";
|
|
@@ -35,11 +35,6 @@ var INTEGRATION_PROVIDERS;
|
|
|
35
35
|
INTEGRATION_PROVIDERS["Netlify"] = "NETLIFY";
|
|
36
36
|
INTEGRATION_PROVIDERS["GoogleAnalytics"] = "GOOGLE_ANALYTICS";
|
|
37
37
|
})(INTEGRATION_PROVIDERS = exports.INTEGRATION_PROVIDERS || (exports.INTEGRATION_PROVIDERS = {}));
|
|
38
|
-
var ROLES;
|
|
39
|
-
(function (ROLES) {
|
|
40
|
-
ROLES["CREATOR"] = "CREATOR";
|
|
41
|
-
ROLES["MEMBER"] = "MEMBER";
|
|
42
|
-
})(ROLES = exports.ROLES || (exports.ROLES = {}));
|
|
43
38
|
var CARD_TYPES;
|
|
44
39
|
(function (CARD_TYPES) {
|
|
45
40
|
CARD_TYPES["MASTERCARD"] = "MASTERCARD";
|
|
@@ -87,3 +82,17 @@ var DNS_TYPE;
|
|
|
87
82
|
DNS_TYPE["MX"] = "MX";
|
|
88
83
|
DNS_TYPE["SPF"] = "SPF";
|
|
89
84
|
})(DNS_TYPE = exports.DNS_TYPE || (exports.DNS_TYPE = {}));
|
|
85
|
+
var ROLES;
|
|
86
|
+
(function (ROLES) {
|
|
87
|
+
ROLES["CREATOR"] = "CREATOR";
|
|
88
|
+
ROLES["ADMINISTRATOR"] = "ADMINISTRATOR";
|
|
89
|
+
ROLES["MEMBER"] = "MEMBER";
|
|
90
|
+
})(ROLES = exports.ROLES || (exports.ROLES = {}));
|
|
91
|
+
var PERMISSION_TYPE;
|
|
92
|
+
(function (PERMISSION_TYPE) {
|
|
93
|
+
PERMISSION_TYPE["DOMAIN"] = "DOMAIN";
|
|
94
|
+
PERMISSION_TYPE["BILLING"] = "BILLING";
|
|
95
|
+
PERMISSION_TYPE["PROJECT"] = "PROJECT";
|
|
96
|
+
PERMISSION_TYPE["DNS"] = "DNS";
|
|
97
|
+
PERMISSION_TYPE["USERS"] = "USERS";
|
|
98
|
+
})(PERMISSION_TYPE = exports.PERMISSION_TYPE || (exports.PERMISSION_TYPE = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -9,12 +9,15 @@ export { default as Env } from "./env";
|
|
|
9
9
|
export { default as Token } from "./token";
|
|
10
10
|
export { default as Team } from "./team";
|
|
11
11
|
export { default as Member } from "./member";
|
|
12
|
+
export { default as Permission } from "./permission";
|
|
13
|
+
export { default as MemberPermission } from "./member-permission";
|
|
14
|
+
export { default as Role } from "./role";
|
|
12
15
|
export { default as Log } from "./logs";
|
|
13
16
|
export { default as SubscriptionPlan } from "./subscription";
|
|
14
17
|
export { default as Card } from "./card";
|
|
15
18
|
export { default as Server } from "./server";
|
|
16
|
-
export { IUser, IGit, IProject, IPreview, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, } from "./types";
|
|
17
|
-
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, } from "./enum";
|
|
19
|
+
export { IUser, IGit, IProject, IPreview, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission } from "./types";
|
|
20
|
+
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 } from "./enum";
|
|
18
21
|
import mongoose from "mongoose";
|
|
19
22
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
20
23
|
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.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.Server = exports.Card = exports.SubscriptionPlan = exports.Log = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.Preview = exports.Project = exports.User = void 0;
|
|
15
|
+
exports.closeMongo = exports.db = exports.connectToMongo = 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.Server = exports.Card = exports.SubscriptionPlan = 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.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");
|
|
@@ -35,6 +35,12 @@ var team_1 = require("./team");
|
|
|
35
35
|
Object.defineProperty(exports, "Team", { enumerable: true, get: function () { return __importDefault(team_1).default; } });
|
|
36
36
|
var member_1 = require("./member");
|
|
37
37
|
Object.defineProperty(exports, "Member", { enumerable: true, get: function () { return __importDefault(member_1).default; } });
|
|
38
|
+
var permission_1 = require("./permission");
|
|
39
|
+
Object.defineProperty(exports, "Permission", { enumerable: true, get: function () { return __importDefault(permission_1).default; } });
|
|
40
|
+
var member_permission_1 = require("./member-permission");
|
|
41
|
+
Object.defineProperty(exports, "MemberPermission", { enumerable: true, get: function () { return __importDefault(member_permission_1).default; } });
|
|
42
|
+
var role_1 = require("./role");
|
|
43
|
+
Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return __importDefault(role_1).default; } });
|
|
38
44
|
var logs_1 = require("./logs");
|
|
39
45
|
Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return __importDefault(logs_1).default; } });
|
|
40
46
|
var subscription_1 = require("./subscription");
|
|
@@ -56,6 +62,7 @@ Object.defineProperty(exports, "PROJECT_STATUS", { enumerable: true, get: functi
|
|
|
56
62
|
Object.defineProperty(exports, "SUBSCRIPTION_STATUS", { enumerable: true, get: function () { return enum_1.SUBSCRIPTION_STATUS; } });
|
|
57
63
|
Object.defineProperty(exports, "CARD_TYPES", { enumerable: true, get: function () { return enum_1.CARD_TYPES; } });
|
|
58
64
|
Object.defineProperty(exports, "DNS_TYPE", { enumerable: true, get: function () { return enum_1.DNS_TYPE; } });
|
|
65
|
+
Object.defineProperty(exports, "PERMISSION_TYPE", { enumerable: true, get: function () { return enum_1.PERMISSION_TYPE; } });
|
|
59
66
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
60
67
|
const utils_1 = require("@brimble/utils");
|
|
61
68
|
const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const memberPermissionSchema = new mongoose_1.Schema({
|
|
5
|
+
permission: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Permission' },
|
|
6
|
+
member: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Member' },
|
|
7
|
+
role: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Role' },
|
|
8
|
+
enabled: { type: Boolean, default: false }
|
|
9
|
+
});
|
|
10
|
+
exports.default = (0, mongoose_1.model)("MemberPermission", memberPermissionSchema);
|
package/dist/member.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const permissionSchema = new mongoose_1.Schema({
|
|
6
|
+
name: { type: String },
|
|
7
|
+
role: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Role' },
|
|
8
|
+
type: { type: String, enum: Object.values(enum_1.PERMISSION_TYPE) }
|
|
9
|
+
});
|
|
10
|
+
exports.default = (0, mongoose_1.model)("Permission", permissionSchema);
|
package/dist/project/index.js
CHANGED
|
@@ -97,7 +97,7 @@ const projectSchema = new mongoose_1.Schema({
|
|
|
97
97
|
from: mongoose_1.Schema.Types.ObjectId,
|
|
98
98
|
container_stats_schedule_id: {
|
|
99
99
|
type: String,
|
|
100
|
-
default: null
|
|
100
|
+
default: null
|
|
101
101
|
},
|
|
102
102
|
previews: [
|
|
103
103
|
{
|
|
@@ -109,8 +109,6 @@ const projectSchema = new mongoose_1.Schema({
|
|
|
109
109
|
type: Number,
|
|
110
110
|
default: 3,
|
|
111
111
|
},
|
|
112
|
-
specs: Object
|
|
113
|
-
last_requested: mongoose_1.Schema.Types.Date,
|
|
114
|
-
isPaused: Boolean,
|
|
112
|
+
specs: Object
|
|
115
113
|
}, { timestamps: true });
|
|
116
114
|
exports.default = (0, mongoose_1.model)("Project", projectSchema);
|
package/dist/project/preview.js
CHANGED
|
@@ -27,7 +27,5 @@ const previewsSchema = new mongoose_1.Schema({
|
|
|
27
27
|
ref: "Log",
|
|
28
28
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
29
29
|
},
|
|
30
|
-
last_requested: mongoose_1.Schema.Types.Date,
|
|
31
|
-
isPaused: Boolean,
|
|
32
30
|
}, { timestamps: true });
|
|
33
31
|
exports.default = (0, mongoose_1.model)("Preview", previewsSchema);
|
package/dist/role.d.ts
ADDED
package/dist/role.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const roleSchema = new mongoose_1.Schema({
|
|
6
|
+
type: { type: String, enum: Object.values(enum_1.ROLES) },
|
|
7
|
+
description: { type: String },
|
|
8
|
+
is_custom: { type: Boolean, default: false }
|
|
9
|
+
});
|
|
10
|
+
exports.default = (0, mongoose_1.model)("Role", roleSchema);
|
package/dist/server.js
CHANGED
|
@@ -4,14 +4,18 @@ const mongoose_1 = require("mongoose");
|
|
|
4
4
|
const enum_1 = require("./enum");
|
|
5
5
|
const serverSchema = new mongoose_1.Schema({
|
|
6
6
|
name: {
|
|
7
|
-
type:
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
ref: "User",
|
|
8
9
|
required: true,
|
|
9
10
|
},
|
|
10
|
-
|
|
11
|
+
url: {
|
|
11
12
|
type: String,
|
|
12
13
|
required: true,
|
|
13
14
|
},
|
|
14
|
-
|
|
15
|
+
ip_address: {
|
|
16
|
+
ref: "Team",
|
|
17
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
18
|
+
},
|
|
15
19
|
server_type: String,
|
|
16
20
|
status: {
|
|
17
21
|
type: String,
|
|
@@ -27,7 +31,6 @@ const serverSchema = new mongoose_1.Schema({
|
|
|
27
31
|
type: Boolean,
|
|
28
32
|
default: false,
|
|
29
33
|
},
|
|
30
|
-
region: String,
|
|
31
34
|
tag: String,
|
|
32
35
|
}, { timestamps: true });
|
|
33
36
|
exports.default = (0, mongoose_1.model)("Server", serverSchema);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,3 +15,6 @@ export { ILog } from "./logs";
|
|
|
15
15
|
export { ISubscription } from "./subscription";
|
|
16
16
|
export { ICard } from "./card";
|
|
17
17
|
export { IServer } from "./server";
|
|
18
|
+
export { IPermission } from "./permission";
|
|
19
|
+
export { IRole } from "./role";
|
|
20
|
+
export { IMemberPermission } from "./member-permission";
|
package/dist/types/member.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
2
|
import { ROLES } from "../enum";
|
|
3
3
|
import { ITeam, IUser } from "./";
|
|
4
|
+
import { IMemberPermission } from "./member-permission";
|
|
4
5
|
export interface IMember extends Document {
|
|
5
6
|
user: IUser;
|
|
6
7
|
team: ITeam;
|
|
@@ -8,4 +9,5 @@ export interface IMember extends Document {
|
|
|
8
9
|
accepted: boolean;
|
|
9
10
|
invitedBy: IUser;
|
|
10
11
|
email: string;
|
|
12
|
+
permissions: IMemberPermission[];
|
|
11
13
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { ROLES } from "../enum";
|
|
3
|
+
import { IPermission } from "./permission";
|
|
4
|
+
export interface IRole extends Document {
|
|
5
|
+
type: ROLES;
|
|
6
|
+
description?: string;
|
|
7
|
+
is_custom?: boolean;
|
|
8
|
+
default_permissions: IPermission[];
|
|
9
|
+
}
|
package/dist/types/server.d.ts
CHANGED
package/enum/index.ts
CHANGED
|
@@ -32,11 +32,6 @@ export enum INTEGRATION_PROVIDERS {
|
|
|
32
32
|
GoogleAnalytics = "GOOGLE_ANALYTICS",
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export enum ROLES {
|
|
36
|
-
CREATOR = "CREATOR",
|
|
37
|
-
MEMBER = "MEMBER",
|
|
38
|
-
}
|
|
39
|
-
|
|
40
35
|
export enum CARD_TYPES {
|
|
41
36
|
MASTERCARD = "MASTERCARD",
|
|
42
37
|
VISA = "VISA",
|
|
@@ -83,3 +78,17 @@ export enum DNS_TYPE {
|
|
|
83
78
|
MX = "MX",
|
|
84
79
|
SPF = "SPF",
|
|
85
80
|
}
|
|
81
|
+
|
|
82
|
+
export enum ROLES {
|
|
83
|
+
CREATOR = "CREATOR",
|
|
84
|
+
ADMINISTRATOR = "ADMINISTRATOR",
|
|
85
|
+
MEMBER = "MEMBER"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export enum PERMISSION_TYPE {
|
|
89
|
+
DOMAIN = 'DOMAIN',
|
|
90
|
+
BILLING = 'BILLING',
|
|
91
|
+
PROJECT = 'PROJECT',
|
|
92
|
+
DNS = 'DNS',
|
|
93
|
+
USERS = 'USERS'
|
|
94
|
+
}
|
package/index.ts
CHANGED
|
@@ -9,6 +9,9 @@ export { default as Env } from "./env";
|
|
|
9
9
|
export { default as Token } from "./token";
|
|
10
10
|
export { default as Team } from "./team";
|
|
11
11
|
export { default as Member } from "./member";
|
|
12
|
+
export { default as Permission } from "./permission";
|
|
13
|
+
export { default as MemberPermission } from "./member-permission";
|
|
14
|
+
export { default as Role } from "./role";
|
|
12
15
|
export { default as Log } from "./logs";
|
|
13
16
|
export { default as SubscriptionPlan } from "./subscription";
|
|
14
17
|
export { default as Card } from "./card";
|
|
@@ -31,6 +34,9 @@ export {
|
|
|
31
34
|
ISubscription,
|
|
32
35
|
ICard,
|
|
33
36
|
IDns,
|
|
37
|
+
IRole,
|
|
38
|
+
IPermission,
|
|
39
|
+
IMemberPermission
|
|
34
40
|
} from "./types";
|
|
35
41
|
export {
|
|
36
42
|
GIT_TYPE,
|
|
@@ -45,6 +51,7 @@ export {
|
|
|
45
51
|
SUBSCRIPTION_STATUS,
|
|
46
52
|
CARD_TYPES,
|
|
47
53
|
DNS_TYPE,
|
|
54
|
+
PERMISSION_TYPE
|
|
48
55
|
} from "./enum";
|
|
49
56
|
|
|
50
57
|
import mongoose from "mongoose";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import { IMemberPermission } from "./types/member-permission";
|
|
3
|
+
|
|
4
|
+
const memberPermissionSchema = new Schema({
|
|
5
|
+
permission: { type: Schema.Types.ObjectId, ref: 'Permission' },
|
|
6
|
+
member: { type: Schema.Types.ObjectId, ref: 'Member' },
|
|
7
|
+
role: { type: Schema.Types.ObjectId, ref: 'Role' },
|
|
8
|
+
enabled: { type: Boolean, default: false }
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default model<IMemberPermission>("MemberPermission", memberPermissionSchema);
|
package/member.ts
CHANGED
package/package.json
CHANGED
package/permission.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import { IPermission } from "./types/permission";
|
|
3
|
+
import { PERMISSION_TYPE } from "./enum";
|
|
4
|
+
|
|
5
|
+
const permissionSchema = new Schema({
|
|
6
|
+
name: { type: String },
|
|
7
|
+
role: { type: Schema.Types.ObjectId, ref: 'Role' },
|
|
8
|
+
type: { type: String, enum: Object.values(PERMISSION_TYPE) }
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default model<IPermission>("Permission", permissionSchema);
|
package/project/index.ts
CHANGED
package/project/preview.ts
CHANGED
package/role.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import { ROLES } from "./enum";
|
|
3
|
+
import { IRole } from "./types/role";
|
|
4
|
+
|
|
5
|
+
const roleSchema = new Schema({
|
|
6
|
+
type: { type: String, enum: Object.values(ROLES) },
|
|
7
|
+
description: { type: String },
|
|
8
|
+
is_custom: { type: Boolean, default: false }
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default model<IRole>("Role", roleSchema);
|
package/server.ts
CHANGED
|
@@ -5,30 +5,43 @@ import { SERVER_STATUS } from "./enum";
|
|
|
5
5
|
const serverSchema = new Schema(
|
|
6
6
|
{
|
|
7
7
|
name: {
|
|
8
|
-
type:
|
|
8
|
+
type: Schema.Types.ObjectId,
|
|
9
|
+
ref: "User",
|
|
9
10
|
required: true,
|
|
10
11
|
},
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
url: {
|
|
12
14
|
type: String,
|
|
13
15
|
required: true,
|
|
14
16
|
},
|
|
15
|
-
|
|
17
|
+
|
|
18
|
+
ip_address: {
|
|
19
|
+
ref: "Team",
|
|
20
|
+
type: Schema.Types.ObjectId,
|
|
21
|
+
},
|
|
22
|
+
|
|
16
23
|
server_type: String,
|
|
24
|
+
|
|
17
25
|
status: {
|
|
18
26
|
type: String,
|
|
19
27
|
enum: Object.values(SERVER_STATUS),
|
|
20
28
|
default: SERVER_STATUS.Active,
|
|
21
29
|
},
|
|
30
|
+
|
|
22
31
|
default: Boolean,
|
|
32
|
+
|
|
23
33
|
is_custom_provision: {
|
|
24
34
|
type: Boolean,
|
|
25
35
|
default: true,
|
|
26
36
|
},
|
|
37
|
+
|
|
27
38
|
is_downscaled: {
|
|
28
39
|
type: Boolean,
|
|
29
40
|
default: false,
|
|
30
41
|
},
|
|
42
|
+
|
|
31
43
|
region: String,
|
|
44
|
+
|
|
32
45
|
tag: String,
|
|
33
46
|
},
|
|
34
47
|
{ timestamps: true },
|
package/types/index.ts
CHANGED
|
@@ -15,3 +15,6 @@ export { ILog } from "./logs";
|
|
|
15
15
|
export { ISubscription } from "./subscription";
|
|
16
16
|
export { ICard } from "./card";
|
|
17
17
|
export { IServer } from "./server";
|
|
18
|
+
export { IPermission } from "./permission";
|
|
19
|
+
export { IRole } from "./role";
|
|
20
|
+
export { IMemberPermission } from "./member-permission";
|
package/types/member.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
2
|
import { ROLES } from "../enum";
|
|
3
3
|
import { ITeam, IUser } from "./";
|
|
4
|
+
import { IMemberPermission } from "./member-permission";
|
|
4
5
|
|
|
5
6
|
export interface IMember extends Document {
|
|
6
7
|
user: IUser;
|
|
@@ -9,4 +10,5 @@ export interface IMember extends Document {
|
|
|
9
10
|
accepted: boolean;
|
|
10
11
|
invitedBy: IUser;
|
|
11
12
|
email: string;
|
|
13
|
+
permissions: IMemberPermission[]
|
|
12
14
|
}
|
package/types/project/index.ts
CHANGED
package/types/project/preview.ts
CHANGED
package/types/role.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { ROLES } from "../enum";
|
|
3
|
+
import { IPermission } from "./permission";
|
|
4
|
+
|
|
5
|
+
export interface IRole extends Document {
|
|
6
|
+
type: ROLES;
|
|
7
|
+
|
|
8
|
+
description?: string;
|
|
9
|
+
|
|
10
|
+
is_custom?: boolean;
|
|
11
|
+
|
|
12
|
+
default_permissions: IPermission[];
|
|
13
|
+
}
|
package/types/server.ts
CHANGED
package/brimble.json
DELETED