Design - Overview
This page gives a global overview of the structure of the CORE module of the OMS system, for more precise design please see below:
Page tree |
---|
|
Core goals
The goals of the CORE module is to provide a stable (backend) base for all other services to integrate with and rely on. the core will handle basic member storage, grouping, authentication and editing, as well as providing similar tools for groups created (bodies), on top of this it has integrated supports for oAuth 2.0 authentication such as with Microsoft Office 365. Additionally the core allows a new user to sign up, apply, for AEGEE and link that user to a member object when desired. The core will set up a permission system to be extended upon by the other microservices. The core will not handle the registration, routing, and enabling/disabling other microservices. While at this time of writing the core repository includes a frontend, the endgoal is to have this separated from the core, and let the real core microservice be a backend service solely.
To accompany all these functionalities the core makes use of the Laravel PHP framework (using a MVC pattern) combined with a PostgreSQL database and a REST API.
Data Flow
The most important part of the core is to understand it's dataflow when calling an API endpoint, as that is pretty much all the core does.
Available endpoints are documented on apiary or otherwise you can look at the routes.php file. The routes.php file defines the available endpoints to laravel, it specifies an URL, an HTTP method, the middleware to apply and finally the logic to call for processing the request. Typically a request goes as follows:
HTTP Request → routes.php → Middleware → Controller → Models/Database → Controller → Middleware → HTTP Response
In addition to this there are several Laravel concepts that are important to understand to realize what is going on:
- Service Providers
- Laravel has a concept of Service Providers, these are classes that register certain functionallity into the service container, which makes it more accessable to the rest of the code and prevents clutter being present in Controllers
- Eloquent Models
- Eloquent Models are objects created from and linked to the database, Laravel provides extensive abstraction methods to define relations and in order to easily make and call complex queries
- Request Objects
- Request objects are made for every request, these objects contain all the relevant information of the request as well as in some cases performing validation on the request. Request objects are mostly modified by Middleware and read by Controllers.
- Middleware
- Logic classes that perform certain actions on request before or after processing the request (by the controllers). Middleware typically do authentication, security, validation and formatting. Middleware are registered in kernel.php and assigned to routes in the routes.php file.