@brimble/models 3.8.214 → 3.8.215
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/project/index.js +13 -0
- package/package.json +1 -1
package/dist/project/index.js
CHANGED
|
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeletedProject = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const enum_1 = require("../enum");
|
|
6
|
+
const runsCompute = function () {
|
|
7
|
+
return Boolean(this.serviceType) && this.serviceType !== enum_1.ServiceType.Static;
|
|
8
|
+
};
|
|
9
|
+
const minCpu = 0.2;
|
|
10
|
+
const minMemoryGb = 0.5;
|
|
11
|
+
const minimumComputeSpec = (label, minimum, unit) => ({
|
|
12
|
+
validator: function (value) {
|
|
13
|
+
return !runsCompute.call(this) || value >= minimum;
|
|
14
|
+
},
|
|
15
|
+
message: `${label} must be at least ${minimum}${unit} for projects that run compute`,
|
|
16
|
+
});
|
|
6
17
|
const projectSchema = new mongoose_1.Schema({
|
|
7
18
|
name: {
|
|
8
19
|
type: String,
|
|
@@ -404,10 +415,12 @@ const projectSchema = new mongoose_1.Schema({
|
|
|
404
415
|
memory: {
|
|
405
416
|
type: Number,
|
|
406
417
|
default: 0.5,
|
|
418
|
+
validate: minimumComputeSpec("Memory", minMemoryGb, " GB"),
|
|
407
419
|
},
|
|
408
420
|
cpu: {
|
|
409
421
|
type: Number,
|
|
410
422
|
default: 0.2,
|
|
423
|
+
validate: minimumComputeSpec("CPU", minCpu, " vCPU"),
|
|
411
424
|
},
|
|
412
425
|
storage: {
|
|
413
426
|
type: Number,
|