Let the Import feature accept migrations with missing data

This commit is contained in:
Bubka 2023-06-07 17:47:14 +02:00
parent d902e3ecae
commit d2fc93d78f

View File

@ -87,12 +87,12 @@ class MigratorFactory implements MigratorFactoryInterface
return count(Validator::validate( return count(Validator::validate(
$json, $json,
[ [
'data.*.otp_type' => 'required', 'data.*.otp_type' => 'present',
'data.*.service' => 'required', 'data.*.service' => 'present',
'data.*.account' => 'required', 'data.*.account' => 'present',
'data.*.secret' => 'required', 'data.*.secret' => 'present',
'data.*.digits' => 'required', 'data.*.digits' => 'present',
'data.*.algorithm' => 'required', 'data.*.algorithm' => 'present',
'data.*.period' => 'present', 'data.*.period' => 'present',
'data.*.counter' => 'present', 'data.*.counter' => 'present',
] ]
@ -135,10 +135,10 @@ class MigratorFactory implements MigratorFactoryInterface
return count(Validator::validate( return count(Validator::validate(
$json, $json,
[ [
'db.entries.*.type' => 'required', 'db.entries.*.type' => 'present',
'db.entries.*.name' => 'required', 'db.entries.*.name' => 'present',
'db.entries.*.issuer' => 'required', 'db.entries.*.issuer' => 'present',
'db.entries.*.info' => 'required', 'db.entries.*.info' => 'present',
] ]
)) > 0; )) > 0;
} }
@ -185,9 +185,9 @@ class MigratorFactory implements MigratorFactoryInterface
return count(Validator::validate( return count(Validator::validate(
$json, $json,
[ [
'services.*.secret' => 'required', 'services.*.secret' => 'present',
'services.*.name' => 'required', 'services.*.name' => 'present',
'services.*.otp' => 'required', 'services.*.otp' => 'present',
] ]
)) > 0; )) > 0;
} }