@brimble/models 3.8.6 → 3.8.10

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.
Files changed (104) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/activity-log.ts +66 -0
  3. package/app-message.ts +3 -2
  4. package/cashier_subscription.ts +7 -3
  5. package/db-image.ts +5 -0
  6. package/dist/activity-log.d.ts +30 -0
  7. package/dist/activity-log.js +61 -0
  8. package/dist/app-message.js +3 -2
  9. package/dist/cashier_subscription.js +7 -3
  10. package/dist/db-image.js +5 -0
  11. package/dist/domain/index.js +6 -0
  12. package/dist/enum/index.d.ts +20 -6
  13. package/dist/enum/index.js +22 -6
  14. package/dist/env.js +0 -8
  15. package/dist/environment-variable.d.ts +30 -0
  16. package/dist/environment-variable.js +16 -0
  17. package/dist/framework.js +5 -0
  18. package/dist/index.d.ts +9 -3
  19. package/dist/index.js +19 -5
  20. package/dist/member.js +1 -0
  21. package/dist/ownership-transfer.d.ts +30 -0
  22. package/dist/ownership-transfer.js +35 -0
  23. package/dist/plan_configuration.js +5 -0
  24. package/dist/project/index.js +28 -6
  25. package/dist/project-environment.d.ts +30 -0
  26. package/dist/project-environment.js +13 -0
  27. package/dist/project_analytics.d.ts +30 -0
  28. package/dist/project_analytics.js +18 -0
  29. package/dist/sandbox-image.d.ts +30 -0
  30. package/dist/sandbox-image.js +31 -0
  31. package/dist/{branch.d.ts → sandbox.d.ts} +2 -2
  32. package/dist/sandbox.js +89 -0
  33. package/dist/team.js +34 -0
  34. package/dist/types/activity-log.d.ts +18 -0
  35. package/dist/types/app-message.d.ts +3 -2
  36. package/dist/types/cashier_subscription.d.ts +4 -2
  37. package/dist/types/db-image.d.ts +1 -0
  38. package/dist/types/domain/index.d.ts +2 -1
  39. package/dist/types/env.d.ts +0 -3
  40. package/dist/types/environment-variable.d.ts +12 -0
  41. package/dist/types/environment-variable.js +2 -0
  42. package/dist/types/framework.d.ts +1 -0
  43. package/dist/types/index.d.ts +7 -1
  44. package/dist/types/member.d.ts +2 -0
  45. package/dist/types/ownership-transfer.d.ts +12 -0
  46. package/dist/types/ownership-transfer.js +2 -0
  47. package/dist/types/plan_configuration.d.ts +5 -0
  48. package/dist/types/project/index.d.ts +6 -2
  49. package/dist/types/project-environment.d.ts +13 -0
  50. package/dist/types/project-environment.js +2 -0
  51. package/dist/types/project_analytics.d.ts +11 -0
  52. package/dist/types/project_analytics.js +2 -0
  53. package/dist/types/sandbox-image.d.ts +9 -0
  54. package/dist/types/sandbox-image.js +2 -0
  55. package/dist/types/sandbox.d.ts +30 -0
  56. package/dist/types/sandbox.js +2 -0
  57. package/dist/types/team.d.ts +10 -2
  58. package/dist/types/user.d.ts +3 -0
  59. package/dist/types/wallet.d.ts +4 -0
  60. package/dist/user.js +7 -0
  61. package/dist/wallet.js +16 -0
  62. package/domain/index.ts +6 -0
  63. package/enum/index.ts +21 -5
  64. package/env.ts +0 -8
  65. package/environment-variable.ts +21 -0
  66. package/framework.ts +5 -0
  67. package/index.ts +19 -4
  68. package/member.ts +1 -0
  69. package/ownership-transfer.ts +42 -0
  70. package/package.json +1 -1
  71. package/plan_configuration.ts +5 -0
  72. package/project/index.ts +32 -6
  73. package/project-environment.ts +18 -0
  74. package/project_analytics.ts +26 -0
  75. package/sandbox-image.ts +35 -0
  76. package/sandbox.ts +91 -0
  77. package/team.ts +34 -0
  78. package/types/activity-log.ts +19 -0
  79. package/types/app-message.ts +3 -2
  80. package/types/cashier_subscription.ts +4 -2
  81. package/types/db-image.ts +1 -0
  82. package/types/domain/index.ts +2 -1
  83. package/types/env.ts +0 -3
  84. package/types/environment-variable.ts +13 -0
  85. package/types/framework.ts +3 -2
  86. package/types/index.ts +7 -1
  87. package/types/member.ts +2 -0
  88. package/types/ownership-transfer.ts +13 -0
  89. package/types/plan_configuration.ts +5 -0
  90. package/types/project/index.ts +6 -2
  91. package/types/project-environment.ts +14 -0
  92. package/types/project_analytics.ts +12 -0
  93. package/types/sandbox-image.ts +10 -0
  94. package/types/sandbox.ts +32 -0
  95. package/types/team.ts +10 -2
  96. package/types/user.ts +3 -0
  97. package/types/wallet.ts +4 -0
  98. package/user.ts +7 -0
  99. package/wallet.ts +16 -0
  100. package/branch.ts +0 -22
  101. package/dist/branch.js +0 -17
  102. package/dist/types/branch.d.ts +0 -17
  103. package/types/branch.ts +0 -18
  104. /package/dist/types/{branch.js → activity-log.js} +0 -0
