@brimble/models 1.3.21 → 1.3.23

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/index.d.ts CHANGED
@@ -5,7 +5,9 @@ export { default as Integration } from "./integration";
5
5
  export { default as Domain } from "./domain";
6
6
  export { default as Env } from "./env";
7
7
  export { default as Token } from "./token";
8
- export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IDomain, IToken, } from "./types";
9
- export { GIT_TYPE, INTEGRATION_TYPE, OAUTH_PERMISSIONS, ENVIRONMENT } from "./enum";
8
+ export { default as Team } from "./team";
9
+ export { default as Member } from "./member";
10
+ export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IDomain, IToken, IMember, ITeam, } from "./types";
11
+ export { GIT_TYPE, INTEGRATION_TYPE, OAUTH_PERMISSIONS, ENVIRONMENT, ROLES, } from "./enum";
10
12
  export declare const connectToMongo: (mongoUrl: string) => Promise<void>;
11
13
  export declare const closeMongo: () => void;
package/dist/index.js CHANGED
@@ -27,14 +27,19 @@ var env_1 = require("./env");
27
27
  Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return env_1.default; } });
28
28
  var token_1 = require("./token");
29
29
  Object.defineProperty(exports, "Token", { enumerable: true, get: function () { return token_1.default; } });
30
+ var team_1 = require("./team");
31
+ Object.defineProperty(exports, "Team", { enumerable: true, get: function () { return team_1.default; } });
32
+ var member_1 = require("./member");
33
+ Object.defineProperty(exports, "Member", { enumerable: true, get: function () { return member_1.default; } });
30
34
  var enum_1 = require("./enum");
31
35
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
32
36
  Object.defineProperty(exports, "INTEGRATION_TYPE", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPE; } });
33
37
  Object.defineProperty(exports, "OAUTH_PERMISSIONS", { enumerable: true, get: function () { return enum_1.OAUTH_PERMISSIONS; } });
34
38
  Object.defineProperty(exports, "ENVIRONMENT", { enumerable: true, get: function () { return enum_1.ENVIRONMENT; } });
39
+ Object.defineProperty(exports, "ROLES", { enumerable: true, get: function () { return enum_1.ROLES; } });
35
40
  const mongoose_1 = __importDefault(require("mongoose"));
36
41
  const utils_1 = require("@brimble/utils");
