From ad3626d64cd8226778525af97f38ea11eda3a313 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 1 Mar 2018 18:07:32 +0100 Subject: [PATCH] [module.professor] implemented DELETE --- build/api/module/ProfessorController.php | 23 ++++++++++++++++++++++- config/modules.json | 11 +++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/build/api/module/ProfessorController.php b/build/api/module/ProfessorController.php index 0be6192..788293f 100644 --- a/build/api/module/ProfessorController.php +++ b/build/api/module/ProfessorController.php @@ -77,7 +77,7 @@ class ProfessorController{ $hoursToDo = 0; $initials = ""; $isAdmin = false; - $casLogin = ""; + $casLogin = null; extract($args); /* Get the professor repo */ @@ -113,4 +113,25 @@ class ProfessorController{ } + + /* (3) Deletes an existing professor + * + * @prof_id The professor UID + * + * @return deleted Whether it has been removed + * + ---------------------------------------------------------*/ + public static function delete($args){ + $prof_id = 0; + extract($args); + + /* Get the professor repo */ + /** @var professor $prof_repo */ + $prof_repo = Repo::getRepo('professor'); + + /* (1) Try to delete */ + return ['deleted' => $prof_repo->delete($prof_id)]; + + } + } \ No newline at end of file diff --git a/config/modules.json b/config/modules.json index 71a4750..7fd7a63 100644 --- a/config/modules.json +++ b/config/modules.json @@ -60,6 +60,17 @@ } }, + "DELETE": { + "des": "Deletes an existing professor", + "per": [], + "par": { + "URL0": { "des": "Professor UID.", "typ": "id", "ren": "prof_id" } + }, + "out": { + "deleted": { "des": "Whether it has been deleted", "typ": "boolean" } + } + }, + "Stats": { "GET":{