package/sandbox.ts ADDED
@@ -0,0 +1,91 @@
1
+ import { model, Schema } from "mongoose";
2
+ import { ISandbox } from "./types/sandbox";
3
+ import { SANDBOX_STATUS, SANDBOX_DESTROY_REASON } from "./enum";
4
+
5
+ const sandboxSchema: Schema = new Schema({
6
+ user_id: {
7
+ type: Schema.Types.ObjectId,
8
+ ref: "User",
9
+ required: true,
10
+ },
11
+ team: {
12
+ type: Schema.Types.ObjectId,
13
+ ref: "Team",
14
+ default: null,
15
+ },
16
+ project_environment: {
17
+ type: Schema.Types.ObjectId,
18
+ ref: "ProjectEnvironment",
19
+ default: null,
20
+ },
21
+ template: {
22
+ type: String,
23
+ required: true,
24
+ },
25
+ status: {
26
+ type: String,
27
+ enum: Object.values(SANDBOX_STATUS),
28
+ required: true,
29
+ default: SANDBOX_STATUS.STARTING,
30
+ },
31
+ nomad_job_id: {
32
+ type: String,
33
+ required: true,
34
+ },
35
+ nomad_alloc_id: {
36
+ type: String,
37
+ default: null,
38
+ },
39
+ host: {
40
+ type: String,
41
+ default: null,
42
+ },
43
+ port: {
44
+ type: Number,
45
+ default: null,
46
+ },
47
+ agent_token_hash: {
48
+ type: String,
49
+ default: null,
50
+ },
51
+ region: {
52
+ type: String,
53
+ required: true,
54
+ },
55
+ specs: {
56
+ cpu: { type: Number, default: 2000 },
57
+ memory: { type: Number, default: 2048 },
58
+ disk: { type: Number, default: 5 },
59
+ },
60
+ created_at: {
61
+ type: Date,
62
+ default: Date.now,
63
+ },
64
+ last_activity_at: {
65
+ type: Date,
66
+ default: Date.now,
67
+ },
68
+ expires_at: {
69
+ type: Date,
70
+ required: true,
71
+ },
72
+ destroyed_at: {
73
+ type: Date,
74
+ default: null,
75
+ },
76
+ destroy_reason: {
77
+ type: String,
78
+ enum: Object.values(SANDBOX_DESTROY_REASON),
79
+ default: null,
80
+ },
81
+ isDeleted: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
85
+ });
86
+
87
+ sandboxSchema.index({ user_id: 1, status: 1, isDeleted: 1 });
88
+ sandboxSchema.index({ expires_at: 1 });
89
+ sandboxSchema.index({ last_activity_at: 1, status: 1 });
90
+
91
+ export default model<ISandbox>("Sandbox", sandboxSchema);
package/team.ts CHANGED
@@ -26,6 +26,23 @@ const teamSchema: Schema = new Schema(
26
26
  image: {
27
27
  type: String,
28
28
  },
29
+ ai_usage_count: {
30
+ type: Number,
31
+ default: 0,
32
+ required: false
33
+ },
34
+ build_minutes: {
35
+ type: Number,
36
+ default: 0,
37
+ },
38
+ build_minutes_last_reset_at: {
39
+ type: Date,
40
+ default: null,
41
+ },
42
+ build_minutes_cycle_anchor: {
43
+ type: Date,
44
+ default: null,
45
+ },
29
46
  build_disabled: {
30
47
  type: Boolean,
31
48
  default: false,
@@ -35,6 +52,23 @@ const teamSchema: Schema = new Schema(
35
52
  required: false,
36
53
  ref: "Subscription",
37
54
  },
55
+ size: {
56
+ type: Number,
57
+ required: false,
58
+ },
59
+ enforce_2fa: {
60
+ type: Boolean,
61
+ default: false,
62
+ },
63
+ enforce_2fa_at: {
64
+ type: Date,
65
+ default: null,
66
+ },
67
+ enforce_2fa_by: {
68
+ type: Schema.Types.ObjectId,
69
+ ref: "User",
70
+ default: null,
71
+ },
38
72
  },
39
73
  {
40
74
  timestamps: true,
@@ -0,0 +1,19 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { ITeam } from "./team";
3
+ import { IUser } from "./user";
4
+
5
+ export interface IActivityLog extends Document {
6
+ user_id: IUser | Types.ObjectId;
7
+ team_id?: ITeam | Types.ObjectId;
8
+ action: string;
9
+ description?: string;
10
+ context?: string;
11
+ metadata?: Record<string, any>;
12
+ ip_address?: string;
13
+ user_agent?: string;
14
+ status: "success" | "failure";
15
+ resource_type?: string;
16
+ resource_id?: Types.ObjectId;
17
+ created_at: Date;
18
+ updated_at: Date;
19
+ }
@@ -3,10 +3,11 @@ import { IUser } from "./user";
3
3
  import { ITeam } from "./team";
4
4
 
5
5
  export interface IAppMessage extends Document {
6
- userId: IUser;
7
- teamId: ITeam;
6
+ userId?: IUser;
7
+ teamId?: ITeam;
8
8
  level: string;
9
9
  message: string;
10
+ seen: boolean;
10
11
  meta?: Record<string, any>;
11
12
  route?: string;
12
13
  type: string;
@@ -1,7 +1,10 @@
1
1
  import { Document } from "mongoose";
2
+ import { IUser } from "./user";
3
+ import { ITeam } from "./team";
2
4
 
3
5
  export interface ICashierSubscription extends Document {
4
- user_id: string;
6
+ user_id: IUser;
7
+ team_id?: ITeam | null;
5
8
  type: string;
6
9
  stripe_id: string;
7
10
  stripe_status: string;
@@ -9,7 +12,6 @@ export interface ICashierSubscription extends Document {
9
12
  quantity: number | null;
10
13
  trial_ends_at: Date | null;
11
14
  ends_at: Date | null;
12
- team_id: string | null;
13
15
  plan_type: string | null;
14
16
  domain_id: string | null;
15
17
  created_at: Date;
package/types/db-image.ts CHANGED
@@ -9,6 +9,7 @@ export interface IDbImage extends Document {
9
9
  is_available: boolean;
10
10
  is_default: boolean;
11
11
  image: string;
12
+ free: boolean;
12
13
  has_port: boolean;
13
14
  port: number;
14
15
  volumePath: string;
@@ -1,5 +1,5 @@
1
1
  import { Document } from "mongoose";
2
- import { IPreview, IProject, ISubscription, ITeam, IUser } from "../";
2
+ import { IPreview, IProject, IProjectEnvironment, ISubscription, ITeam, IUser } from "../";
3
3
  import { IDns } from "./dns";
4
4
 
5
5
  export interface IDomain extends Document {
@@ -24,6 +24,7 @@ export interface IDomain extends Document {
24
24
  trigger_created_at: string;
25
25
  nameservers: string[];
26
26
  dns: IDns[];
27
+ project_environment?: IProjectEnvironment;
27
28
  is_pending_verification: boolean;
28
29
  redirect?: {
29
30
  url: string;
package/types/env.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Document } from "mongoose";
2
2
  import { ENVIRONMENT } from "../enum";
3
- import { IBranch } from "./branch";
4
3
  import { IProject, IUser } from "./";
5
4
 
6
5
  export interface IEnv extends Document {
@@ -9,8 +8,6 @@ export interface IEnv extends Document {
9
8
  project: IProject;
10
9
  user: IUser;
11
10
  environment: ENVIRONMENT | string;
12
- branch?: IBranch;
13
- inheritable?: boolean;
14
11
  is_system?: boolean;
15
12
  createdAt: Date;
16
13
  updatedAt: Date;
@@ -0,0 +1,13 @@
1
+ import { Document } from "mongoose";
2
+ import { IProjectEnvironment } from "./project-environment";
3
+ import { IUser } from "./user";
4
+
5
+ export interface IEnvironmentVariable extends Document {
6
+ name: string;
7
+ value: string;
8
+ project_environment: IProjectEnvironment;
9
+ user: IUser;
10
+ inheritable: boolean;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
@@ -7,9 +7,10 @@ export interface IFramework extends Document {
7
7
  demo?: string;
8
8
  logo: string;
9
9
  tagline?: string;
10
- supported: boolean;
10
+ supported: boolean;
11
11
  description?: string;
12
12
  website: string;
13
+ port: number;
13
14
  envPrefix?: string;
14
15
  detector: string;
15
16
  file_detectors: string[];
@@ -37,4 +38,4 @@ export type BrimbleFrameworkType = {
37
38
  envPrefix: string;
38
39
  supported: boolean;
39
40
  type: string;
40
- };
41
+ };
package/types/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export type { IAutoScalingGroup } from "./auto-scaling-group";
2
- export type { IBranch } from "./branch";
3
2
  export type { ICard } from "./card";
4
3
  export type { IComputeChange } from "./compute";
5
4
  export type { IDbImage } from "./db-image";
@@ -24,6 +23,7 @@ export type { IPermission } from "./permission";
24
23
  export type { IPlanConfiguration } from "./plan_configuration";
25
24
  export type { IProvider } from "./provider";
26
25
  export type { IProject } from "./project";
26
+ export type { IProjectAnalytics } from "./project_analytics";
27
27
  export type { IProjectConnection } from "./project/connection";
28
28
  export type { IPreview } from "./project/preview";
29
29
  export type { IRegion } from "./region";
@@ -50,3 +50,9 @@ export type { IInvoice } from "./invoice";
50
50
  export type { IProjectTagAssignment } from "./project-tag-assignment";
51
51
  export type { ITag } from "./tag";
52
52
  export type { ICashierSubscription, ICashierSubscriptionItem } from "./cashier_subscription";
53
+ export type { IProjectEnvironment } from "./project-environment";
54
+ export type { IEnvironmentVariable } from "./environment-variable";
55
+ export type { IActivityLog } from "./activity-log";
56
+ export type { IOwnershipTransfer } from "./ownership-transfer";
57
+ export type { ISandbox, ISandboxSpecs } from "./sandbox";
58
+ export type { ISandboxImage } from "./sandbox-image";
package/types/member.ts CHANGED
@@ -2,6 +2,7 @@ import { Document } from "mongoose";
2
2
  import { ROLES } from "../enum";
3
3
  import { ITeam, IUser } from "./";
4
4
  import { IMemberPermission } from "./member-permission";
5
+ import { IProjectEnvironment } from "./project-environment";
5
6
 
6
7
  export interface IMember extends Document {
7
8
  user: IUser;
@@ -12,6 +13,7 @@ export interface IMember extends Document {
12
13
  email: string;
13
14
  featureOnboarded: boolean;
14
15
  permissions: IMemberPermission[];
16
+ project_environments: IProjectEnvironment[];
15
17
  createdAt: Date;
16
18
  updatedAt: Date;
17
19
  }
@@ -0,0 +1,13 @@
1
+ import { Document } from "mongoose";
2
+ import { ITeam } from "./team";
3
+ import { IUser } from "./user";
4
+
5
+ export interface IOwnershipTransfer extends Document {
6
+ team: ITeam;
7
+ from_user: IUser;
8
+ to_user: IUser;
9
+ status: "pending" | "accepted" | "denied" | "expired";
10
+ expires_at: Date;
11
+ created_at: Date;
12
+ updated_at: Date;
13
+ }
@@ -12,10 +12,13 @@ export interface IPlanConfiguration extends Document {
12
12
  project_limit: number;
13
13
  deploy_private_organization: boolean;
14
14
  preview_comments: boolean;
15
+ password_enabled: boolean;
15
16
  analytics: boolean;
16
17
  build_minutes: number;
17
18
  log_retention: number;
18
19
  multi_region: boolean;
20
+ ai_debug_enabled: boolean;
21
+ ai_debug_limit: number;
19
22
  bandwidth: number;
20
23
  pull_request_preview: boolean;
21
24
  plan_type: SUBSCRIPTION_PLAN_TYPE;
@@ -32,4 +35,6 @@ export interface IPlanConfiguration extends Document {
32
35
  webhook_enabled: boolean;
33
36
  can_deploy_all_applications: boolean;
34
37
  stripe_prices?: Record<string, string>;
38
+ sandbox_max_count: number;
39
+ sandbox_enabled: boolean;
35
40
  }
@@ -6,10 +6,10 @@ import { ILog } from "../logs";
6
6
  import { ITeam } from "../team";
7
7
  import { IUser } from "../user";
8
8
  import { IServer } from "../server";
9
- import { IBranch } from "../branch";
10
9
  import { IPreview } from "./preview";
11
10
  import { IDbImage } from "../db-image";
12
11
  import { IAutoScalingGroup } from "../auto-scaling-group";
12
+ import { IProjectEnvironment } from "../project-environment";
13
13
  import { IRegion } from "../region";
14
14
 
15
15
  export interface IProject extends Document {
@@ -17,6 +17,8 @@ export interface IProject extends Document {
17
17
  healthCheckPath?: string;
18
18
  preStartCommand?: string;
19
19
  backupEnabled: boolean;
20
+ free_tier_expires_at?: Date | null;
21
+ free_tier_expiry_notified_at?: Date | null;
20
22
  buildCacheEnabled?: boolean;
21
23
  domains: Array<IDomain>;
22
24
  environments: Array<IEnv>;
@@ -34,6 +36,7 @@ export interface IProject extends Document {
34
36
  user_id: IUser;
35
37
  monitor_id: string;
36
38
  nomadJobId: string;
39
+ watchPaths: string[];
37
40
  repo: {
38
41
  name: string;
39
42
  full_name: string;
@@ -68,7 +71,8 @@ export interface IProject extends Document {
68
71
  tracking_token: string;
69
72
  from: string;
70
73
  previews: IPreview[];
71
- branches: IBranch[];
74
+ project_environment?: IProjectEnvironment;
75
+ inherit_environment_vars: boolean;
72
76
  replicas: number;
73
77
  vaultPath: string | null;
74
78
  vaultToken: string | null;
@@ -0,0 +1,14 @@
1
+ import { Document } from "mongoose";
2
+ import { ITeam } from "./team";
3
+ import { IUser } from "./user";
4
+
5
+ export interface IProjectEnvironment extends Document {
6
+ name: string;
7
+ slug: string;
8
+ owner: IUser;
9
+ team?: ITeam;
10
+ inherit_from?: IProjectEnvironment;
11
+ isDefault: boolean;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
@@ -0,0 +1,12 @@
1
+ import { Document, Types } from "mongoose";
2
+
3
+ export interface IProjectAnalytics extends Document {
4
+ project: Types.ObjectId;
5
+ provider: "umami";
6
+ websiteId: string;
7
+ shareId?: string | null;
8
+ domain: string;
9
+ enabled: boolean;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ }
@@ -0,0 +1,10 @@
1
+ import { Document } from "mongoose";
2
+
3
+ export interface ISandboxImage extends Document {
4
+ name: string;
5
+ display_name: string;
6
+ image: string;
7
+ description: string;
8
+ is_available: boolean;
9
+ is_default: boolean;
10
+ }
@@ -0,0 +1,32 @@
1
+ import { Document, Types } from "mongoose";
2
+ import { IUser } from "./user";
3
+ import { ITeam } from "./team";
4
+ import { IProjectEnvironment } from "./project-environment";
5
+ import { SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON } from "../enum";
6
+
7
+ export interface ISandboxSpecs {
8
+ cpu: number;
9
+ memory: number;
10
+ disk: number;
11
+ }
12
+
13
+ export interface ISandbox extends Document {
14
+ user_id: IUser | Types.ObjectId;
15
+ team: ITeam | Types.ObjectId | null;
16
+ project_environment: IProjectEnvironment | Types.ObjectId | null;
17
+ template: string;
18
+ status: SANDBOX_STATUS;
19
+ nomad_job_id: string;
20
+ nomad_alloc_id: string | null;
21
+ host: string | null;
22
+ port: number | null;
23
+ agent_token_hash: string | null;
24
+ region: string;
25
+ specs: ISandboxSpecs;
26
+ created_at: Date;
27
+ last_activity_at: Date;
28
+ expires_at: Date;
29
+ destroyed_at: Date | null;
30
+ destroy_reason: SANDBOX_DESTROY_REASON | null;
31
+ isDeleted: boolean;
32
+ }
package/types/team.ts CHANGED
@@ -1,15 +1,23 @@
1
- import { Document } from "mongoose";
2
- import { IMember, IProject, ISubscription } from "./";
1
+ import { Document, Types } from "mongoose";
2
+ import { IMember, IProject, ISubscription, IUser } from "./";
3
3
  import { BUILD_DISABLED_BY } from "../enum";
4
4
 
5
5
  export interface ITeam extends Document {
6
6
  name: string;
7
7
  description: string;
8
+ size: number;
8
9
  members: IMember[];
9
10
  projects: IProject[];
11
+ ai_usage_count: number;
10
12
  image: string;
11
13
  isCreator: boolean;
14
+ build_minutes: number;
15
+ build_minutes_last_reset_at: Date | null;
16
+ build_minutes_cycle_anchor: Date | null;
12
17
  build_disabled: boolean;
13
18
  build_disabled_by: BUILD_DISABLED_BY;
14
19
  subscription: ISubscription;
20
+ enforce_2fa: boolean;
21
+ enforce_2fa_at: Date | null;
22
+ enforce_2fa_by: IUser | Types.ObjectId | null;
15
23
  }
package/types/user.ts CHANGED
@@ -13,6 +13,7 @@ export interface IUser extends Document {
13
13
  verification_token: number;
14
14
  token?: string;
15
15
  company?: string;
16
+ ai_usage_count: number;
16
17
  github: IGit;
17
18
  gitlab: IGit;
18
19
  location: string;
@@ -31,10 +32,12 @@ export interface IUser extends Document {
31
32
  build_minutes: number;
32
33
  disabled: boolean;
33
34
  disabled_at: Date;
35
+ has_payment_method: boolean;
34
36
  notifications: {
35
37
  email: boolean;
36
38
  mute: boolean;
37
39
  };
40
+ totp_enabled?: boolean;
38
41
  created_at: Date;
39
42
  updated_at: Date;
40
43
  }
package/types/wallet.ts CHANGED
@@ -2,4 +2,8 @@ import { Document } from "mongoose";
2
2
 
3
3
  export interface IWallet extends Document {
4
4
  balance: number;
5
+ slug: string;
6
+ enabled: boolean;
7
+ provider: string;
8
+ discounted: boolean;
5
9
  }
package/user.ts CHANGED
@@ -41,6 +41,11 @@ const userSchema: Schema = new Schema(
41
41
  type: String,
42
42
  required: false,
43
43
  },
44
+ ai_usage_count: {
45
+ type: Number,
46
+ default: 0,
47
+ required: false
48
+ },
44
49
  tenant: { type: Schema.Types.ObjectId, ref: "Tenancy", required: false },
45
50
  is_waitlist: { type: Boolean, default: true },
46
51
  spending_limit: { type: Number },
@@ -48,6 +53,8 @@ const userSchema: Schema = new Schema(
48
53
  notifications: Object,
49
54
  disabled: Boolean,
50
55
  disabled_at: Date,
56
+ has_payment_method: Boolean,
57
+ totp_enabled: { type: Boolean, default: false },
51
58
  },
52
59
  {
53
60
  timestamps: {
package/wallet.ts CHANGED
@@ -6,6 +6,22 @@ const walletSchema: Schema = new Schema({
6
6
  type: Number,
7
7
  required: true,
8
8
  },
9
+ enabled: {
10
+ type: Boolean,
11
+ default: true,
12
+ },
13
+ slug: {
14
+ type: String,
15
+ required: true,
16
+ },
17
+ provider: {
18
+ type: String,
19
+ required: true,
20
+ },
21
+ discounted: {
22
+ type: Boolean,
23
+ default: false
24
+ }
9
25
  });
10
26
 
11
27
  export default model<IWallet>("Wallet", walletSchema);
package/branch.ts DELETED
@@ -1,22 +0,0 @@
1
- import { Schema, model } from "mongoose";
2
- import { IBranch } from "./types";
3
- import { BRANCH_TYPE } from "./enum";
4
-
5
- const branchSchema = new Schema(
6
- {
7
- name: { type: String, required: true },
8
- type: { type: String, enum: Object.values(BRANCH_TYPE), required: true },
9
- gitRef: { type: String, required: true },
10
- project: { ref: "Project", type: Schema.Types.ObjectId, required: true },
11
- inherit_from: { ref: "Branch", type: Schema.Types.ObjectId },
12
- ancestors: [{ ref: "Branch", type: Schema.Types.ObjectId }],
13
- created_by: { ref: "User", type: Schema.Types.ObjectId, required: true },
14
- issue_comment_id: Number,
15
- pr_number: Number,
16
- },
17
- { timestamps: true },
18
- );
19
-
20
- branchSchema.index({ project: 1, name: 1 }, { unique: true });
21
-
22
- export default model<IBranch>("Branch", branchSchema);
package/dist/branch.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const mongoose_1 = require("mongoose");
4
- const enum_1 = require("./enum");
5
- const branchSchema = new mongoose_1.Schema({
6
- name: { type: String, required: true },
7
- type: { type: String, enum: Object.values(enum_1.BRANCH_TYPE), required: true },
8
- gitRef: { type: String, required: true },
9
- project: { ref: "Project", type: mongoose_1.Schema.Types.ObjectId, required: true },
10
- inherit_from: { ref: "Branch", type: mongoose_1.Schema.Types.ObjectId },
11
- ancestors: [{ ref: "Branch", type: mongoose_1.Schema.Types.ObjectId }],
12
- created_by: { ref: "User", type: mongoose_1.Schema.Types.ObjectId, required: true },
13
- issue_comment_id: Number,
14
- pr_number: Number,
15
- }, { timestamps: true });
16
- branchSchema.index({ project: 1, name: 1 }, { unique: true });
17
- exports.default = (0, mongoose_1.model)("Branch", branchSchema);
@@ -1,17 +0,0 @@
1
- import { Document } from "mongoose";
2
- import { BRANCH_TYPE } from "../enum";
3
- import { IProject } from "./project";
4
- import { IUser } from "./user";
5
- export interface IBranch extends Document {
6
- name: string;
7
- type: BRANCH_TYPE;
8
- gitRef: string;
9
- project: IProject;
10
- inherit_from?: IBranch;
11
- ancestors: IBranch[];
12
- created_by: IUser;
13
- pr_number?: number;
14
- issue_comment_id?: number;
15
- createdAt: Date;
16
- updatedAt: Date;
17
- }
package/types/branch.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Document } from "mongoose";
2
- import { BRANCH_TYPE } from "../enum";
3
- import { IProject } from "./project";
4
- import { IUser } from "./user";
5
-
6
- export interface IBranch extends Document {
7
- name: string;
8
- type: BRANCH_TYPE;
9
- gitRef: string;
10
- project: IProject;
11
- inherit_from?: IBranch;
12
- ancestors: IBranch[];
13
- created_by: IUser;
14
- pr_number?: number;
15
- issue_comment_id?: number;
16
- createdAt: Date;
17
- updatedAt: Date;
18
- }
File without changes