mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Return numbers as numbers on all API endpoints
This commit is contained in:
parent
639ef0da5b
commit
46c4cdb81a
@ -62,6 +62,7 @@
|
||||
- ⚠️ **Breaking changes**:
|
||||
- The product property `qu_factor_purchase_to_stock` was removed (existing factors were migrated to normal product specific QU conversions, see above)
|
||||
- The endpoint `/stock/products/{productId}` returns a new field/property `qu_conversion_factor_purchase_to_stock` for convenience (contains the conversion factor of the corresponding QU conversion from the product's qu_id_purchase to qu_id_stock)
|
||||
- Numbers are now returned as numbers (so technically without quotes around them, were strings for nearly all endpoints before)
|
||||
- The following entities are now also available via the endpoint `/objects/{entity}` (only listing, no edit)
|
||||
- `quantity_unit_conversions_resolved` (returns all final/resolved conversion factors per product and any directly or indirectly related quantity units)
|
||||
- The endpoint `/batteries` now also returns the corresponding battery object (as field/property `battery`)
|
||||
|
@ -9,12 +9,14 @@ const REQUIRED_PHP_EXTENSIONS = ['fileinfo', 'pdo_sqlite', 'gd', 'ctype', 'json'
|
||||
'filter', 'iconv', 'tokenizer'
|
||||
];
|
||||
|
||||
const REQUIRED_PHP_VERSION = '8.1.0';
|
||||
const REQUIRED_SQLITE_VERSION = '3.22.0';
|
||||
|
||||
class PrerequisiteChecker
|
||||
{
|
||||
public function checkRequirements()
|
||||
{
|
||||
self::checkForPhpVersion();
|
||||
self::checkForConfigFile();
|
||||
self::checkForConfigDistFile();
|
||||
self::checkForComposer();
|
||||
@ -49,7 +51,6 @@ class PrerequisiteChecker
|
||||
private function checkForPhpExtensions()
|
||||
{
|
||||
$loadedExtensions = get_loaded_extensions();
|
||||
|
||||
foreach (REQUIRED_PHP_EXTENSIONS as $extension)
|
||||
{
|
||||
if (!in_array($extension, $loadedExtensions))
|
||||
@ -62,13 +63,21 @@ class PrerequisiteChecker
|
||||
private function checkForSqliteVersion()
|
||||
{
|
||||
$sqliteVersion = self::getSqlVersionAsString();
|
||||
|
||||
if (version_compare($sqliteVersion, REQUIRED_SQLITE_VERSION, '<'))
|
||||
{
|
||||
throw new ERequirementNotMet('SQLite ' . REQUIRED_SQLITE_VERSION . ' is required, however you are running ' . $sqliteVersion);
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForPhpVersion()
|
||||
{
|
||||
$phpVersion = phpversion();
|
||||
if (version_compare($phpVersion, REQUIRED_PHP_VERSION, '<'))
|
||||
{
|
||||
throw new ERequirementNotMet('PHP ' . REQUIRED_PHP_VERSION . ' is required, however you are running ' . $phpVersion);
|
||||
}
|
||||
}
|
||||
|
||||
private function getSqlVersionAsString()
|
||||
{
|
||||
$dbh = new PDO('sqlite::memory:');
|
||||
|
@ -69,7 +69,6 @@ class DatabaseService
|
||||
{
|
||||
$pdo = new \PDO('sqlite:' . $this->GetDbFilePath());
|
||||
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
$pdo->setAttribute(\PDO::ATTR_STRINGIFY_FETCHES, true);
|
||||
|
||||
$pdo->sqliteCreateFunction('regexp', function ($pattern, $value) {
|
||||
mb_regex_encoding('UTF-8');
|
||||
|
Loading…
x
Reference in New Issue
Block a user