37
- // Connection to Mongo
42
+ // Connection to Mongo
38
43
  exports.connectToMongo = (mongoUrl) => __awaiter(void 0, void 0, void 0, function* () {
39
44
  const options = { useNewUrlParser: true, useUnifiedTopology: true };
40
45
  mongoose_1.default.set("useFindAndModify", false);
package/dist/member.js CHANGED
@@ -16,6 +16,10 @@ const memberSchema = new mongoose_1.Schema({
16
16
  enum: Object.values(enum_1.ROLES),
17
17
  default: enum_1.ROLES.MEMBER,
18
18
  },
19
+ accepted: {
20
+ type: Boolean,
21
+ default: false,
22
+ },
19
23
  }, {
20
24
  timestamps: true,
21
25
  });
package/dist/team.js CHANGED
@@ -5,6 +5,7 @@ const teamSchema = new mongoose_1.Schema({
5
5
  name: {
6
6
  type: String,
7
7
  required: true,
8
+ unique: true,
8
9
  },
9
10
  description: {
10
11
  type: String,
package/dist/token.js CHANGED
@@ -22,6 +22,7 @@ const tokenSchema = new mongoose_1.Schema({
22
22
  unique: true,
23
23
  },
24
24
  installationUrl: String,
25
+ redirectUrl: String,
25
26
  encodedToken: {
26
27
  type: String,
27
28
  default: null,
@@ -4,4 +4,5 @@ export interface IMember extends Document {
4
4
  user: IUser;
5
5
  team: ITeam;
6
6
  role: ROLES;
7
+ accepted: boolean;
7
8
  }
@@ -6,6 +6,7 @@ export interface IToken extends Document {
6
6
  description: string[];
7
7
  image: string;
8
8
  installationUrl?: string;
9
+ redirectUrl?: string | null;
9
10
  encodedToken?: string | null;
10
11
  permission: OAUTH_PERMISSIONS[];
11
12
  }
@@ -1,6 +1,6 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IGit } from ".";
3
- import { IFollowing, IProject } from "./";
3
+ import { IFollowing, IProject, ITeam } from "./";
4
4
  export interface IUser extends Document {
5
5
  first_name: string;
6
6
  last_name: string;
@@ -18,4 +18,5 @@ export interface IUser extends Document {
18
18
  bitbucket: IGit;
19
19
  following: Array<IFollowing>;
20
20
  projects: Array<IProject>;
21
+ teams: Array<ITeam>;
21
22
  }
package/index.ts CHANGED
@@ -5,6 +5,8 @@ export { default as Integration } from "./integration";
5
5
  export { default as Domain } from "./domain";
6
6
  export { default as Env } from "./env";
7
7
  export { default as Token } from "./token";
8
+ export { default as Team } from "./team";
9
+ export { default as Member } from "./member";
8
10
  export {
9
11
  IUser,
10
12
  IGit,
@@ -14,13 +16,21 @@ export {
14
16
  IEnv,
15
17
  IDomain,
16
18
  IToken,
19
+ IMember,
20
+ ITeam,
17
21
  } from "./types";
18
- export { GIT_TYPE, INTEGRATION_TYPE, OAUTH_PERMISSIONS, ENVIRONMENT } from "./enum";
22
+ export {
23
+ GIT_TYPE,
24
+ INTEGRATION_TYPE,
25
+ OAUTH_PERMISSIONS,
26
+ ENVIRONMENT,
27
+ ROLES,
28
+ } from "./enum";
19
29
 
20
30
  import mongoose from "mongoose";
21
31
  import { log } from "@brimble/utils";
22
32
 
23
- // Connection to Mongo
33
+ // Connection to Mongo
24
34
  export const connectToMongo = async (mongoUrl: string): Promise<void> => {
25
35
  const options = { useNewUrlParser: true, useUnifiedTopology: true };
26
36
  mongoose.set("useFindAndModify", false);
@@ -43,4 +53,4 @@ export const connectToMongo = async (mongoUrl: string): Promise<void> => {
43
53
 
44
54
  export const closeMongo = () => {
45
55
  mongoose.connection.close(true);
46
- }
56
+ };
package/member.ts CHANGED
@@ -17,6 +17,10 @@ const memberSchema: Schema = new Schema(
17
17
  enum: Object.values(ROLES),
18
18
  default: ROLES.MEMBER,
19
19
  },
20
+ accepted: {
21
+ type: Boolean,
22
+ default: false,
23
+ },
20
24
  },
21
25
  {
22
26
  timestamps: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.3.21",
3
+ "version": "1.3.23",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/team.ts CHANGED
@@ -6,6 +6,7 @@ const teamSchema: Schema = new Schema(
6
6
  name: {
7
7
  type: String,
8
8
  required: true,
9
+ unique: true,
9
10
  },
10
11
  description: {
11
12
  type: String,
package/token.ts CHANGED
@@ -23,6 +23,7 @@ const tokenSchema = new Schema(
23
23
  unique: true,
24
24
  },
25
25
  installationUrl: String,
26
+ redirectUrl: String,
26
27
  encodedToken: {
27
28
  type: String,
28
29
  default: null,
package/types/member.ts CHANGED
@@ -5,4 +5,5 @@ export interface IMember extends Document {
5
5
  user: IUser;
6
6
  team: ITeam;
7
7
  role: ROLES;
8
+ accepted: boolean;
8
9
  }
package/types/token.ts CHANGED
@@ -12,6 +12,8 @@ export interface IToken extends Document {
12
12
 
13
13
  installationUrl?: string;
14
14
 
15
+ redirectUrl?: string | null;
16
+
15
17
  encodedToken?: string | null;
16
18
 
17
19
  permission: OAUTH_PERMISSIONS[];
package/types/user.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IGit } from ".";
3
- import { IFollowing, IProject } from "./";
3
+ import { IFollowing, IProject, ITeam } from "./";
4
4
 
5
5
  export interface IUser extends Document {
6
6
  first_name: string;
@@ -19,4 +19,5 @@ export interface IUser extends Document {
19
19
  bitbucket: IGit;
20
20
  following: Array<IFollowing>;
21
21
  projects: Array<IProject>;
22
+ teams: Array<ITeam>;
22
23
  }