@brimble/models 1.4.53 → 1.4.54

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 +1,3 @@
1
+ yarn run v1.22.19
1
2
  $ tsc -p .
3
+ Done in 2.19s.
package/card.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { model, Schema } from "mongoose";
2
+ import {CARD_TYPES} from "./enum";
3
+ import {ICard} from "./types";
4
+
5
+ const cardSchema = new Schema(
6
+ {
7
+ user_id: {
8
+ ref: "User",
9
+ type: Schema.Types.ObjectId,
10
+ },
11
+ last4: {
12
+ type: String,
13
+ required: true,
14
+ },
15
+ card_type: {
16
+ type: String,
17
+ enum: Object.keys(CARD_TYPES),
18
+ required: true,
19
+ },
20
+ exp_month: {
21
+ type: String,
22
+ required: true,
23
+ },
24
+ exp_year: {
25
+ type: String,
26
+ required: true,
27
+ },
28
+ signature: {
29
+ type: String,
30
+ required: false,
31
+ },
32
+ authorization_code: {
33
+ type: String,
34
+ required: true,
35
+ },
36
+ preferred: {
37
+ type: Boolean,
38
+ default: true,
39
+ required: false,
40
+ },
41
+ },
42
+ { timestamps: true, collection: "cards" },
43
+ );
44
+
45
+ export default model<ICard>("Card", cardSchema);
package/dist/card.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /// <reference types="mongoose" />
2
+ import { ICard } from "./types";
3
+ declare const _default: import("mongoose").Model<ICard, {}, {}>;
4
+ export default _default;
package/dist/card.js ADDED
@@ -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 cardSchema = new mongoose_1.Schema({
6
+ user_id: {
7
+ ref: "User",
8
+ type: mongoose_1.Schema.Types.ObjectId,
9
+ },
10
+ last4: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ card_type: {
15
+ type: String,
16
+ enum: Object.keys(enum_1.CARD_TYPES),
17
+ required: true,
18
+ },
19
+ exp_month: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ exp_year: {
24
+ type: String,
25
+ required: true,
26
+ },
27
+ signature: {
28
+ type: String,
29
+ required: false,
30
+ },
31
+ authorization_code: {
32
+ type: String,
33
+ required: true,
34
+ },
35
+ preferred: {
36
+ type: Boolean,
37
+ default: true,
38
+ required: false,
39
+ },
40
+ }, { timestamps: true, collection: "cards" });
41
+ exports.default = (0, mongoose_1.model)("Card", cardSchema);
@@ -33,6 +33,11 @@ export declare enum ROLES {
33
33
  CREATOR = "CREATOR",
34
34
  MEMBER = "MEMBER"
35
35
  }
36
+ export declare enum CARD_TYPES {
37
+ MASTERCARD = "MASTERCARD",
38
+ VISA = "VISA",
39
+ VERVE = "VERVE"
40
+ }
36
41
  export declare enum PROJECT_STATUS {
37
42
  INACTIVE = "INACTIVE",
38
43
  ACTIVE = "ACTIVE",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.ROLES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.GIT_TYPE = void 0;
3
+ exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.ROLES = 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";
@@ -41,6 +41,12 @@ var ROLES;
41
41
  ROLES["CREATOR"] = "CREATOR";
42
42
  ROLES["MEMBER"] = "MEMBER";
43
43
  })(ROLES = exports.ROLES || (exports.ROLES = {}));
44
+ var CARD_TYPES;
45
+ (function (CARD_TYPES) {
46
+ CARD_TYPES["MASTERCARD"] = "MASTERCARD";
47
+ CARD_TYPES["VISA"] = "VISA";
48
+ CARD_TYPES["VERVE"] = "VERVE";
49
+ })(CARD_TYPES = exports.CARD_TYPES || (exports.CARD_TYPES = {}));
44
50
  var PROJECT_STATUS;
45
51
  (function (PROJECT_STATUS) {
46
52
  PROJECT_STATUS["INACTIVE"] = "INACTIVE";
package/dist/index.d.ts CHANGED
@@ -9,8 +9,9 @@ export { default as Team } from "./team";
9
9
  export { default as Member } from "./member";
10
10
  export { default as Log } from "./logs";
11
11
  export { default as SubscriptionPlan } from "./subscription_plan";
12
- export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscriptionPlan } from "./types";
13
- export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, ROLES, PROJECT_STATUS, SUBSCRIPTION_STATUS } from "./enum";
12
+ export { default as Card } from "./card";
13
+ export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscriptionPlan, ICard } from "./types";
14
+ export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, ROLES, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES } from "./enum";
14
15
  import mongoose from "mongoose";
15
16
  export declare const connectToMongo: (mongoUrl: string, retryCount?: number) => Promise<void>;
16
17
  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.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.ROLES = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.SubscriptionPlan = exports.Log = exports.Member = exports.Team = exports.Token = exports.Env = exports.Domain = exports.Integration = exports.Following = exports.Project = exports.User = void 0;
