-
Notifications
You must be signed in to change notification settings - Fork 276
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
HTTP API Endpoints for Organization management #276
base: master
Are you sure you want to change the base?
Conversation
$route['api/deletenodeorganization/(:num)'] = 'api/deletenodeorganization/$1'; | ||
$route['api/renamenodeorganization/(:num)'] = 'api/renamenodeorganization/$1'; | ||
$route['api/attachEmployee/(:num)/(:num)'] = 'api/attachEmployee/$1/$2'; | ||
$route['api/detachEmployee/(:num)/(:num)'] = 'api/detachEmployee/$1/$2'; |
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 route has two parameters but only one is used
$route['api/deletenodeorganization/(:num)'] = 'api/deletenodeorganization/$1'; | ||
$route['api/renamenodeorganization/(:num)'] = 'api/renamenodeorganization/$1'; | ||
$route['api/attachEmployee/(:num)/(:num)'] = 'api/attachEmployee/$1/$2'; | ||
$route['api/detachEmployee/(:num)/(:num)'] = 'api/detachEmployee/$1/$2'; |
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.
REST: api/entities/employees/(:num)/detach
$route['api/movenodeorganization/(:num)/(:num)'] = 'api/movenodeorganization/$1/$2'; | ||
$route['api/deletenodeorganization/(:num)'] = 'api/deletenodeorganization/$1'; | ||
$route['api/renamenodeorganization/(:num)'] = 'api/renamenodeorganization/$1'; | ||
$route['api/attachEmployee/(:num)/(:num)'] = 'api/attachEmployee/$1/$2'; |
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.
REST: api/entities/(:num)/employees/(:num)/attach Or (POST) api/entities/(:num)/employees/(:num)
if (!$this->server->verifyResourceRequest(OAuth2\Request::createFromGlobals())) { | ||
$this->server->getResponse()->send(); | ||
} else { | ||
$this->load->model('Organization_model'); |
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.
Organization_model should be in lower case everywhere
* Get one node of the organization | ||
* @author Mickael ROMMME | ||
*/ | ||
public function organization_node($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.
Don't use underscore and use meaningful name, such as getEntity as Organization is composed of entities
@@ -1792,4 +1792,131 @@ private function validateDate($date, $format = 'Y-m-d') | |||
return $d && $d->format($format) === $date; | |||
} | |||
|
|||
/** | |||
* Get one node of the organization |
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.
Missing OpenAPI notation, see 32dbe5a
} else { | ||
$this->load->model('Organization_model'); | ||
$result = $this->Organization_model->getName($id); | ||
echo json_encode($result); |
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 MIMETYPE (output encoding) is not set. You should rely on the framework, e.g.:
$this->output
->set_content_type('application/json')
->set_output(json_encode($result));
} | ||
|
||
/** | ||
* Get id of all childrem of one node of the organization |
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.
Comment more clearly with expected parameters passed in POST request
Hi, Unfortunately, I cannot merge your work without modification. Starting from 32dbe5a I am adopting an URL format that looks more REST. And I am using the other HTTP verbs (PUT, POST, PATCH). The HTTP API must be documented with OpenAPI (ex-swagger). This allow us to test is easier. |
Bonjour Benjamin,
Merci pour cette application de gestion de congés. Elle est vraiment super.
J'ai développé des endpoints rest pour gérer les organisations via l'API. Je te l'envoie si tu souhaites l'intégrer dans une future version de Jorani.
Bonne continuation,
Mickael