1
0
Fork 0
mirror of synced 2024-07-01 20:50:49 +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_STRING = 'string';
const TYPE_INTEGER = 'integer'; const TYPE_INTEGER = 'integer';
const TYPE_FLOAT = 'float'; const TYPE_FLOAT = 'double';
const TYPE_BOOLEAN = 'boolean'; const TYPE_BOOLEAN = 'boolean';
const TYPE_JSON = 'json'; const TYPE_JSON = 'json';

View file

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

View file

@ -25,7 +25,7 @@ class AttributeList extends Model
'getNestedType' => function(Document $attribute) { 'getNestedType' => function(Document $attribute) {
return match($attribute->getAttribute('type')) { return match($attribute->getAttribute('type')) {
self::TYPE_BOOLEAN => Response::MODEL_ATTRIBUTE_BOOLEAN, 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_FLOAT => Response::MODEL_ATTRIBUTE_FLOAT,
self::TYPE_STRING => match($attribute->getAttribute('format')) { self::TYPE_STRING => match($attribute->getAttribute('format')) {
APP_DATABASE_ATTRIBUTE_EMAIL => Response::MODEL_ATTRIBUTE_EMAIL, APP_DATABASE_ATTRIBUTE_EMAIL => Response::MODEL_ATTRIBUTE_EMAIL,