@brimble/models 3.8.13 → 3.8.15

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
@@ -56,8 +56,9 @@ export { default as OwnershipTransfer } from "./ownership-transfer";
56
56
  export { default as Sandbox } from "./sandbox";
57
57
  export { default as SandboxImage } from "./sandbox-image";
58
58
  export { default as SandboxSnapshot } from "./sandbox-snapshot";
59
+ export { default as SandboxSnapshotUsageSegment } from "./sandbox-snapshot-usage-segment";
59
60
  export { default as SandboxUsageSegment } from "./sandbox-usage-segment";
60
- export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IDomainTransfer, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, IProjectEnvironment, IEnvironmentVariable, IActivityLog, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxImage, ISandboxSnapshot, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./types";
61
+ export { IUser, IGit, IProject, IProjectAnalytics, IPreview, IProjectConnection, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IDomainTransfer, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention, IProvider, ICollabAnnotation, ICollabComment, ICollabAttachment, ICollabIntegration, ICollabSettings, ICollabShareToken, ICollabPushSubscription, IAppMessage, IInvoice, ITag, IProjectTagAssignment, ICashierSubscription, ICashierSubscriptionItem, IProjectEnvironment, IEnvironmentVariable, IActivityLog, IOwnershipTransfer, ISandbox, ISandboxSpecs, ISandboxImage, ISandboxSnapshot, ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./types";
61
62
  export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, DomainTransferProvider, DomainTransferDirection, DomainTransferStatus, NomadDeploymentStatus, COLLAB_ANNOTATION_STATUS, COLLAB_INTEGRATION_TYPE, COLLAB_THEME, COLLAB_TOOLBAR_POSITION, INVOICE_STATUS, INVOICE_PAYMENT_STATUS, INVOICE_TYPE, SANDBOX_TEMPLATE, SANDBOX_STATUS, SANDBOX_DESTROY_REASON, SANDBOX_SNAPSHOT_STATUS, } from "./enum";
62
63
  import mongoose from "mongoose";
63
64
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
package/dist/index.js CHANGED
@@ -13,8 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ProjectTagAssignment = exports.Tag = exports.Invoice = exports.AppMessage = exports.CollabPushSubscription = exports.CollabShareToken = exports.CollabSettings = exports.CollabIntegration = exports.CollabComment = exports.CollabAnnotation = exports.Provider = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = exports.DomainTransfer = exports.DomainRenewal = exports.LoadBalancerPort = exports.Settings = exports.Framework = exports.Volume = exports.Region = exports.ComputeChange = exports.AutoScalingGroup = exports.PlanConfiguration = exports.Liscense = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.ProjectConnection = exports.Preview = exports.ProjectAnalytics = exports.DeletedProject = exports.Project = exports.User = void 0;
16
- exports.db = exports.connectToMongo = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.SandboxUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.Sandbox = exports.OwnershipTransfer = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = void 0;
17
- exports.healthCheckMongo = exports.closeMongo = void 0;
16
+ exports.connectToMongo = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_DESTROY_REASON = exports.SANDBOX_STATUS = exports.SANDBOX_TEMPLATE = exports.INVOICE_TYPE = exports.INVOICE_PAYMENT_STATUS = exports.INVOICE_STATUS = exports.COLLAB_TOOLBAR_POSITION = exports.COLLAB_THEME = exports.COLLAB_INTEGRATION_TYPE = exports.COLLAB_ANNOTATION_STATUS = exports.NomadDeploymentStatus = exports.DomainTransferStatus = exports.DomainTransferDirection = exports.DomainTransferProvider = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.SandboxUsageSegment = exports.SandboxSnapshotUsageSegment = exports.SandboxSnapshot = exports.SandboxImage = exports.Sandbox = exports.OwnershipTransfer = exports.ActivityLog = exports.EnvironmentVariable = exports.ProjectEnvironment = exports.CashierSubscriptionItem = exports.CashierSubscription = void 0;
17
+ exports.healthCheckMongo = exports.closeMongo = exports.db = void 0;
18
18
  var user_1 = require("./user");
