1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00

Fix response models

This commit is contained in:
kodumbeats 2021-08-27 16:27:59 -04:00
parent fb80088286
commit 783e9d86c0
3 changed files with 6 additions and 6 deletions

View file

@ -8,7 +8,7 @@ abstract class Model
{
const TYPE_STRING = 'string';
const TYPE_INTEGER = 'integer';
const TYPE_FLOAT = 'float';
const TYPE_FLOAT = 'double';
const TYPE_BOOLEAN = 'boolean';
const TYPE_JSON = 'json';

View file

@ -13,18 +13,18 @@ class AttributeFloat extends Attribute
$this
->addRule('min', [
'type' => self::TYPE_INTEGER,
'type' => self::TYPE_FLOAT,
'description' => 'Minimum value to enforce for new documents.',
'default' => null,
'example' => 1,
'example' => 1.5,
'array' => false,
'require' => false,
])
->addRule('max', [
'type' => self::TYPE_INTEGER,
'type' => self::TYPE_FLOAT,
'description' => 'Maximum value to enforce for new documents.',
'default' => null,
'example' => 10,
'example' => 10.5,
'array' => false,
'require' => false,
])

View file

@ -25,7 +25,7 @@ class AttributeList extends Model
'getNestedType' => function(Document $attribute) {
return match($attribute->getAttribute('type')) {
self::TYPE_BOOLEAN => Response::MODEL_ATTRIBUTE_BOOLEAN,
self::TYPE_INTEGER=> Response::MODEL_ATTRIBUTE_INTEGER,
self::TYPE_INTEGER => Response::MODEL_ATTRIBUTE_INTEGER,
self::TYPE_FLOAT => Response::MODEL_ATTRIBUTE_FLOAT,
self::TYPE_STRING => match($attribute->getAttribute('format')) {
APP_DATABASE_ATTRIBUTE_EMAIL => Response::MODEL_ATTRIBUTE_EMAIL,