added filters

This commit is contained in:
ArnabChatterjee20k
2025-08-22 12:47:00 +05:30
parent 95f67b274d
commit 9fa42e8084
3 changed files with 20 additions and 0 deletions
+3
View File
@@ -46,6 +46,9 @@ const APP_DATABASE_ATTRIBUTE_DATETIME = 'datetime';
const APP_DATABASE_ATTRIBUTE_URL = 'url';
const APP_DATABASE_ATTRIBUTE_INT_RANGE = 'intRange';
const APP_DATABASE_ATTRIBUTE_FLOAT_RANGE = 'floatRange';
const APP_DATABASE_ATTRIBUTE_POINT = 'point';
const APP_DATABASE_ATTRIBUTE_LINE = 'line';
const APP_DATABASE_ATTRIBUTE_POLYGON = 'polygon';
const APP_DATABASE_ATTRIBUTE_STRING_MAX_LENGTH = 1_073_741_824; // 2^32 bits / 4 bits per char
const APP_DATABASE_TIMEOUT_MILLISECONDS_API = 15 * 1000; // 15 seconds
const APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER = 300 * 1000; // 5 minutes
+5
View File
@@ -92,6 +92,11 @@ Database::addFilter(
$filters = $attribute->getAttribute('filters', []);
$attribute->setAttribute('encrypt', in_array('encrypt', $filters));
break;
case Database::VAR_POINT:
case Database::VAR_LINESTRING:
case Database::VAR_POLYGON:
break;
}
}
+12
View File
@@ -41,3 +41,15 @@ Structure::addFormat(APP_DATABASE_ATTRIBUTE_FLOAT_RANGE, function ($attribute) {
$max = $attribute['formatOptions']['max'] ?? INF;
return new Range($min, $max, Range::TYPE_FLOAT);
}, Database::VAR_FLOAT);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_POINT, function () {
return new \Utopia\Validator\Text(0, 0);
}, Database::VAR_POINT);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_LINE, function () {
return new \Utopia\Validator\Text(0, 0);
}, Database::VAR_LINESTRING);
Structure::addFormat(APP_DATABASE_ATTRIBUTE_POLYGON, function () {
return new \Utopia\Validator\Text(0, 0);
}, Database::VAR_POLYGON);