diff --git a/build/api/module/ueController.php b/build/api/module/ueController.php index 8cb9846..7b1917d 100644 --- a/build/api/module/ueController.php +++ b/build/api/module/ueController.php @@ -42,4 +42,25 @@ class ueController{ } + /* (3) Deletes an existing UE + * + * @code The UE code + * + * @return deleted Whether it has been removed + * + ---------------------------------------------------------*/ + public static function delete($args){ + $code = ''; + extract($args); + + /* Get the ue repo */ + /** @var ue $ue_repo */ + $ue_repo = Repo::getRepo('ue'); + + /* (1) Try to delete */ + return ['deleted' => $ue_repo->delete($code)]; + + } + + } \ No newline at end of file diff --git a/config/modules.json b/config/modules.json index 61c2d2a..e519d6b 100644 --- a/config/modules.json +++ b/config/modules.json @@ -185,7 +185,7 @@ "des": "Creates a new UE", "per": [], "par": { - "code": { "des": "UE code.", "typ": "varchar(2,30,alphanumeric)" }, + "code": { "des": "UE code.", "typ": "varchar(4,20,alphanumeric)" }, "label": { "des": "UE label", "typ": "varchar(2,30,alphanumeric)" }, "required": { "des": "If UE is required", "typ": "bool" }, "volumeCours": { "des": "Number of course hours for UE", "typ": "float" }, @@ -208,6 +208,18 @@ "out": { "ues": { "des": "UE list", "typ": "array" } } + }, + + + "DELETE": { + "des": "Deletes an existing UE", + "per": [], + "par": { + "URL0": { "des": "UE code.", "typ": "varchar(4,20,alphanumeric)", "ren": "code" } + }, + "out": { + "deleted": { "des": "Whether it has been deleted", "typ": "boolean" } + } }