codebase-models 3.1.5 → 3.1.7

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.
@@ -32,7 +32,8 @@ const InvitationSchema = new mongoose_1.Schema({
32
32
  organization: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "organization", required: true },
33
33
  client: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "client" },
34
34
  role: { type: String, enum: ["owner", "admin", "member"], default: "member" },
35
- permissions: { type: mongoose_1.default.Schema.Types.Mixed, required: true, default: {
35
+ permissions: {
36
+ type: mongoose_1.default.Schema.Types.Mixed, required: true, default: {
36
37
  dashboard: true,
37
38
  reporting: false,
38
39
  insights: false,
@@ -42,9 +43,10 @@ const InvitationSchema = new mongoose_1.Schema({
42
43
  abTestingDefault: true,
43
44
  manageExperiments: false,
44
45
  preCalculations: false,
45
- } },
46
+ }
47
+ },
46
48
  token: { type: String, unique: true, required: true },
47
- status: { type: String, enum: ["pending", "accepted", "expired", "revoked"], default: "pending" },
49
+ status: { type: String, enum: ["pending", "accepted", "expired", "revoked", "declined"], default: "pending" },
48
50
  expiresAt: { type: Date, default: Date.now() + 1000 * 60 * 60 * 24 * 30 },
49
51
  }, {
50
52
  timestamps: true
@@ -25,7 +25,8 @@
25
25
  import mongoose, { Document } from "mongoose";
26
26
  export declare enum ProviderType {
27
27
  SHOPIFY = "shopify",
28
- BIGQUERY = "bigquery"
28
+ BIGQUERY = "bigquery",
29
+ GOOGLE_ANALYTICS = "google_analytics"
29
30
  }
30
31
  export interface IShopifyMetadata {
31
32
  apiKey: string;
@@ -31,7 +31,7 @@ var ProviderType;
31
31
  (function (ProviderType) {
32
32
  ProviderType["SHOPIFY"] = "shopify";
33
33
  ProviderType["BIGQUERY"] = "bigquery";
34
- // GOOGLE_ANALYTICS = "google_analytics",
34
+ ProviderType["GOOGLE_ANALYTICS"] = "google_analytics";
35
35
  // GOOGLE_TAG_MANAGER = "google_tag_manager",
36
36
  // GOOGLE_ADS = "google_ads",
37
37
  // GOOGLE_SEARCH_CONSOLE = "google_search_console",
@@ -35,6 +35,7 @@ export interface IUser extends Document {
35
35
  twoFactor: boolean;
36
36
  emailVerified: boolean;
37
37
  resetLink: string;
38
+ resetTwoFactorLink?: string;
38
39
  createdAt: Date;
39
40
  updatedAt: Date;
40
41
  isSSOUser: boolean;
@@ -37,6 +37,7 @@ const UserSchema = new mongoose_1.Schema({
37
37
  twoFactor: { type: Boolean, default: false },
38
38
  emailVerified: { type: Boolean, default: false },
39
39
  resetLink: String,
40
+ resetTwoFactorLink: { type: String, default: null },
40
41
  // bigqueryToken: String,
41
42
  // expirybqToken: String,
42
43
  // refreshToken: String,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "3.1.5",
3
+ "version": "3.1.7",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -2,18 +2,18 @@ import mongoose, { Document, Schema, model } from "mongoose";
2
2
  import { generateRandomIID } from "../constant";
3
3
 
4
4
  export interface IInvitation extends Document {
5
- iid: string;
6
- email: string;
7
- invitedBy: mongoose.Types.ObjectId; // user who sent the invite
8
- organization: mongoose.Types.ObjectId;
9
- client?: mongoose.Types.ObjectId; // optional (invite to specific client)
10
- role?: string; // optional role name
11
- permissions?: mongoose.Schema.Types.Mixed;
12
- token: string;
13
- status: string;
14
- expiresAt: Date;
15
- createdAt: Date;
16
- updatedAt: Date;
5
+ iid: string;
6
+ email: string;
7
+ invitedBy: mongoose.Types.ObjectId; // user who sent the invite
8
+ organization: mongoose.Types.ObjectId;
9
+ client?: mongoose.Types.ObjectId; // optional (invite to specific client)
10
+ role?: string; // optional role name
11
+ permissions?: mongoose.Schema.Types.Mixed;
12
+ token: string;
13
+ status: string;
14
+ expiresAt: Date;
15
+ createdAt: Date;
16
+ updatedAt: Date;
17
17
  }
18
18
  const InvitationSchema = new Schema<IInvitation>({
19
19
  iid: { type: String, unique: true, default: () => generateRandomIID() },
@@ -22,24 +22,26 @@ const InvitationSchema = new Schema<IInvitation>({
22
22
  organization: { type: mongoose.Schema.Types.ObjectId, ref: "organization", required: true },
23
23
  client: { type: mongoose.Schema.Types.ObjectId, ref: "client" },
24
24
  role: { type: String, enum: ["owner", "admin", "member"], default: "member" },
25
- permissions: { type: mongoose.Schema.Types.Mixed, required: true, default: {
26
- dashboard: true,
27
- reporting: false,
28
- insights: false,
29
- documentsAndLinks: false,
30
- cvrReports: false,
31
- abTesting: false,
32
- abTestingDefault: true,
33
- manageExperiments: false,
34
- preCalculations: false,
35
- } },
25
+ permissions: {
26
+ type: mongoose.Schema.Types.Mixed, required: true, default: {
27
+ dashboard: true,
28
+ reporting: false,
29
+ insights: false,
30
+ documentsAndLinks: false,
31
+ cvrReports: false,
32
+ abTesting: false,
33
+ abTestingDefault: true,
34
+ manageExperiments: false,
35
+ preCalculations: false,
36
+ }
37
+ },
36
38
  token: { type: String, unique: true, required: true },
37
- status: { type: String, enum: ["pending", "accepted", "expired", "revoked"], default: "pending" },
39
+ status: { type: String, enum: ["pending", "accepted", "expired", "revoked", "declined"], default: "pending" },
38
40
  expiresAt: { type: Date, default: Date.now() + 1000 * 60 * 60 * 24 * 30 },
39
41
  },
40
- {
42
+ {
41
43
  timestamps: true
42
- });
44
+ });
43
45
 
44
46
  InvitationSchema.index({ email: 1, organization: 1 });
45
47
  InvitationSchema.index({ token: 1 }, { unique: true });
@@ -5,7 +5,7 @@ import { generateRandomIID } from "../constant";
5
5
  export enum ProviderType {
6
6
  SHOPIFY = "shopify",
7
7
  BIGQUERY = "bigquery",
8
- // GOOGLE_ANALYTICS = "google_analytics",
8
+ GOOGLE_ANALYTICS = "google_analytics",
9
9
  // GOOGLE_TAG_MANAGER = "google_tag_manager",
10
10
  // GOOGLE_ADS = "google_ads",
11
11
  // GOOGLE_SEARCH_CONSOLE = "google_search_console",
@@ -13,6 +13,7 @@ export interface IUser extends Document {
13
13
  twoFactor: boolean;
14
14
  emailVerified: boolean;
15
15
  resetLink: string;
16
+ resetTwoFactorLink?: string;
16
17
  // bigqueryToken: string;
17
18
  // expirybqToken: string;
18
19
  // refreshToken: string;
@@ -35,6 +36,7 @@ const UserSchema = new Schema<IUser>(
35
36
  twoFactor: { type: Boolean, default: false },
36
37
  emailVerified: { type: Boolean, default: false },
37
38
  resetLink: String,
39
+ resetTwoFactorLink: { type: String, default: null },
38
40
  // bigqueryToken: String,
39
41
  // expirybqToken: String,
40
42
  // refreshToken: String,