@brimble/models 1.3.1 → 1.3.4
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/CHANGELOG.md +8 -0
- package/dist/domain.d.ts +4 -0
- package/dist/domain.js +19 -0
- package/dist/enum/index.d.ts +7 -0
- package/dist/enum/index.js +9 -1
- package/dist/env.d.ts +4 -0
- package/dist/env.js +18 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +27 -17
- package/dist/integration.d.ts +4 -0
- package/dist/integration.js +21 -0
- package/dist/project.js +32 -17
- package/dist/types/domain.d.ts +7 -0
- package/dist/types/domain.js +2 -0
- package/dist/types/env.d.ts +7 -0
- package/dist/types/env.js +2 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/integration.d.ts +10 -0
- package/dist/types/integration.js +2 -0
- package/dist/types/project.d.ts +17 -6
- package/dist/types/user.d.ts +2 -0
- package/dist/user.d.ts +2 -2
- package/dist/user.js +17 -25
- package/domain.ts +23 -0
- package/enum/index.ts +7 -0
- package/env.ts +22 -0
- package/index.ts +30 -16
- package/integration.ts +25 -0
- package/package.json +3 -3
- package/project.ts +33 -19
- package/types/domain.ts +8 -0
- package/types/env.ts +8 -0
- package/types/index.ts +3 -0
- package/types/integration.ts +16 -0
- package/types/project.ts +17 -6
- package/types/user.ts +4 -2
- package/user.ts +18 -7
- package/.turbo/turbo-build.log +0 -2
- package/.turbo/turbo-pre-push.log +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.3.2](https://github.com/brimblehq/brimble/compare/@brimble/models@1.3.1...@brimble/models@1.3.2) (2022-08-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @brimble/models
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [1.2.0-alpha.3](https://github.com/brimblehq/brimble/compare/@brimble/models@1.2.0-alpha.2...@brimble/models@1.2.0-alpha.3) (2022-05-05)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @brimble/models
|
package/dist/domain.d.ts
ADDED
package/dist/domain.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const domainSchema = new mongoose_1.Schema({
|
|
5
|
+
project: {
|
|
6
|
+
ref: "Project",
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
},
|
|
9
|
+
name: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
unique: true,
|
|
13
|
+
},
|
|
14
|
+
user_id: {
|
|
15
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
}, { timestamps: true });
|
|
19
|
+
exports.default = mongoose_1.model("Domain", domainSchema);
|
package/dist/enum/index.d.ts
CHANGED
package/dist/enum/index.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GIT_TYPE = void 0;
|
|
3
|
+
exports.INTEGRATION_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 INTEGRATION_TYPE;
|
|
11
|
+
(function (INTEGRATION_TYPE) {
|
|
12
|
+
INTEGRATION_TYPE["SLACK"] = "SLACK";
|
|
13
|
+
INTEGRATION_TYPE["ASANA"] = "ASANA";
|
|
14
|
+
INTEGRATION_TYPE["SENTRY"] = "SENTRY";
|
|
15
|
+
INTEGRATION_TYPE["DOPPLER"] = "DOPPLER";
|
|
16
|
+
INTEGRATION_TYPE["CONTENTFUL"] = "CONTENTFUL";
|
|
17
|
+
})(INTEGRATION_TYPE = exports.INTEGRATION_TYPE || (exports.INTEGRATION_TYPE = {}));
|
package/dist/env.d.ts
ADDED
package/dist/env.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const envSchema = new mongoose_1.Schema({
|
|
5
|
+
project: {
|
|
6
|
+
ref: "Project",
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
},
|
|
9
|
+
name: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
value: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
}, { timestamps: true });
|
|
18
|
+
exports.default = mongoose_1.model("Env", envSchema);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
declare const connectToMongo: (mongoUrl: string) => Promise<void>;
|
|
2
|
-
export default connectToMongo;
|
|
3
1
|
export { default as User } from "./user";
|
|
4
2
|
export { default as Project } from "./project";
|
|
5
3
|
export { default as Following } from "./following";
|
|
6
|
-
export {
|
|
4
|
+
export { default as Integration } from "./integration";
|
|
5
|
+
export { default as Domain } from "./domain";
|
|
6
|
+
export { default as Env } from "./env";
|
|
7
|
+
export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IDomain, } from "./types";
|
|
8
|
+
export { GIT_TYPE, INTEGRATION_TYPE } from "./enum";
|
|
9
|
+
export declare const connectToMongo: (mongoUrl: string) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -12,28 +12,38 @@ 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
|
-
|
|
15
|
+
exports.connectToMongo = void 0;
|
|
16
|
+
var user_1 = require("./user");
|
|
17
|
+
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_1.default; } });
|
|
18
|
+
var project_1 = require("./project");
|
|
19
|
+
Object.defineProperty(exports, "Project", { enumerable: true, get: function () { return project_1.default; } });
|
|
20
|
+
var following_1 = require("./following");
|
|
21
|
+
Object.defineProperty(exports, "Following", { enumerable: true, get: function () { return following_1.default; } });
|
|
22
|
+
var integration_1 = require("./integration");
|
|
23
|
+
Object.defineProperty(exports, "Integration", { enumerable: true, get: function () { return integration_1.default; } });
|
|
24
|
+
var domain_1 = require("./domain");
|
|
25
|
+
Object.defineProperty(exports, "Domain", { enumerable: true, get: function () { return domain_1.default; } });
|
|
26
|
+
var env_1 = require("./env");
|
|
27
|
+
Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return env_1.default; } });
|
|
28
|
+
var enum_1 = require("./enum");
|
|
29
|
+
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
30
|
+
Object.defineProperty(exports, "INTEGRATION_TYPE", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPE; } });
|
|
16
31
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
17
32
|
const utils_1 = require("@brimble/utils");
|
|
18
33
|
// Connection to Mongo
|
|
19
|
-
|
|
20
|
-
dotenv_1.default.config();
|
|
34
|
+
exports.connectToMongo = (mongoUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
35
|
const options = { useNewUrlParser: true, useUnifiedTopology: true };
|
|
22
36
|
mongoose_1.default.set("useFindAndModify", false);
|
|
23
37
|
mongoose_1.default.set("useCreateIndex", true);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
// connect to mongo
|
|
39
|
+
mongoose_1.default.connect(mongoUrl, options);
|
|
40
|
+
// listen for connection
|
|
41
|
+
mongoose_1.default.connection.on("connected", () => {
|
|
42
|
+
console.log("Database connection successful 🚀");
|
|
43
|
+
});
|
|
44
|
+
// listen for error
|
|
45
|
+
mongoose_1.default.connection.on("error", ({ message }) => {
|
|
46
|
+
utils_1.log.error(`Error connecting to DB`, message);
|
|
30
47
|
return process.exit(1);
|
|
31
|
-
}
|
|
48
|
+
});
|
|
32
49
|
});
|
|
33
|
-
exports.default = connectToMongo;
|
|
34
|
-
var user_1 = require("./user");
|
|
35
|
-
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_1.default; } });
|
|
36
|
-
var project_1 = require("./project");
|
|
37
|
-
Object.defineProperty(exports, "Project", { enumerable: true, get: function () { return project_1.default; } });
|
|
38
|
-
var following_1 = require("./following");
|
|
39
|
-
Object.defineProperty(exports, "Following", { enumerable: true, get: function () { return following_1.default; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const enum_1 = require("./enum");
|
|
5
|
+
const integrationSchema = new mongoose_1.Schema({
|
|
6
|
+
user_id: {
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
ref: "User",
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
type: String,
|
|
13
|
+
enum: Object.values(enum_1.INTEGRATION_TYPE),
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
app_id: String,
|
|
17
|
+
hook: String,
|
|
18
|
+
reference: String,
|
|
19
|
+
token: String,
|
|
20
|
+
}, { timestamps: true });
|
|
21
|
+
exports.default = mongoose_1.model("Integration", integrationSchema);
|
package/dist/project.js
CHANGED
|
@@ -1,34 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const mongoose_1 = require("mongoose");
|
|
4
|
-
const enum_1 = require("./enum");
|
|
5
4
|
const projectSchema = new mongoose_1.Schema({
|
|
6
|
-
user_id: {
|
|
7
|
-
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
-
ref: "User",
|
|
9
|
-
required: true,
|
|
10
|
-
},
|
|
11
5
|
name: {
|
|
12
6
|
type: String,
|
|
13
7
|
required: true,
|
|
8
|
+
unique: true,
|
|
14
9
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: enum_1.GIT_TYPE,
|
|
10
|
+
uuid: {
|
|
11
|
+
type: Number,
|
|
18
12
|
required: true,
|
|
13
|
+
unique: true,
|
|
19
14
|
},
|
|
20
|
-
|
|
21
|
-
type:
|
|
15
|
+
user: {
|
|
16
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
17
|
+
ref: "User",
|
|
22
18
|
required: true,
|
|
23
19
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
domains: [
|
|
21
|
+
{
|
|
22
|
+
ref: "Domain",
|
|
23
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
environments: [
|
|
27
|
+
{
|
|
28
|
+
ref: "Env",
|
|
29
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
pid: {
|
|
33
|
+
type: Number,
|
|
27
34
|
},
|
|
28
|
-
|
|
35
|
+
port: {
|
|
29
36
|
type: Number,
|
|
30
|
-
required: true,
|
|
31
|
-
default: 0,
|
|
32
37
|
},
|
|
38
|
+
dir: {
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
41
|
+
buildCommand: {
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
outputDirectory: {
|
|
45
|
+
type: String,
|
|
46
|
+
},
|
|
47
|
+
repo: Object,
|
|
33
48
|
}, { timestamps: true });
|
|
34
49
|
exports.default = mongoose_1.model("Project", projectSchema);
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/project.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
|
-
import {
|
|
2
|
+
import { IDomain } from "./domain";
|
|
3
|
+
import { IEnv } from "./env";
|
|
4
|
+
import { IUser } from "./user";
|
|
3
5
|
export interface IProject extends Document {
|
|
4
6
|
name: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
domains: Array<IDomain>;
|
|
8
|
+
environments: Array<IEnv>;
|
|
9
|
+
uuid: number;
|
|
10
|
+
pid: number;
|
|
11
|
+
port: number;
|
|
12
|
+
dir: string;
|
|
13
|
+
buildCommand: string;
|
|
14
|
+
outputDirectory: string;
|
|
15
|
+
user: IUser;
|
|
16
|
+
repo: {
|
|
17
|
+
name: string;
|
|
18
|
+
full_name: string;
|
|
19
|
+
id: number;
|
|
20
|
+
};
|
|
10
21
|
}
|
package/dist/types/user.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
2
|
import { IGit } from ".";
|
|
3
3
|
import { IFollowing } from "./following";
|
|
4
|
+
import { IProject } from "./project";
|
|
4
5
|
export interface IUser extends Document {
|
|
5
6
|
first_name: string;
|
|
6
7
|
last_name: string;
|
|
@@ -17,4 +18,5 @@ export interface IUser extends Document {
|
|
|
17
18
|
interests: Array<string>;
|
|
18
19
|
bitbucket: IGit;
|
|
19
20
|
following: Array<IFollowing>;
|
|
21
|
+
projects: Array<IProject>;
|
|
20
22
|
}
|
package/dist/user.d.ts
CHANGED
package/dist/user.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const mongoose_1 =
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
23
4
|
const userSchema = new mongoose_1.Schema({
|
|
24
5
|
first_name: String,
|
|
25
6
|
last_name: String,
|
|
@@ -34,22 +15,33 @@ const userSchema = new mongoose_1.Schema({
|
|
|
34
15
|
email_verified_at: Date,
|
|
35
16
|
following: [
|
|
36
17
|
{
|
|
37
|
-
type: mongoose_1.
|
|
38
|
-
ref: "Following"
|
|
39
|
-
}
|
|
18
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
19
|
+
ref: "Following",
|
|
20
|
+
},
|
|
40
21
|
],
|
|
41
22
|
verification_token: {
|
|
42
23
|
type: Number,
|
|
43
24
|
select: false,
|
|
44
25
|
},
|
|
45
26
|
location: {
|
|
46
|
-
type: String
|
|
27
|
+
type: String,
|
|
47
28
|
},
|
|
48
29
|
interests: {
|
|
49
|
-
type: Array
|
|
30
|
+
type: Array,
|
|
50
31
|
},
|
|
51
32
|
github: Object,
|
|
52
33
|
gitlab: Object,
|
|
53
34
|
bitbucket: Object,
|
|
35
|
+
access_code: {
|
|
36
|
+
type: Number,
|
|
37
|
+
select: false,
|
|
38
|
+
},
|
|
39
|
+
company: String,
|
|
40
|
+
projects: [
|
|
41
|
+
{
|
|
42
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
43
|
+
ref: "Project",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
54
46
|
}, { timestamps: true });
|
|
55
47
|
exports.default = mongoose_1.model("User", userSchema);
|
package/domain.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { IDomain } from "./types";
|
|
3
|
+
|
|
4
|
+
const domainSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
project: {
|
|
7
|
+
ref: "Project",
|
|
8
|
+
type: Schema.Types.ObjectId,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
unique: true,
|
|
14
|
+
},
|
|
15
|
+
user_id: {
|
|
16
|
+
type: Schema.Types.ObjectId,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{ timestamps: true },
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default model<IDomain>("Domain", domainSchema);
|
package/enum/index.ts
CHANGED
package/env.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { IEnv } from "./types";
|
|
3
|
+
|
|
4
|
+
const envSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
project: {
|
|
7
|
+
ref: "Project",
|
|
8
|
+
type: Schema.Types.ObjectId,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
value: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{ timestamps: true },
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default model<IEnv>("Env", envSchema);
|
package/index.ts
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as User } from "./user";
|
|
2
|
+
export { default as Project } from "./project";
|
|
3
|
+
export { default as Following } from "./following";
|
|
4
|
+
export { default as Integration } from "./integration";
|
|
5
|
+
export { default as Domain } from "./domain";
|
|
6
|
+
export { default as Env } from "./env";
|
|
7
|
+
export {
|
|
8
|
+
IUser,
|
|
9
|
+
IGit,
|
|
10
|
+
IProject,
|
|
11
|
+
IFollowing,
|
|
12
|
+
IIntegration,
|
|
13
|
+
IEnv,
|
|
14
|
+
IDomain,
|
|
15
|
+
} from "./types";
|
|
16
|
+
export { GIT_TYPE, INTEGRATION_TYPE } from "./enum";
|
|
17
|
+
|
|
2
18
|
import mongoose from "mongoose";
|
|
3
19
|
import { log } from "@brimble/utils";
|
|
4
20
|
|
|
5
21
|
// Connection to Mongo
|
|
6
|
-
const connectToMongo = async (mongoUrl: string): Promise<void> => {
|
|
7
|
-
dotenv.config();
|
|
8
|
-
|
|
22
|
+
export const connectToMongo = async (mongoUrl: string): Promise<void> => {
|
|
9
23
|
const options = { useNewUrlParser: true, useUnifiedTopology: true };
|
|
10
24
|
mongoose.set("useFindAndModify", false);
|
|
11
25
|
mongoose.set("useCreateIndex", true);
|
|
12
26
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
// connect to mongo
|
|
28
|
+
mongoose.connect(mongoUrl, options);
|
|
29
|
+
|
|
30
|
+
// listen for connection
|
|
31
|
+
mongoose.connection.on("connected", () => {
|
|
32
|
+
console.log("Database connection successful 🚀");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// listen for error
|
|
36
|
+
mongoose.connection.on("error", ({ message }) => {
|
|
37
|
+
log.error(`Error connecting to DB`, message);
|
|
18
38
|
return process.exit(1);
|
|
19
|
-
}
|
|
39
|
+
});
|
|
20
40
|
};
|
|
21
|
-
|
|
22
|
-
export default connectToMongo;
|
|
23
|
-
export { default as User } from "./user";
|
|
24
|
-
export { default as Project } from "./project";
|
|
25
|
-
export { default as Following } from "./following";
|
|
26
|
-
export { IUser, IGit, IProject, IFollowing } from "./types";
|
package/integration.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { GIT_TYPE, INTEGRATION_TYPE } from "./enum";
|
|
3
|
+
import { IIntegration } from "./types";
|
|
4
|
+
|
|
5
|
+
const integrationSchema: Schema = new Schema(
|
|
6
|
+
{
|
|
7
|
+
user_id: {
|
|
8
|
+
type: Schema.Types.ObjectId,
|
|
9
|
+
ref: "User",
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
name: {
|
|
13
|
+
type: String,
|
|
14
|
+
enum: Object.values(INTEGRATION_TYPE),
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
app_id: String,
|
|
18
|
+
hook: String,
|
|
19
|
+
reference: String,
|
|
20
|
+
token: String,
|
|
21
|
+
},
|
|
22
|
+
{ timestamps: true },
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export default model<IIntegration>("Integration", integrationSchema);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brimble/models",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "Brimble models",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@brimble/utils": "^1.3.
|
|
31
|
+
"@brimble/utils": "^1.3.2",
|
|
32
32
|
"dotenv": "^8.2.0",
|
|
33
33
|
"mongoose": "^5.8.11",
|
|
34
34
|
"uuid": "^8.3.2"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"ts-node": "^8.10.2",
|
|
44
44
|
"typescript": "^3.9.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "812c7ab0a0169d11a38ef0a5fee458f5101952ec"
|
|
47
47
|
}
|
package/project.ts
CHANGED
|
@@ -1,37 +1,51 @@
|
|
|
1
1
|
import { model, Schema } from "mongoose";
|
|
2
|
-
import { GIT_TYPE } from "./enum";
|
|
3
2
|
import { IProject } from "./types";
|
|
4
3
|
|
|
5
|
-
const projectSchema
|
|
4
|
+
const projectSchema = new Schema(
|
|
6
5
|
{
|
|
7
|
-
user_id: {
|
|
8
|
-
type: Schema.Types.ObjectId,
|
|
9
|
-
ref: "User",
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
6
|
name: {
|
|
13
7
|
type: String,
|
|
14
8
|
required: true,
|
|
9
|
+
unique: true,
|
|
15
10
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type: String,
|
|
19
|
-
enum: Object.values(GIT_TYPE),
|
|
11
|
+
uuid: {
|
|
12
|
+
type: Number,
|
|
20
13
|
required: true,
|
|
14
|
+
unique: true,
|
|
21
15
|
},
|
|
22
|
-
|
|
23
|
-
type:
|
|
16
|
+
user: {
|
|
17
|
+
type: Schema.Types.ObjectId,
|
|
18
|
+
ref: "User",
|
|
24
19
|
required: true,
|
|
25
20
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
domains: [
|
|
22
|
+
{
|
|
23
|
+
ref: "Domain",
|
|
24
|
+
type: Schema.Types.ObjectId,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
environments: [
|
|
28
|
+
{
|
|
29
|
+
ref: "Env",
|
|
30
|
+
type: Schema.Types.ObjectId,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
pid: {
|
|
34
|
+
type: Number,
|
|
29
35
|
},
|
|
30
|
-
|
|
36
|
+
port: {
|
|
31
37
|
type: Number,
|
|
32
|
-
required: true,
|
|
33
|
-
default: 0,
|
|
34
38
|
},
|
|
39
|
+
dir: {
|
|
40
|
+
type: String,
|
|
41
|
+
},
|
|
42
|
+
buildCommand: {
|
|
43
|
+
type: String,
|
|
44
|
+
},
|
|
45
|
+
outputDirectory: {
|
|
46
|
+
type: String,
|
|
47
|
+
},
|
|
48
|
+
repo: Object,
|
|
35
49
|
},
|
|
36
50
|
{ timestamps: true },
|
|
37
51
|
);
|
package/types/domain.ts
ADDED
package/types/env.ts
ADDED
package/types/index.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { INTEGRATION_TYPE } from "../enum";
|
|
3
|
+
|
|
4
|
+
export interface IIntegration extends Document {
|
|
5
|
+
user_id: string;
|
|
6
|
+
|
|
7
|
+
app_id?: string;
|
|
8
|
+
|
|
9
|
+
name: INTEGRATION_TYPE;
|
|
10
|
+
|
|
11
|
+
hook?: string;
|
|
12
|
+
|
|
13
|
+
reference?: string;
|
|
14
|
+
|
|
15
|
+
token?: string;
|
|
16
|
+
}
|
package/types/project.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
|
-
import {
|
|
2
|
+
import { IDomain } from "./domain";
|
|
3
|
+
import { IEnv } from "./env";
|
|
4
|
+
import { IUser } from "./user";
|
|
3
5
|
|
|
4
6
|
export interface IProject extends Document {
|
|
5
7
|
name: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
domains: Array<IDomain>;
|
|
9
|
+
environments: Array<IEnv>;
|
|
10
|
+
uuid: number;
|
|
11
|
+
pid: number;
|
|
12
|
+
port: number;
|
|
13
|
+
dir: string;
|
|
14
|
+
buildCommand: string;
|
|
15
|
+
outputDirectory: string;
|
|
16
|
+
user: IUser;
|
|
17
|
+
repo: {
|
|
18
|
+
name: string;
|
|
19
|
+
full_name: string;
|
|
20
|
+
id: number;
|
|
21
|
+
};
|
|
11
22
|
}
|
package/types/user.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
2
|
import { IGit } from ".";
|
|
3
3
|
import { IFollowing } from "./following";
|
|
4
|
+
import { IProject } from "./project";
|
|
4
5
|
|
|
5
6
|
export interface IUser extends Document {
|
|
6
7
|
first_name: string;
|
|
@@ -15,7 +16,8 @@ export interface IUser extends Document {
|
|
|
15
16
|
github: IGit;
|
|
16
17
|
gitlab: IGit;
|
|
17
18
|
location: string;
|
|
18
|
-
interests: Array<string
|
|
19
|
+
interests: Array<string>;
|
|
19
20
|
bitbucket: IGit;
|
|
20
|
-
following: Array<IFollowing
|
|
21
|
+
following: Array<IFollowing>;
|
|
22
|
+
projects: Array<IProject>;
|
|
21
23
|
}
|
package/user.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
2
|
|
|
3
3
|
import { IUser } from "./types";
|
|
4
4
|
|
|
@@ -17,25 +17,36 @@ const userSchema: Schema = new Schema(
|
|
|
17
17
|
email_verified_at: Date,
|
|
18
18
|
following: [
|
|
19
19
|
{
|
|
20
|
-
type:
|
|
21
|
-
ref: "Following"
|
|
22
|
-
}
|
|
20
|
+
type: Schema.Types.ObjectId,
|
|
21
|
+
ref: "Following",
|
|
22
|
+
},
|
|
23
23
|
],
|
|
24
24
|
verification_token: {
|
|
25
25
|
type: Number,
|
|
26
26
|
select: false,
|
|
27
27
|
},
|
|
28
28
|
location: {
|
|
29
|
-
type: String
|
|
29
|
+
type: String,
|
|
30
30
|
},
|
|
31
31
|
interests: {
|
|
32
|
-
type: Array
|
|
32
|
+
type: Array,
|
|
33
33
|
},
|
|
34
34
|
github: Object,
|
|
35
35
|
gitlab: Object,
|
|
36
36
|
bitbucket: Object,
|
|
37
|
+
access_code: {
|
|
38
|
+
type: Number,
|
|
39
|
+
select: false,
|
|
40
|
+
},
|
|
41
|
+
company: String,
|
|
42
|
+
projects: [
|
|
43
|
+
{
|
|
44
|
+
type: Schema.Types.ObjectId,
|
|
45
|
+
ref: "Project",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
37
48
|
},
|
|
38
|
-
{ timestamps: true }
|
|
49
|
+
{ timestamps: true },
|
|
39
50
|
);
|
|
40
51
|
|
|
41
52
|
export default model<IUser>("User", userSchema);
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
[33m@brimble/models:pre-push: [0mcache hit, replaying output [2m20c90bb8c9103f77[0m
|
|
2
|
-
[33m@brimble/models:pre-push: [0m$ lint-prepush
|
|
3
|
-
[33m@brimble/models:pre-push: [0m[19:54:19] Linting *.{ts,js} files [started]
|
|
4
|
-
[33m@brimble/models:pre-push: [0m[19:54:19] Linting *.{ts,js} files [skipped]
|
|
5
|
-
[33m@brimble/models:pre-push: [0m[19:54:19] → No files found with *.{ts,js}
|
|
6
|
-
[33m@brimble/models:pre-push: [0m
|
|
7
|
-
[33m@brimble/models:pre-push: [0mVoila! 🎉 Code is ready to be Shipped.
|
|
8
|
-
[33m@brimble/models:pre-push: [0m
|