From 15fe6241d172d30e71f09a4913005d172b053c9f Mon Sep 17 00:00:00 2001
From: Florian Burgener <florian.brgnr@gmail.com>
Date: Fri, 29 Sep 2023 19:26:53 +0200
Subject: [PATCH] Add results sorting

---
 src/backend/public/GET-educations.php  | 2 +-
 src/backend/public/GET-experiences.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/public/GET-educations.php b/src/backend/public/GET-educations.php
index b2e8823..7ebe4eb 100644
--- a/src/backend/public/GET-educations.php
+++ b/src/backend/public/GET-educations.php
@@ -6,5 +6,5 @@ use App\DB;
 header('Access-Control-Allow-Origin: *');
 header('Content-Type: application/json; charset=utf-8');
 
-$data = DB::run("SELECT * FROM educations");
+$data = DB::run("SELECT * FROM educations ORDER BY endDate DESC");
 echo json_encode($data);
diff --git a/src/backend/public/GET-experiences.php b/src/backend/public/GET-experiences.php
index 7b01055..e8fcba3 100644
--- a/src/backend/public/GET-experiences.php
+++ b/src/backend/public/GET-experiences.php
@@ -6,7 +6,7 @@ use App\DB;
 header('Access-Control-Allow-Origin: *');
 header('Content-Type: application/json; charset=utf-8');
 
-$data = DB::run("SELECT * FROM experiences");
+$data = DB::run("SELECT * FROM experiences ORDER BY endDate DESC");
 
 for ($i = 0; $i < count($data); $i++) {
     $data[$i]['tasks'] = DB::run('SELECT * FROM tasks WHERE experience_id = ?', $data[$i]['id']);
-- 
GitLab