mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
validate only when scheduledAt is available
This commit is contained in:
parent
7ae237e433
commit
ed4e85f28a
1 changed files with 5 additions and 3 deletions
|
|
@ -123,9 +123,11 @@ class Create extends Base
|
|||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Scheduled executions must run asynchronously. Set scheduledAt to a future date, or set async to true.');
|
||||
}
|
||||
|
||||
$validator = new DatetimeValidator(requireDateInFuture: true, precision: DateTimeValidator::PRECISION_MINUTES, offset: 60);
|
||||
if (!$validator->isValid($scheduledAt)) {
|
||||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Scheduled execution date must be at least 60 seconds in the future');
|
||||
if (!is_null($scheduledAt)) {
|
||||
$validator = new DatetimeValidator(requireDateInFuture: true, precision: DateTimeValidator::PRECISION_MINUTES, offset: 60);
|
||||
if (!$validator->isValid($scheduledAt)) {
|
||||
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Scheduled execution date must be at least 60 seconds in the future');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue