1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

Refactor attributeCallback to function createAttribute

This commit is contained in:
kodumbeats 2021-08-24 09:49:58 -04:00
parent 4b0dc9dab3
commit c4cb72731e

View file

@ -42,7 +42,7 @@ use DeviceDetector\DeviceDetector;
*
* @return Document Newly created attribute document
*/
function attributesCallback($collectionId, $attribute, $response, $dbForInternal, $database, $audits): Document
function createAttribute($collectionId, $attribute, $response, $dbForInternal, $database, $audits): Document
{
$attributeId = $attribute->getId();
@ -473,7 +473,7 @@ App::post('/v1/database/collections/:collectionId/attributes/string')
throw new Exception($validator->getDescription(), 400);
}
$attribute = attributesCallback($collectionId, new Document([
$attribute = createAttribute($collectionId, new Document([
'$id' => $attributeId,
'type' => Database::VAR_STRING,
'size' => $size,
@ -512,7 +512,7 @@ App::post('/v1/database/collections/:collectionId/attributes/email')
/** @var Appwrite\Event\Event $database */
/** @var Appwrite\Event\Event $audits */
$attribute = attributesCallback($collectionId, new Document([
$attribute = createAttribute($collectionId, new Document([
'$id' => $attributeId,
'type' => Database::VAR_STRING,
'size' => 254,
@ -552,7 +552,7 @@ App::post('/v1/database/collections/:collectionId/attributes/ip')
/** @var Appwrite\Event\Event $database */
/** @var Appwrite\Event\Event $audits */
$attribute = attributesCallback($collectionId, new Document([
$attribute = createAttribute($collectionId, new Document([
'$id' => $attributeId,
'type' => Database::VAR_STRING,
'size' => 39,
@ -592,7 +592,7 @@ App::post('/v1/database/collections/:collectionId/attributes/url')
/** @var Appwrite\Event\Event $database */
/** @var Appwrite\Event\Event $audits */
$attribute = attributesCallback($collectionId, new Document([
$attribute = createAttribute($collectionId, new Document([
'$id' => $attributeId,
'type' => Database::VAR_STRING,
'size' => 2000,
@ -643,7 +643,7 @@ App::post('/v1/database/collections/:collectionId/attributes/integer')
throw new Exception($validator->getDescription(), 400);
}
$attribute = attributesCallback($collectionId, new Document([
$attribute = createAttribute($collectionId, new Document([
'$id' => $attributeId,
'type' => Database::VAR_INTEGER,
'size' => 0,
@ -698,7 +698,7 @@ App::post('/v1/database/collections/:collectionId/attributes/float')
throw new Exception($validator->getDescription(), 400);
}
$attribute = attributesCallback($collectionId, new Document([
$attribute = createAttribute($collectionId, new Document([
'$id' => $attributeId,
'type' => Database::VAR_FLOAT,
'required' => $required,
@ -742,7 +742,7 @@ App::post('/v1/database/collections/:collectionId/attributes/boolean')
/** @var Appwrite\Event\Event $database */
/** @var Appwrite\Event\Event $audits */
$attribute = attributesCallback($collectionId, new Document([
$attribute = createAttribute($collectionId, new Document([
'$id' => $attributeId,
'type' => Database::VAR_BOOLEAN,
'size' => 0,