@opinio-dev/models 1.3.1-movie-form.1 → 1.3.1-movie-form.2
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,7 +18,7 @@ export class BaseItemValidator extends BaseValidator {
|
|
|
18
18
|
* @returns {Record<string, string>} A record of validation errors.
|
|
19
19
|
*/
|
|
20
20
|
_validateBaseFields(item) {
|
|
21
|
-
const { id, type, name, releaseYear } = item;
|
|
21
|
+
const { id, type, name, releaseYear, imageUrl } = item;
|
|
22
22
|
const errors = {};
|
|
23
23
|
if (!id) {
|
|
24
24
|
errors.id = 'Item id is required';
|
|
@@ -36,6 +36,9 @@ export class BaseItemValidator extends BaseValidator {
|
|
|
36
36
|
if (releaseYear && (releaseYear < 1800 || releaseYear > currentYear)) {
|
|
37
37
|
errors.releaseYear = `Release year must be between 1800 and ${currentYear}`;
|
|
38
38
|
}
|
|
39
|
+
if (!imageUrl) {
|
|
40
|
+
errors.imageUrl = 'Item image url is required';
|
|
41
|
+
}
|
|
39
42
|
return errors;
|
|
40
43
|
}
|
|
41
44
|
}
|