Directus ist eine Open-Source-Datenplattform, die die Datenverwaltung und den Datenzugang vereinfacht. Sie ermöglicht es Teams, unabhängig von ihren technischen Kenntnissen, mühelos mit Datenbanken und digitalen Datenbeständen zu arbeiten. Mit Directus können Sie eine Verbindung zu Ihrer SQL-Datenbank herstellen und CRUD-Operationen, Benutzerverwaltung, komplexe Abfragen, Webhooks und Automatisierung durchführen. Es bietet eine flexible und erweiterbare Architektur, die REST- und GraphQL-APIs, CLI-Tools und ein JavaScript-SDK unterstützt. Directus fördert die Kontrolle durch die Entwickler, die Skalierbarkeit und die Anpassungsoptionen und eignet sich daher für Headless CMS, Backend-as-a-Service, Datenmanagement und Analyseprojekte. Es handelt sich um eine datenorientierte Lösung ohne Herstellerbindung und mit umfassender Dokumentation.
Im Kontext der Mobilitätslösung dient Directus als Backend-as-a-Service bzw. Headless CMS. Es bildet die zentrale Datenhaltung des Systems, gepaart mit dem nativen Dirctus-CMS Frontend, dar. Um die Funktionalitäten für Mobility-Lösung abzubilden, wurde Directus mittels Extensions in seinem Fuktionsumfang erweitert. Dazu gehören Extensions der folgenden Kategorien:
- Endpunkte
- sog. Hooks
- Module
- Views
Die entwickelten Extensions befinden sich im Ordner code
Dieser Container enthält alle benötigten, "compilierten" Extensions, die für die Abbildung der Funktionalität des Mobilitätssystems benötigt werden. Dazu gehören:
Name | Typ | Beschreibung |
---|---|---|
custom-endpoints | Endpoint | Zusätzliche Endpunkte für REST-API. Z.b. Abfrage von OperatingTimes für Zeitraum X bis Y |
mphooks | Hooks | Aktionen, die bei Veränderung von Daten in Tabellen automatisch ausgelöst werden. Bsp.: Bus-Position wird aktualisiert und mit dem Routing synchronisiert (mittels RabbitMQ) |
routing-hooks | Hooks | Eigene Extension für die Herstellung der Kommunikation mit dem Routing - Abbildung aller Events zwischen Routing/Directus |
system-push-endpoint | Endpoint | Zusätzliche Endpunkte, um Push-Benachrichtigungen an Nutzer/Fahrer zu senden. Sucht nach Tokens der jeweiligen Nutzer einer Gruppe und sendet Text an FCM-Service |
system-push-module | Module | Einbindbares Modul in die Directus-Oberfläche, um Funktionalität für System-Push-Benachrichtigungen visuell abzubilden |
Die Directus-API wird durch die entwickelten Extensions um folgende Endpunkte erweitert (s. all.http)
GET
{{BASE_URL}}/customendpoints/operatingtime/{communityId}/{isoFromDateTime}/{isoToDateTime}
Name Type Data Type Description communityId required string ID of the community isoFromDateTime required string Start date and time in ISO 8601 format isoToDateTime required string End date and time in ISO 8601 format
[
{
"busId": 11,
"communityId": 1,
"name": "ErzMobil",
"seats": 6,
"seatsWheelchair": 1,
"seatsBlockedPerWheelchair": 2,
"availabilitySlots": [],
"blockingSlots": []
}
]
GET
/customendpoints/operatingtime/{communityId}/{isoFromDateTime}/{isoToDateTime}
Name Type Data Type Description communityId required string ID of the community isoFromDateTime required string Start date and time in ISO 8601 format isoToDateTime required string End date and time in ISO 8601 format
[
{
"busId": 11,
"communityId": 1,
"name": "ErzMobil",
"seats": 6,
"seatsWheelchair": 1,
"seatsBlockedPerWheelchair": 2,
"availabilitySlots": [
{
"startDate": "2023-07-12T06:00:00+00:00",
"endDate": "2023-07-12T08:00:00+00:00"
}
],
"blockingSlots": []
}
]
GET
/customendpoints/roadclosures/{communityId}/{isoFromDateTime}/{isoToDateTime}
Name Type Data Type Description communityId required string ID of the community isoFromDateTime required string Start date and time in ISO 8601 format isoToDateTime required string End date and time in ISO 8601 format
HTTP Code Content-Type Response 200 application/json;charset=UTF-8
Road closures
GET
/routes/:routeId/phoneNumbers
Name Type Data Type Description routeId required string ID of the specific route
HTTP Code Content-Type Response 200 application/json;charset=UTF-8
Phone numbers
GET
/customendpoints/canbook
No parameters required.
HTTP Code | Content-Type | Response |
---|---|---|
200 | text/plain;charset=UTF-8 |
false |
200 | text/plain;charset=UTF-8 |
true |
POST
/token
No request body required.
HTTP Code Content-Type Response 200 text/plain;charset=UTF-8
Token added
DELETE
/token/:token
Name Type Data Type Description token required string FCM token to be deleted
HTTP Code Content-Type Response 200 text/plain;charset=UTF-8
Token deleted
POST
/stops/nearest
{
"lat": "12.2",
"lng": "13.3",
"r": "500",
"n": 1
}
Name | Type | Data Type | Description |
---|---|---|---|
lat | required | string | Latitude of the location |
lng | required | string | Longitude of the location |
r | required | string | Radius in meters |
n | optional | number | Number of stops to retrieve |
HTTP Code | Content-Type | Response |
---|---|---|
200 | application/json;charset=UTF-8 |
Nearest stop data |
GET
/users/me
(returns clients userId in directus)
name type data type description Authorization required Headers Authorizationtoken provided by /auth/login from Directus
http code content-type response 200
text/plain;charset=UTF-8
true
/false
GET
/customendpoints/cognito
(returns cognito configuration)
http code content-type response 200
text/plain;charset=UTF-8
"userPoolId": "eu-central-1_tdwybtbCf","userClientId": "6ocqpe3d13dtpa0j72a30nkdek","driverClientId":"252a9fstcdet8l180mu4d5329a"
GET
/items/tickettype
(returns items from tickettype-collection)
http code content-type response 200
application/json;charset=UTF-8
{"data": [{"Name": "Schnell zum Arzt-Ticket"},{"Name": "Feierabendsause"},{"Name": "Schüler ABC"}]}
GET
/items/NewBackendAvailability
(returns toggle value for directus availability)
http code content-type response 200
text/plain;charset=UTF-8
true
/false
POST
/awsmw/auth
(login mechanism which exchanges a cognito token against a directus token)
name type data type description IdToken required JSON Body RefreshToken required JSON Body clientId required JSON Body
http code content-type response 200
application/json;charset=UTF-8
{"accessToken": "...", "expires": 2022-05-02T15:08:22.499Z, "refreshToken": "..."}
GET
/items/stop
(returns stops (haltestellen) configured in directus)
http code content-type response 200
application/json;charset=UTF-8
{ "data": [{"id":5,"name":"Test","location":{"coordinates":[13.326656180707829,52.51944337812006],"type": "Point"},"communityId": 2}]}
GET
/items/stop
(returns stops (haltestellen) configured in directus)
http code content-type response 200
application/json;charset=UTF-8
{ "data": [{"id":5,"name":"Test","location":{"coordinates":[13.326656180707829,52.51944337812006],"type": "Point"},"communityId": 2}]}
GET
/items/token/{token}
(returns token)
http code content-type response 200
application/json;charset=UTF-8
{"fcmToken":"kwjfalkjbafkjbflkjb", "isDriver": true}
POST
/items/token
POST a new token for FCM-Notifications
name type data type description fcmToken required JSON Body
http code content-type response 200
application/json;charset=UTF-8
{"fcmToken":"kwjfalkjbafkjbflkjb"}
POST
/items/token
POST a new token for FCM-Notifications
name type data type description fcmToken required JSON Body
http code content-type response 200
application/json;charset=UTF-8
{"fcmToken":"kwjfalkjbafkjbflkjb", "isDriver": true}