-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: development
Are you sure you want to change the base?
Conversation
dont send schema.source
use mongodbservice
…ERS-38/objects-to-mongodb
There was a problem hiding this 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
There was a problem hiding this 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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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])); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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)
No description provided.