Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ca17c83
Merge pull request #58 from ConductionNL/development
remko48 Nov 8, 2024
b725a03
Bump version to 0.1.23
actions-user Nov 8, 2024
cfabf6c
Merge pull request #69 from ConductionNL/development
remko48 Nov 21, 2024
dd541e0
Bump version to 0.1.24
actions-user Nov 21, 2024
f9be5aa
Merge pull request #74 from ConductionNL/development
rjzondervan Nov 28, 2024
ad71bf4
Bump version to 0.1.25
actions-user Nov 28, 2024
5290d92
Merge pull request #77 from ConductionNL/development
rubenvdlinde Nov 30, 2024
11015ae
Bump version to 0.1.26
actions-user Nov 30, 2024
7d8693f
Merge pull request #83 from ConductionNL/development
rjzondervan Dec 3, 2024
0ddb194
Bump version to 0.1.27
actions-user Dec 3, 2024
e433373
Merge pull request #86 from ConductionNL/development
bbrands02 Dec 3, 2024
c7a38ff
Bump version to 0.1.28
actions-user Dec 3, 2024
f11970a
Merge pull request #89 from ConductionNL/development
rjzondervan Dec 4, 2024
2332739
Bump version to 0.1.29
actions-user Dec 4, 2024
63edc7d
Merge pull request #92 from ConductionNL/development
bbrands02 Dec 5, 2024
5799d7a
Bump version to 0.1.30
actions-user Dec 5, 2024
0911769
Merge pull request #95 from ConductionNL/development
remko48 Dec 9, 2024
07e6dd1
Bump version to 0.1.31
actions-user Dec 9, 2024
eb62f1a
Merge pull request #107 from ConductionNL/development
rjzondervan Dec 19, 2024
1738cb3
Bump version to 0.1.32
actions-user Dec 19, 2024
f6c9bd0
Merge pull request #112 from ConductionNL/development
rubenvdlinde Dec 28, 2024
8a8f047
Bump version to 0.1.33
actions-user Dec 28, 2024
3ed6e00
Merge remote-tracking branch 'origin/main' into development
rubenvdlinde Dec 28, 2024
7627679
Merge branch 'development' into feature/REGISTERS-85/improved-develop…
rubenvdlinde Dec 28, 2024
a5ed542
Allow extending on creation and update
rubenvdlinde Dec 31, 2024
32bc4e0
Small refactor
rubenvdlinde Jan 1, 2025
7dd702d
Better code for extending from external applicaitons
rubenvdlinde Jan 1, 2025
394b661
Update from dev
rubenvdlinde Jan 2, 2025
b8aefee
Extend registers withs schema's
rubenvdlinde Jan 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .babelrc
100755 → 100644
Empty file.
Empty file modified .eslintrc.js
100755 → 100644
Empty file.
Empty file modified .gitattributes
100755 → 100644
Empty file.
Empty file modified .gitignore
100755 → 100644
Empty file.
Empty file modified .nvmrc
100755 → 100644
Empty file.
Empty file modified .php-cs-fixer.dist.php
100755 → 100644
Empty file.
Empty file modified .prettierrc
100755 → 100644
Empty file.
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion appinfo/info.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Create a [bug report](https://github.com/OpenRegister/.github/issues/new/choose)

Create a [feature request](https://github.com/OpenRegister/.github/issues/new/choose)
]]></description>
<version>0.1.22</version>
<version>0.1.33</version>
<licence>agpl</licence>
<author mail="info@conduction.nl" homepage="https://www.conduction.nl/">Conduction</author>
<namespace>OpenRegister</namespace>
Expand Down
Empty file modified appinfo/routes.php
100755 → 100644
Empty file.
Empty file modified composer-setup.php
100755 → 100644
Empty file.
Empty file modified composer.json
100755 → 100644
Empty file.
Empty file modified composer.lock
100755 → 100644
Empty file.
Empty file modified css/main.css
100755 → 100644
Empty file.
Empty file modified docs/styleguide.md
100755 → 100644
Empty file.
Empty file modified img/app-dark.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/app.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jest.config.js
100755 → 100644
Empty file.
Empty file modified lib/AppInfo/Application.php
100755 → 100644
Empty file.
Empty file modified lib/Controller/DashboardController.php
100755 → 100644
Empty file.
Empty file modified lib/Migration/Version1Date20240924200009.php
100755 → 100644
Empty file.
Empty file modified lib/Migration/Version1Date20241019205009.php
100755 → 100644
Empty file.
Empty file modified lib/Migration/Version1Date20241020231700.php
100755 → 100644
Empty file.
Empty file modified lib/Migration/Version1Date20241022135300.php
100755 → 100644
Empty file.
Empty file modified lib/Service/MongoDbService.php
100755 → 100644
Empty file.
96 changes: 62 additions & 34 deletions lib/Service/ObjectService.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -202,28 +202,39 @@ public function find(int|string $id, ?array $extend = []): ?ObjectEntity
* @throws ValidationException If validation fails.
* @throws GuzzleException If there is an error during file upload.
*/
public function createFromArray(array $object): ObjectEntity
public function createFromArray(array $object, ?array $extend = []): array
{
return $this->saveObject(
register: $this->getRegister(),
schema: $this->getSchema(),
object: $object
);
}
$objectEntity = $this->saveObject(
register: $this->getRegister(),
schema: $this->getSchema(),
object: $object
);

// Lets turn the whole thing into an array
$objectEntity = $objectEntity->jsonSerialize();

// Extend object with properties if requested
if (empty($extend) === false) {
$objectEntity = $this->extendEntity(entity: $objectEntity, extend: $extend);
}