19
19
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
20
20
  var project_1 = require("./project");
@@ -132,6 +132,8 @@ var sandbox_image_1 = require("./sandbox-image");
132
132
  Object.defineProperty(exports, "SandboxImage", { enumerable: true, get: function () { return __importDefault(sandbox_image_1).default; } });
133
133
  var sandbox_snapshot_1 = require("./sandbox-snapshot");
134
134
  Object.defineProperty(exports, "SandboxSnapshot", { enumerable: true, get: function () { return __importDefault(sandbox_snapshot_1).default; } });
135
+ var sandbox_snapshot_usage_segment_1 = require("./sandbox-snapshot-usage-segment");
136
+ Object.defineProperty(exports, "SandboxSnapshotUsageSegment", { enumerable: true, get: function () { return __importDefault(sandbox_snapshot_usage_segment_1).default; } });
135
137
  var sandbox_usage_segment_1 = require("./sandbox-usage-segment");
136
138
  Object.defineProperty(exports, "SandboxUsageSegment", { enumerable: true, get: function () { return __importDefault(sandbox_usage_segment_1).default; } });
137
139
  var enum_1 = require("./enum");
@@ -0,0 +1,30 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ import { ISandboxSnapshotUsageSegment } from "./types/sandbox-snapshot-usage-segment";
27
+ declare const _default: import("mongoose").Model<ISandboxSnapshotUsageSegment, {}, {}, {}, import("mongoose").Document<unknown, {}, ISandboxSnapshotUsageSegment> & ISandboxSnapshotUsageSegment & Required<{
28
+ _id: import("mongoose").Types.ObjectId;
29
+ }>, any>;
30
+ export default _default;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const sandboxSnapshotUsageSegmentSchema = new mongoose_1.Schema({
5
+ snapshot_id: {
6
+ type: mongoose_1.Schema.Types.ObjectId,
7
+ ref: "SandboxSnapshot",
8
+ required: true,
9
+ index: true,
10
+ },
11
+ user_id: {
12
+ type: mongoose_1.Schema.Types.ObjectId,
13
+ ref: "User",
14
+ required: true,
15
+ index: true,
16
+ },
17
+ team_id: {
18
+ type: mongoose_1.Schema.Types.ObjectId,
19
+ ref: "Team",
20
+ required: false,
21
+ default: null,
22
+ index: true,
23
+ },
24
+ size_gb: {
25
+ type: Number,
26
+ required: true,
27
+ default: 0,
28
+ },
29
+ costs: {
30
+ startDate: { type: Date, required: true },
31
+ endDate: { type: Date, default: null },
32
+ },
33
+ billed: {
34
+ type: Boolean,
35
+ default: false,
36
+ index: true,
37
+ },
38
+ }, {
39
+ timestamps: true,
40
+ });
41
+ sandboxSnapshotUsageSegmentSchema.index({ user_id: 1, billed: 1, "costs.endDate": 1 });
42
+ sandboxSnapshotUsageSegmentSchema.index({ team_id: 1, billed: 1, "costs.endDate": 1 });
43
+ sandboxSnapshotUsageSegmentSchema.index({ snapshot_id: 1, "costs.endDate": 1 });
44
+ sandboxSnapshotUsageSegmentSchema.index({ snapshot_id: 1 }, {
45
+ unique: true,
46
+ partialFilterExpression: { "costs.endDate": null },
47
+ name: "unique_open_segment_per_snapshot",
48
+ });
49
+ exports.default = (0, mongoose_1.model)("SandboxSnapshotUsageSegment", sandboxSnapshotUsageSegmentSchema, "sandbox_snapshot_usage_segments");
package/dist/sandbox.js CHANGED
@@ -107,6 +107,15 @@ const sandboxSchema = new mongoose_1.Schema({
107
107
  ref: "SandboxSnapshot",
108
108
  default: null,
109
109
  },
110
+ snapshot_mode: {
111
+ type: String,
112
+ enum: ["automatic", "manual"],
113
+ default: "manual",
114
+ },
115
+ snapshot_frequency: {
116
+ type: String,
117
+ default: null,
118
+ },
110
119
  isDeleted: {
111
120
  type: Boolean,
112
121
  default: false,
@@ -57,4 +57,5 @@ export type { IOwnershipTransfer } from "./ownership-transfer";
57
57
  export type { ISandbox, ISandboxSpecs } from "./sandbox";
58
58
  export type { ISandboxImage } from "./sandbox-image";
59
59
  export type { ISandboxSnapshot } from "./sandbox-snapshot";
60
+ export type { ISandboxSnapshotUsageSegment, ISandboxSnapshotUsageSegmentCosts, } from "./sandbox-snapshot-usage-segment";
60
61
  export type { ISandboxUsageSegment, ISandboxUsageSegmentCurrent, ISandboxUsageSegmentCosts, } from "./sandbox-usage-segment";
@@ -0,0 +1,16 @@
1
+ import { Document, Types } from "mongoose";
2
+ export interface ISandboxSnapshotUsageSegmentCosts {
3
+ startDate: Date;
4
+ endDate: Date | null;
5
+ }
6
+ export interface ISandboxSnapshotUsageSegment extends Document {
7
+ _id: Types.ObjectId;
8
+ snapshot_id: Types.ObjectId;
9
+ user_id: Types.ObjectId;
10
+ team_id: Types.ObjectId | null;
11
+ size_gb: number;
12
+ costs: ISandboxSnapshotUsageSegmentCosts;
13
+ billed: boolean;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -33,5 +33,7 @@ export interface ISandbox extends Document {
33
33
  paused_at: Date | null;
34
34
  image_override: string | null;
35
35
  from_snapshot: Types.ObjectId | null;
36
+ snapshot_mode: "automatic" | "manual";
37
+ snapshot_frequency: string | null;
36
38
  isDeleted: boolean;
37
39
  }
@@ -1,14 +1,17 @@
1
- import { Document } from "mongoose";
1
+ import { Document, Types } from "mongoose";
2
2
  import { IUser } from "./user";
3
3
  import { ITeam } from "./team";
4
- import { ISubscription } from "./subscription";
5
4
  export interface IVolume extends Document {
6
5
  name: string;
7
6
  user?: IUser;
8
7
  team?: ITeam;
9
- subscription: ISubscription;
10
8
  size: number;
11
9
  mount_path?: string;
10
+ csi_volume_id: string | null;
11
+ region: string | null;
12
+ attached_sandbox_id: Types.ObjectId | null;
13
+ attached_project_id: Types.ObjectId | null;
14
+ last_attached_at: Date | null;
12
15
  created_at?: Date;
13
16
  updated_at?: Date;
14
17
  }
package/dist/volume.js CHANGED
@@ -15,13 +15,21 @@ const volumeSchema = new mongoose_1.Schema({
15
15
  ref: "Team",
16
16
  default: null,
17
17
  },
18
- subscription: {
19
- type: mongoose_1.Schema.Types.ObjectId,
20
- required: true,
21
- ref: "Subscription",
22
- },
23
18
  size: { type: Number, required: true },
24
19
  mount_path: { type: String },
20
+ csi_volume_id: { type: String, default: null },
21
+ region: { type: String, default: null },
22
+ attached_sandbox_id: {
23
+ type: mongoose_1.Schema.Types.ObjectId,
24
+ ref: "Sandbox",
25
+ default: null,
26
+ },
27
+ attached_project_id: {
28
+ type: mongoose_1.Schema.Types.ObjectId,
29
+ ref: "Project",
30
+ default: null,
31
+ },
32
+ last_attached_at: { type: Date, default: null },
25
33
  }, {
26
34
  timestamps: {
27
35
  createdAt: "created_at",
package/index.ts CHANGED
@@ -56,6 +56,7 @@ export { default as OwnershipTransfer } from "./ownership-transfer";
56
56
  export { default as Sandbox } from "./sandbox";
57
57
  export { default as SandboxImage } from "./sandbox-image";
58
58
  export { default as SandboxSnapshot } from "./sandbox-snapshot";
59
+ export { default as SandboxSnapshotUsageSegment } from "./sandbox-snapshot-usage-segment";
59
60
  export { default as SandboxUsageSegment } from "./sandbox-usage-segment";
60
61
 
61
62
  export {
@@ -122,6 +123,8 @@ export {
122
123
  ISandboxSpecs,
123
124
  ISandboxImage,
124
125
  ISandboxSnapshot,
126
+ ISandboxSnapshotUsageSegment,
127
+ ISandboxSnapshotUsageSegmentCosts,
125
128
  ISandboxUsageSegment,
126
129
  ISandboxUsageSegmentCurrent,
127
130
  ISandboxUsageSegmentCosts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "3.8.13",
3
+ "version": "3.8.15",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,61 @@
1
+ import { model, Schema } from "mongoose";
2
+ import { ISandboxSnapshotUsageSegment } from "./types/sandbox-snapshot-usage-segment";
3
+
4
+ const sandboxSnapshotUsageSegmentSchema = new Schema<ISandboxSnapshotUsageSegment>(
5
+ {
6
+ snapshot_id: {
7
+ type: Schema.Types.ObjectId,
8
+ ref: "SandboxSnapshot",
9
+ required: true,
10
+ index: true,
11
+ },
12
+ user_id: {
13
+ type: Schema.Types.ObjectId,
14
+ ref: "User",
15
+ required: true,
16
+ index: true,
17
+ },
18
+ team_id: {
19
+ type: Schema.Types.ObjectId,
20
+ ref: "Team",
21
+ required: false,
22
+ default: null,
23
+ index: true,
24
+ },
25
+ size_gb: {
26
+ type: Number,
27
+ required: true,
28
+ default: 0,
29
+ },
30
+ costs: {
31
+ startDate: { type: Date, required: true },
32
+ endDate: { type: Date, default: null },
33
+ },
34
+ billed: {
35
+ type: Boolean,
36
+ default: false,
37
+ index: true,
38
+ },
39
+ },
40
+ {
41
+ timestamps: true,
42
+ },
43
+ );
44
+
45
+ sandboxSnapshotUsageSegmentSchema.index({ user_id: 1, billed: 1, "costs.endDate": 1 });
46
+ sandboxSnapshotUsageSegmentSchema.index({ team_id: 1, billed: 1, "costs.endDate": 1 });
47
+ sandboxSnapshotUsageSegmentSchema.index({ snapshot_id: 1, "costs.endDate": 1 });
48
+ sandboxSnapshotUsageSegmentSchema.index(
49
+ { snapshot_id: 1 },
50
+ {
51
+ unique: true,
52
+ partialFilterExpression: { "costs.endDate": null },
53
+ name: "unique_open_segment_per_snapshot",
54
+ },
55
+ );
56
+
57
+ export default model<ISandboxSnapshotUsageSegment>(
58
+ "SandboxSnapshotUsageSegment",
59
+ sandboxSnapshotUsageSegmentSchema,
60
+ "sandbox_snapshot_usage_segments",
61
+ );
package/sandbox.ts CHANGED
@@ -107,6 +107,15 @@ const sandboxSchema: Schema = new Schema({
107
107
  ref: "SandboxSnapshot",
108
108
  default: null,
109
109
  },
110
+ snapshot_mode: {
111
+ type: String,
112
+ enum: ["automatic", "manual"],
113
+ default: "manual",
114
+ },
115
+ snapshot_frequency: {
116
+ type: String,
117
+ default: null,
118
+ },
110
119
  isDeleted: {
111
120
  type: Boolean,
112
121
  default: false,
package/types/index.ts CHANGED
@@ -57,6 +57,10 @@ export type { IOwnershipTransfer } from "./ownership-transfer";
57
57
  export type { ISandbox, ISandboxSpecs } from "./sandbox";
58
58
  export type { ISandboxImage } from "./sandbox-image";
59
59
  export type { ISandboxSnapshot } from "./sandbox-snapshot";
60
+ export type {
61
+ ISandboxSnapshotUsageSegment,
62
+ ISandboxSnapshotUsageSegmentCosts,
63
+ } from "./sandbox-snapshot-usage-segment";
60
64
  export type {
61
65
  ISandboxUsageSegment,
62
66
  ISandboxUsageSegmentCurrent,
@@ -0,0 +1,18 @@
1
+ import { Document, Types } from "mongoose";
2
+
3
+ export interface ISandboxSnapshotUsageSegmentCosts {
4
+ startDate: Date;
5
+ endDate: Date | null;
6
+ }
7
+
8
+ export interface ISandboxSnapshotUsageSegment extends Document {
9
+ _id: Types.ObjectId;
10
+ snapshot_id: Types.ObjectId;
11
+ user_id: Types.ObjectId;
12
+ team_id: Types.ObjectId | null;
13
+ size_gb: number;
14
+ costs: ISandboxSnapshotUsageSegmentCosts;
15
+ billed: boolean;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ }
package/types/sandbox.ts CHANGED
@@ -35,5 +35,7 @@ export interface ISandbox extends Document {
35
35
  paused_at: Date | null;
36
36
  image_override: string | null;
37
37
  from_snapshot: Types.ObjectId | null;
38
+ snapshot_mode: "automatic" | "manual";
39
+ snapshot_frequency: string | null;
38
40
  isDeleted: boolean;
39
41
  }
package/types/volume.ts CHANGED
@@ -1,15 +1,18 @@
1
- import { Document } from "mongoose";
1
+ import { Document, Types } from "mongoose";
2
2
  import { IUser } from "./user";
3
3
  import { ITeam } from "./team";
4
- import { ISubscription } from "./subscription";
5
4
 
6
5
  export interface IVolume extends Document {
7
6
  name: string;
8
7
  user?: IUser;
9
8
  team?: ITeam;
10
- subscription: ISubscription;
11
9
  size: number;
12
10
  mount_path?: string;
11
+ csi_volume_id: string | null;
12
+ region: string | null;
13
+ attached_sandbox_id: Types.ObjectId | null;
14
+ attached_project_id: Types.ObjectId | null;
15
+ last_attached_at: Date | null;
13
16
  created_at?: Date;
14
17
  updated_at?: Date;
15
18
  }
package/volume.ts CHANGED
@@ -17,13 +17,21 @@ const volumeSchema: Schema = new Schema(
17
17
  ref: "Team",
18
18
  default: null,
19
19
  },
20
- subscription: {
21
- type: Schema.Types.ObjectId,
22
- required: true,
23
- ref: "Subscription",
24
- },
25
20
  size: { type: Number, required: true },
26
21
  mount_path: { type: String },
22
+ csi_volume_id: { type: String, default: null },
23
+ region: { type: String, default: null },
24
+ attached_sandbox_id: {
25
+ type: Schema.Types.ObjectId,
26
+ ref: "Sandbox",
27
+ default: null,
28
+ },
29
+ attached_project_id: {
30
+ type: Schema.Types.ObjectId,
31
+ ref: "Project",
32
+ default: null,
33
+ },
34
+ last_attached_at: { type: Date, default: null },
27
35
  },
28
36
  {
29
37
  timestamps: {