mirror of
https://github.com/koloml/philomena-tagging-assistant.git
synced 2026-11-07 16:18:19 +00:00
Added validation logic for the group entity
This commit is contained in:
1 parent
470021ee8c
commit
6bd7116df2
1 file changed
+16
-1
@@ -48,7 +48,22 @@ const entitiesValidators: EntitiesValidationMap = {
|
||||
) {
|
||||
throw new Error('Invalid profile format detected!');
|
||||
}
|
||||
}
|
||||
},
|
||||
groups: importedObject => {
|
||||
if (!importedObject.v || importedObject.v > 2) {
|
||||
throw new Error('Unsupported group version!');
|
||||
}
|
||||
|
||||
if (
|
||||
!validateRequiredString(importedObject?.id)
|
||||
|| !validateRequiredString(importedObject?.name)
|
||||
|| !validateOptionalArray(importedObject?.tags)
|
||||
|| !validateOptionalArray(importedObject?.prefixes)
|
||||
|| !validateOptionalArray(importedObject?.suffixes)
|
||||
) {
|
||||
throw new Error('Invalid group format detected!');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user