return $objectEntity;
}

/**
* Updates an existing object with new data.
*
* @param string $id The ID of the object to update.
* @param array $object The new data for the object.
* @param bool $updatedObject If true, performs a full update. If false, performs a patch update.
* @param bool $patch Determines if the update should merge with existing data.
* @param string $id The object ID to update
* @param array $object The new object data
* @param bool $updateVersion Whether this is an update operation
* @param bool $patch Whether this is a patch operation
* @param array|null $extend Properties to extend with related data
*
* @return ObjectEntity The updated object entity.
* @throws ValidationException If validation fails.
* @throws GuzzleException If there is an error during file upload.
*/
public function updateFromArray(string $id, array $object, bool $updatedObject, bool $patch = false): ObjectEntity
public function updateFromArray(string $id, array $object, bool $updateVersion, bool $patch = false, ?array $extend = []): array
{
$object['id'] = $id;

Expand All @@ -237,12 +248,22 @@ public function updateFromArray(string $id, array $object, bool $updatedObject,
$object = array_merge($oldObject, $object);
}

return $this->saveObject(
register: $this->getRegister(),
schema: $this->getSchema(),
object: $object
);
}
$objectEntity = $this->saveObject(
register: $this->getRegister(),
schema: $this->getSchema(),
object: $object,
);

// Lets turn the whole thing into an array
$objectEntity = $objectEntity->jsonSerialize();

// Extend object with properties if requested
if (empty($extend) === false) {
$objectEntity = $this->extendEntity(entity: $objectEntity, extend: $extend);
}

return $objectEntity;
}

/**
* Deletes an object.
Expand Down Expand Up @@ -1567,30 +1588,37 @@ public function extendEntity(array $entity, array $extend): array
}

/**
* Retrieves all registers with their associated schema data.
* Get all registers extended with their schemas
*
* Converts registers to arrays and extends them with schema information as needed.
*
* @return array The list of registers with extended schema details.
* @throws Exception If extending schemas fails.
* @return array The registers with schema data
* @throws Exception If extension fails
*/
public function getRegisters(): array
{
// Get all registers
$registers = $this->registerMapper->findAll();

// Convert to arrays
$registers = array_map(function ($object) {
return $object->jsonSerialize();
}, $registers);
// Convert to arrays and extend schemas
$registers = array_map(function($register) {
$registerArray = is_array($register) ? $register : $register->jsonSerialize();

// Replace schema IDs with actual schema objects if schemas property exists
if (isset($registerArray['schemas']) && is_array($registerArray['schemas'])) {
$registerArray['schemas'] = array_map(
function($schemaId) {
try {
return $this->schemaMapper->find($schemaId)->jsonSerialize();
} catch (Exception $e) {
// If schema can't be found, return the ID
return $schemaId;
}
},
$registerArray['schemas']
);
}

// Extend with schemas
$extend = ['schemas'];
if (empty($extend) === false) {
$registers = array_map(function ($object) use ($extend) {
return $this->extendEntity(entity: $object, extend: $extend);
}, $registers);
}
return $registerArray;
}, $registers);

return $registers;
}
Expand Down
Empty file modified lib/Service/ValidationService.php
100755 → 100644
Empty file.
Empty file modified openapi.json
100755 → 100644
Empty file.
Empty file modified package-lock.json
100755 → 100644
Empty file.
Empty file modified package.json
100755 → 100644
Empty file.
Empty file modified phpmd.xml
100755 → 100644
Empty file.
Empty file modified phpunit.xml
100755 → 100644
Empty file.
Empty file modified psalm copy.xml
100755 → 100644
Empty file.
Empty file modified psalm.xml
100755 → 100644
Empty file.
Empty file modified src/App.vue
100755 → 100644
Empty file.
Empty file modified src/dialogs/Dialogs.vue
100755 → 100644
Empty file.
Empty file modified src/entities/index.js
100755 → 100644
Empty file.
Empty file modified src/entities/register/index.js
100755 → 100644
Empty file.
Empty file modified src/entities/schema/index.js
100755 → 100644
Empty file.
Empty file modified src/entities/source/index.js
100755 → 100644
Empty file.
Empty file modified src/main.js
100755 → 100644
Empty file.
Empty file modified src/modals/Modals.vue
100755 → 100644
Empty file.
Empty file modified src/navigation/Configuration.vue
100755 → 100644
Empty file.
Empty file modified src/navigation/MainMenu.vue
100755 → 100644
Empty file.
Empty file modified src/pinia.js
100755 → 100644
Empty file.
Empty file modified src/sidebars/SideBars.vue
100755 → 100644
Empty file.
Empty file modified src/sidebars/dashboard/DashboardSideBar.vue
100755 → 100644
Empty file.
Empty file modified src/sidebars/search/SearchSideBar.vue
100755 → 100644
Empty file.
Empty file modified src/store/modules/navigation.js
100755 → 100644
Empty file.
Empty file modified src/store/modules/navigation.spec.js
100755 → 100644
Empty file.
Empty file modified src/store/store.js
100755 → 100644
Empty file.
Empty file modified src/views/Views.vue
100755 → 100644
Empty file.
Empty file modified src/views/dashboard/DashboardIndex.vue
100755 → 100644
Empty file.
Empty file modified stylelint.config.js
100755 → 100644
Empty file.
Empty file modified templates/index.php
100755 → 100644
Empty file.
Empty file modified tsconfig.json
100755 → 100644
Empty file.
Empty file modified webpack.config.js
100755 → 100644
Empty file.