|
| path | : "/api/dashboard/{userId}" |
| | HTTP-spezifischer Kontext.
|
| |
| path | tags: ["Dashboard"] |
| |
| path | summary: "Retrieve the leave and dashboard data for a user" |
| |
| path | parameters: [ new OA\Parameter( name: "userId" |
| |
| path | in: "path" |
| |
| path | required: true |
| |
| path | description: "ID of the user" |
| |
| path | schema: new OA\Schema(type: "integer" |
| |
| path | example: 1) ) ] |
| |
| path | responses: [ new OA\Response( response: 200 |
| |
| path | content: new OA\JsonContent( properties: [ new OA\Property(property: "user" |
| |
| path | type: "object" |
| |
| | $databaseJoins = new DatabaseJoins() |
| |
| | $user |
| |
| | $currentYear = date('Y') |
| |
| | $totalLeaveDays = $user['remaining_leave_days'] ?? 30 |
| |
| | $usedLeaveDays = $holidayModel->getUsedLeaveDays($userId, $currentYear) ?? 0 |
| |
| | $remainingLeaveDays = $totalLeaveDays - $usedLeaveDays |
| |
| | $upcomingLeaves = $holidayModel->getNextApprovedLeaveRangeWithDays($userId) |
| |
| | $approvedLeaveRequests = $databaseJoins->getCountEvents($userId, $currentYear, 'approved', 'urlaub') |
| |
| | $pendingLeaveRequests = $databaseJoins->getCountEvents($userId, $currentYear, 'pending', 'urlaub') |
| |
| | $rejectedLeaveRequests = $databaseJoins->getCountEvents($userId, $currentYear, 'rejected', 'urlaub') |
| |
| | $sickDays = $holidayModel->getSickDays($userId, $currentYear) |
| |
DashboardController
Controller zur Bereitstellung von Dashboard-Daten für Benutzer.
◆ $approvedLeaveRequests
| App::Controllers::Api::DashboardController::$approvedLeaveRequests = $databaseJoins->getCountEvents($userId, $currentYear, 'approved', 'urlaub') |
◆ $currentYear
| App::Controllers::Api::DashboardController::$currentYear = date('Y') |
◆ $databaseJoins
| App::Controllers::Api::DashboardController::$databaseJoins = new DatabaseJoins() |
◆ $pendingLeaveRequests
| App::Controllers::Api::DashboardController::$pendingLeaveRequests = $databaseJoins->getCountEvents($userId, $currentYear, 'pending', 'urlaub') |
◆ $rejectedLeaveRequests
| App::Controllers::Api::DashboardController::$rejectedLeaveRequests = $databaseJoins->getCountEvents($userId, $currentYear, 'rejected', 'urlaub') |
◆ $remainingLeaveDays
| App::Controllers::Api::DashboardController::$remainingLeaveDays = $totalLeaveDays - $usedLeaveDays |
◆ $sickDays
| App::Controllers::Api::DashboardController::$sickDays = $holidayModel->getSickDays($userId, $currentYear) |
◆ $totalLeaveDays
| App::Controllers::Api::DashboardController::$totalLeaveDays = $user['remaining_leave_days'] ?? 30 |
◆ $upcomingLeaves
| App::Controllers::Api::DashboardController::$upcomingLeaves = $holidayModel->getNextApprovedLeaveRangeWithDays($userId) |
◆ $usedLeaveDays
| App::Controllers::Api::DashboardController::$usedLeaveDays = $holidayModel->getUsedLeaveDays($userId, $currentYear) ?? 0 |
◆ $user
| App::Controllers::Api::DashboardController::$user |
Initialisierung:= $userModel->find($userId) ?? [
'first_name' => 'Unbekannt',
'last_name' => 'Unbekannt',
'remaining_leave_days' => 30,
]
◆ __pad0__
| path App::Controllers::Api::DashboardController::__pad0__ |
HTTP-spezifischer Kontext.
Gibt die Urlaubsdaten eines Benutzers zurück.
Diese Methode ruft Informationen über die Urlaubsstatistiken und Anfragen eines bestimmten Benutzers ab.
- Parameter
-
| int | $userId | ID des Benutzers |
- Rückgabe
- Namespace: CodeIgniter
-
JSON-Antwort mit den Dashboard-Daten
API-Endpunkt {get} /api/dashboard/:userId Benutzer-Dashboard abrufen
- API Name: \1 GetUserDashboardData
- API Group: \1 Dashboard
- API Parameter: \1 {Number} userId Die ID des Benutzers
- API Success: \1 {Object} user Benutzerinformationen (Vorname, Nachname, verbleibende Urlaubstage)
- API Success: \1 {Number} totalLeaveDays Gesamtanzahl an Urlaubstagen
- API Success: \1 {Number} usedLeaveDays Anzahl der genutzten Urlaubstage
- API Success: \1 {Number} remainingLeaveDays Verbleibende Urlaubstage
- API Success: \1 {String} upcomingLeaves Nächster genehmigter Urlaub (Datumsbereich)
- API Success: \1 {Number} upcomingLeavesDays Anzahl der Tage des nächsten genehmigten Urlaubs
- API Success: \1 {Number} approvedLeaveRequests Anzahl der genehmigten Urlaubsanträge
- API Success: \1 {Number} pendingLeaveRequests Anzahl der ausstehenden Urlaubsanträge
- API Success: \1 {Number} rejectedLeaveRequests Anzahl der abgelehnten Urlaubsanträge
- API Success: \1 {Number} sickDays Anzahl der Krankheitstage
- API Error: \1 404 Benutzer nicht gefunden.
◆ content
| path App::Controllers::Api::DashboardController::content |
◆ description
| path App::Controllers::Api::DashboardController::description |
◆ example
| path App::Controllers::Api::DashboardController::example |
◆ in
| path App::Controllers::Api::DashboardController::in |
◆ parameters
| path App::Controllers::Api::DashboardController::parameters |
◆ required
| path App::Controllers::Api::DashboardController::required |
◆ responses
| path App::Controllers::Api::DashboardController::responses |
◆ schema
| path App::Controllers::Api::DashboardController::schema |
◆ summary
| path App::Controllers::Api::DashboardController::summary |
◆ tags
| path App::Controllers::Api::DashboardController::tags |
◆ type
| path App::Controllers::Api::DashboardController::type |
◆ $holidayModel
| App::Controllers::Api::DashboardController::$holidayModel = new HolidayModel() |
◆ Property
| UserModel App::Controllers::Api::DashboardController::Property |
|
getsetproperty |
Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: