@autofleet/sadot 0.6.1-beta.1 → 0.6.1-temp-1
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.
|
@@ -18,6 +18,7 @@ var CustomFieldDefinitionType;
|
|
|
18
18
|
CustomFieldDefinitionType["TEXT"] = "text";
|
|
19
19
|
CustomFieldDefinitionType["IMAGE"] = "image";
|
|
20
20
|
CustomFieldDefinitionType["SELECT"] = "select";
|
|
21
|
+
CustomFieldDefinitionType["FILE"] = "file";
|
|
21
22
|
})(CustomFieldDefinitionType = exports.CustomFieldDefinitionType || (exports.CustomFieldDefinitionType = {}));
|
|
22
23
|
/**
|
|
23
24
|
* Validate that the given value is really of type "valueType"
|
|
@@ -43,6 +44,15 @@ const validateValueType = (value, valueType) => {
|
|
|
43
44
|
case CustomFieldDefinitionType.IMAGE:
|
|
44
45
|
return !joi_1.default.array().min(1).unique().items(joi_1.default.string().uri())
|
|
45
46
|
.validate(value).error;
|
|
47
|
+
case CustomFieldDefinitionType.FILE:
|
|
48
|
+
return !joi_1.default.array().min(1).unique().items(joi_1.default.object({
|
|
49
|
+
id: joi_1.default.string().uuid().required(),
|
|
50
|
+
name: joi_1.default.string().required(),
|
|
51
|
+
fileLink: joi_1.default.string().required(),
|
|
52
|
+
createdAt: joi_1.default.date(),
|
|
53
|
+
addedBy: joi_1.default.string().uuid(),
|
|
54
|
+
}))
|
|
55
|
+
.validate(value).error;
|
|
46
56
|
default:
|
|
47
57
|
return false;
|
|
48
58
|
}
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ export enum CustomFieldDefinitionType {
|
|
|
11
11
|
TEXT = 'text',
|
|
12
12
|
IMAGE = 'image',
|
|
13
13
|
SELECT = 'select',
|
|
14
|
+
FILE = 'file',
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Validate that the given value is really of type "valueType"
|
|
@@ -37,6 +38,15 @@ const validateValueType = (value: unknown, valueType: CustomFieldDefinitionType)
|
|
|
37
38
|
case CustomFieldDefinitionType.IMAGE:
|
|
38
39
|
return !Joi.array().min(1).unique().items(Joi.string().uri())
|
|
39
40
|
.validate(value).error;
|
|
41
|
+
case CustomFieldDefinitionType.FILE:
|
|
42
|
+
return !Joi.array().min(1).unique().items(Joi.object({
|
|
43
|
+
id: Joi.string().uuid().required(),
|
|
44
|
+
name: Joi.string().required(),
|
|
45
|
+
fileLink: Joi.string().required(),
|
|
46
|
+
createdAt: Joi.date(),
|
|
47
|
+
addedBy: Joi.string().uuid(),
|
|
48
|
+
}))
|
|
49
|
+
.validate(value).error;
|
|
40
50
|
default:
|
|
41
51
|
return false;
|
|
42
52
|
}
|