mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Update presence expiry datetime validation to enforce a 30-day maximum limit. This change standardizes the 'expiresAt' parameter across the Update and Upsert actions, ensuring consistent handling of presence expiry across the API.
This commit is contained in:
@@ -92,7 +92,11 @@ class Update extends PlatformAction
|
||||
->param('presenceId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Presence unique ID.', false, ['dbForProject'])
|
||||
->param('userId', null, new Nullable(new UID()), 'User ID.', true)
|
||||
->param('status', null, new Nullable(new Text(Database::LENGTH_KEY)), 'Presence status.', true)
|
||||
->param('expiresAt', null, new Nullable(new DatetimeValidator()), 'Presence expiry datetime.', true)
|
||||
->param('expiresAt', null, new Nullable(new DatetimeValidator(
|
||||
new \DateTime(),
|
||||
(new \DateTime())->modify('+30 days'),
|
||||
requireDateInFuture: true
|
||||
)), 'Presence expiry datetime.', true)
|
||||
->param('metadata', null, new Nullable(new JSON()), 'Presence metadata object.', true)
|
||||
->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE])), 'An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
|
||||
->inject('response')
|
||||
|
||||
@@ -96,8 +96,11 @@ class Upsert extends PlatformAction
|
||||
->param('userId', null, new Nullable(new UID()), 'User ID.', true)
|
||||
->param('status', '', new Text(Database::LENGTH_KEY), 'Presence status.', false)
|
||||
->param('permissions', null, new Nullable(new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE, [Database::PERMISSION_READ, Database::PERMISSION_UPDATE, Database::PERMISSION_DELETE, Database::PERMISSION_WRITE])), 'An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true)
|
||||
// TODO: what shall be the min and max date here
|
||||
->param('expiresAt', null, new Nullable(new DatetimeValidator(requireDateInFuture: true)), 'Presence expiry datetime.', true)
|
||||
->param('expiresAt', null, new Nullable(new DatetimeValidator(
|
||||
new \DateTime(),
|
||||
(new \DateTime())->modify('+30 days'),
|
||||
requireDateInFuture: true
|
||||
)), 'Presence expiry datetime.', true)
|
||||
->param('metadata', [], new JSON(), 'Presence metadata object.', true)
|
||||
->inject('response')
|
||||
->inject('request')
|
||||
|
||||
Reference in New Issue
Block a user