15
+ exports.closeMongo = exports.db = exports.connectToMongo = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.ROLES = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.Card = exports.SubscriptionPlan = exports.Log = exports.Member = exports.Team = exports.Token = exports.Env = exports.Domain = exports.Integration = exports.Following = 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,8 @@ var logs_1 = require("./logs");
35
35
  Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return __importDefault(logs_1).default; } });
36
36
  var subscription_plan_1 = require("./subscription_plan");
37
37
  Object.defineProperty(exports, "SubscriptionPlan", { enumerable: true, get: function () { return __importDefault(subscription_plan_1).default; } });
38
+ var card_1 = require("./card");
39
+ Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return __importDefault(card_1).default; } });
38
40
  var enum_1 = require("./enum");
39
41
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
40
42
  Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
@@ -44,6 +46,7 @@ Object.defineProperty(exports, "ENVIRONMENT", { enumerable: true, get: function
44
46
  Object.defineProperty(exports, "ROLES", { enumerable: true, get: function () { return enum_1.ROLES; } });
45
47
  Object.defineProperty(exports, "PROJECT_STATUS", { enumerable: true, get: function () { return enum_1.PROJECT_STATUS; } });
46
48
  Object.defineProperty(exports, "SUBSCRIPTION_STATUS", { enumerable: true, get: function () { return enum_1.SUBSCRIPTION_STATUS; } });
49
+ Object.defineProperty(exports, "CARD_TYPES", { enumerable: true, get: function () { return enum_1.CARD_TYPES; } });
47
50
  const mongoose_1 = __importDefault(require("mongoose"));
48
51
  const utils_1 = require("@brimble/utils");
49
52
  // Connection to Mongo
@@ -0,0 +1,12 @@
1
+ import { Document } from "mongoose";
2
+ import { CARD_TYPES } from "../enum";
3
+ export interface ICard extends Document {
4
+ user_id: string;
5
+ last4: string;
6
+ card_type: CARD_TYPES;
7
+ preferred: boolean;
8
+ exp_month: string;
9
+ exp_year: string;
10
+ signature: string;
11
+ authorization_code: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,3 +11,4 @@ export { IMember } from "./member";
11
11
  export { IInstalledIntegration } from "./installed_integration";
12
12
  export { ILog } from "./logs";
13
13
  export { ISubscriptionPlan } from "./subscription_plan";
14
+ export { ICard } from "./card";
package/enum/index.ts CHANGED
@@ -38,6 +38,12 @@ export enum ROLES {
38
38
  MEMBER = "MEMBER",
39
39
  }
40
40
 
41
+ export enum CARD_TYPES {
42
+ MASTERCARD = "MASTERCARD",
43
+ VISA = "VISA",
44
+ VERVE = "VERVE"
45
+ }
46
+
41
47
  export enum PROJECT_STATUS {
42
48
  INACTIVE = "INACTIVE",
43
49
  ACTIVE = "ACTIVE",
package/index.ts CHANGED
@@ -9,6 +9,7 @@ export { default as Team } from "./team";
9
9
  export { default as Member } from "./member";
10
10
  export { default as Log } from "./logs";
11
11
  export { default as SubscriptionPlan } from "./subscription_plan";
12
+ export { default as Card } from "./card";
12
13
  export {
13
14
  IUser,
14
15
  IGit,
@@ -22,7 +23,8 @@ export {
22
23
  ITeam,
23
24
  IInstalledIntegration,
24
25
  ILog,
25
- ISubscriptionPlan
26
+ ISubscriptionPlan,
27
+ ICard
26
28
  } from "./types";
27
29
  export {
28
30
  GIT_TYPE,
@@ -32,7 +34,8 @@ export {
32
34
  ENVIRONMENT,
33
35
  ROLES,
34
36
  PROJECT_STATUS,
35
- SUBSCRIPTION_STATUS
37
+ SUBSCRIPTION_STATUS,
38
+ CARD_TYPES
36
39
  } from "./enum";
37
40
 
38
41
  import mongoose from "mongoose";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.4.53",
3
+ "version": "1.4.54",
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": "2ccaf0d9ddb2c11da9f7713709c195acd0535881"
24
+ "gitHead": "939d515d35da39246d4c41e96d497cbca3638efb"
25
25
  }
package/types/card.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { Document } from "mongoose";
2
+ import {CARD_TYPES} from "../enum";
3
+
4
+ export interface ICard extends Document {
5
+ user_id: string;
6
+
7
+ last4: string;
8
+
9
+ card_type: CARD_TYPES;
10
+
11
+ preferred: boolean;
12
+
13
+ exp_month: string;
14
+
15
+ exp_year: string;
16
+
17
+ signature: string;
18
+
19
+ authorization_code: string;
20
+ }
package/types/index.ts CHANGED
@@ -11,3 +11,4 @@ export { IMember } from "./member";
11
11
  export { IInstalledIntegration } from "./installed_integration";
12
12
  export { ILog } from "./logs";
13
13
  export { ISubscriptionPlan } from "./subscription_plan";
14
+ export { ICard } from "./card";