1
0
Fork 0
mirror of synced 2024-07-04 06:00:53 +12:00

Add expire defaults

This commit is contained in:
Bradley Schofield 2024-02-06 19:22:54 +00:00
parent 559fa924c0
commit 70ea6734e7

View file

@ -2,12 +2,14 @@
namespace Appwrite\Migration\Version;
use Appwrite\Auth\Auth;
use Appwrite\Migration\Migration;
use Exception;
use PDOException;
use Throwable;
use Utopia\CLI\Console;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception\Authorization;
use Utopia\Database\Exception\Duplicate;
@ -525,6 +527,11 @@ class V20 extends Migration
$this->projectDB->createDocument('targets', $target);
}
break;
case 'sessions':
$duration = $this->project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;
$expire = DateTime::addSeconds(new \DateTime(), $duration);
$document->setAttribute('expire', $expire);
break;
}
return $document;
}