Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects to mongodb and general improvements #20

Open
wants to merge 12 commits into
base: development
Choose a base branch
from

Conversation

bbrands02
Copy link

No description provided.

Copy link
Contributor

@rjzondervan rjzondervan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The objectService additions could probably be a bit cleaner, but it seems fine overall

Copy link
Contributor

@WilcoLouwerse WilcoLouwerse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Het is voor mij een beetje verwarrend dat ObjectService gebruikt word voor algemen/abstracte functies voor het ophalen van source / schema / register objecten maar ook hele specifieke bevragingen.
Ik zou een service verwachten die net zoals de huidige OpenCatalogi ObjectService is opgebouwd voor basis CRUD dingen van alle type entities, een service voor 'objectEntity' specifieke bevragingen, een service voor 'register' specifieke bevragingen

@@ -142,20 +144,18 @@ public function updateObject(array $filters, array $update, array $config): arra
{
$client = $this->getClient(config: $config);

$dotUpdate = new Dot($update);
// $dotUpdate = new Dot($update);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented out code

@@ -15,7 +15,6 @@ class Schema extends Entity implements JsonSerializable
protected ?array $required = [];
protected ?array $properties = [];
protected ?array $archive = [];
protected ?string $source = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source should be accessed and set from a register and not from schema self

public function viewObjectsFromRegister(int $register): JSONResponse
{
try {
$objects = $this->objectService->getObjects(register: $register);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we will need pagination here (or in the objectservice)

@@ -156,10 +167,10 @@ public function update(int $id): JSONResponse
* @param string $id The ID of the object to delete
* @return JSONResponse An empty JSON response
*/
public function destroy(int $id): JSONResponse
public function destroy(string $id): JSONResponse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should / could be string|int

{
$this->objectEntityMapper->delete($this->objectEntityMapper->find((int) $id));

return new JSONResponse([]);
}
return new JSONResponse($this->objectService->deleteObject(filters: ['id' => $id]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably take a look at Opencatalogi ObjectService and copy how it works there (incl. updating mappers for entities)

}

try {
return new JSONResponse($this->objectService->saveObject(object: $data, id: $id));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably take a look at Opencatalogi ObjectService and copy how it works there (incl. updating mappers for entities)

@@ -130,7 +135,7 @@ public function create(): JSONResponse
* @param string $id The ID of the object to update
* @return JSONResponse A JSON response containing the updated object details
*/
public function update(int $id): JSONResponse
public function update(string $id): JSONResponse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should / could be string|int

}

try {
return new JSONResponse($this->objectService->saveObject(object: $data));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably take a look at Opencatalogi ObjectService and copy how it works there (incl. updating mappers for entities)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants