From 61d97ea429b9897ccc14a86558d4ecfe35ea2cef Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Mon, 13 Jun 2022 14:12:08 -0700 Subject: [PATCH] Update DOCUMENTATION.md --- DOCUMENTATION.md | 483 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 445 insertions(+), 38 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 93987ec..6359cf6 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -40,19 +40,26 @@ The School Management API Documentation, defining all functions and their purpos * [Photo](#update-teacher-photo)

* **Update Admin...** - * [Name](#update-admin-name) - **(Coming Soon)** - * [Password](#update-admin-password) - **(Coming Soon)** - * [Email](#update-admin-email) - **(Coming Soon)** - * [Photo](#update-admin-photo) - **(Coming Soon)** -* [Managing Contacts](#managing-contacts) - **(Not Documented)** - * [Create Contact](#create-contact) - **(Not Documented)** - * [Update Contact Name](#update-contact-name) - **(Not Documented)** - * [Update Contact Address](#update-contact-address) - **(Not Documented)** - * [Update Contact Home Phone](#update-contact-home-phone) - **(Not Documented)** - * [Update Contact Work Phone](#update-contact-work-phone) - **(Not Documented)** - * [Update Contact Email](#update-contact-email) - **(Not Documented)** - * [Update Contact Priority](#update-contact-priority) - **(Not Documented)** - * [Delete Contact](#delete-contact) - **(Not Documented)** + * [Name](#update-admin-name) + * [Password](#update-admin-password) + * [Email](#update-admin-email) +* [Managing Contacts](#managing-contacts) + * [Create Contact](#create-contact) + * [Update Contact Name](#update-contact-name) + * [Update Contact Address](#update-contact-address) + * [Update Contact Home Phone](#update-contact-home-phone) + * [Update Contact Work Phone](#update-contact-work-phone) + * [Update Contact Email](#update-contact-email) + * [Update Contact Priority](#update-contact-priority) + * [Delete Contact](#delete-contact) +* [Remove Users](#remove-users) + * [Remove Admin](#remove-admin) + * [Remove Teacher](#remove-teacher) + * [Remove Student](#remove-student) +* [Admin Commands](#admin-commands) + * [Update Locker Combination](#update-locker-combination) + * [Enable Student Account](#enable-student-account) + * [Enable Teacher Acccount](#enable-teacher-account)
@@ -839,83 +846,414 @@ There are several account that can be registered into the system. As you may gue

+ ### Update Admin Name - **Coming Soon...** + **Method:** `POST` + ``` + /api/v1/admin/updateName + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "firstname": "Seymour", + "lastname": "Skinner" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated admin" + } + ```

+ ### Update Admin Password - **Coming Soon...** + **Method:** `POST` + ``` + /api/v1/admin/updateEmail + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "firstname": "seymour_skinner@example.com" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated admin" + } + ```

+ ### Update Admin Email - **Coming Soon...** + **Method:** `POST` + ``` + /api/v1/admin/updatePassword + ``` -

- -+ ### Update Admin Photo - **Coming Soon...** + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "password": "myOldPassword", + "newpassword1": "myNewPassword", + "newpassword2": "myNewPassword" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated admin password" + } + ``` + * Emails admin ab alert of password change

## Managing Conacts -**To be Documented...** +In the case of an emergency for a specified student, a contact is required to be alerted during a situation. There can be multiple contacts with ranging priorities to ensure the correct person(s) are reached. -+ ### Creating Contact - **To be Documented...** ++ ### Create Contact + **Method:** `POST` + ``` + /api/v1/contact/createContact + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "sid": "123456", + "firstname": "Marge", + "middlename": "Jacqueline", // (optional) + "lastname": "Simpson", + "homephone": "123-456-7890", + "workphone": "098-765-4321" + "email": "therealmarge@example.com", + "priority": 1, // 1 is highest priority, 10 is least priority + "relation": "mother", + "province": "...", // (optional) + "city": "Springfield", // (optional) + "address": "742 Evergreen Terrace", // (optional) + "postal": " // (optional) + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully inserted contact to student" + } + ``` + * Emails admin ab alert of password change

+ ### Update Contact Name - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/contact/updateName + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "_id": "", + "firstname": "Marge", + "middlename": "" // (optional) + "lastname": "Simpson" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated contact" + } + ```

+ ### Update Contact Address - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/contact/updateAddress + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "_id": "", + "address": "742 Evergreen Terrace", + "city": "Springfield", + "province": "...", + "postal": "..." + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated contact" + } + ```

+ ### Update Contact Home Phone - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/contact/updateHomePhone + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "_id": "", + "newnumber": "123-456-7890" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated contact" + } + ```

+ ### Update Contact Work Phone - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/contact/updateWorkPhone + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "_id": "", + "newnumber": "123-456-7890" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated contact" + } + ```

+ ### Update Contact Email - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/contact/updateEmail + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "_id": "", + "email": "marge_simpson@example.com" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated contact" + } + ```

+ ### Update Contact Priority - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/contact/updatePriority + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "_id": "", + "priority": 1 // 1: highest priority, 10 lowest priority + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully updated contact" + } + ```

-+ ### Delete Conotact - **To be Documented...** ++ ### Delete Contact + **Method:** `POST` + ``` + /api/v1/contact/deleteContact + ``` + + **Required:** + * Logged into the admin + * JSON: + ```jsonc + { + "_id": "" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": "true", + "message": "successfully deleted contact" + } + ```

## Remove Users -**To be Documented...** +Students and staff are bound to leave the school at some time, so there is a way to remove them from the sytem database permanetly for any case. + ### Remove Admin - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/remove/admin + ``` + + **Required:** + * Logged into an admin + * JSON: + ```jsonc + { + "aid": "123456" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": true, + "message": "successfully deleted admin" + } + ```

+ ### Remove Teacher - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/remove/teacher + ``` + + **Required:** + * Logged into an admin + * JSON: + ```jsonc + { + "tid": "123456" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": true, + "message": "successfully deleted teacher" + } + ```

+ ### Remove Student - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/remove/student + ``` + + **Required:** + * Logged into an admin + * JSON: + ```jsonc + { + "sid": "123456" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": true, + "message": "successfully deleted student" + } + ```

@@ -923,18 +1261,87 @@ There are several account that can be registered into the system. As you may gue Administrators play a very important role in managing a school, they do much work behind the scenes to make sure that everything is correctly organized and working. + ### Update Locker Combination - **To be Documented...** + It is likely a school changes out their lockers, swapping the locks randomly. In the case a locker requires a combination change in the database, admins can update the locker database via this API endpoint. + + **Method:** `POST` + ``` + /api/v1/admin/updateLockerCombo + ``` + + **Required:** + * Logged into an admin + * JSON: + ```jsonc + { + "lockernumber": "B461", + "newlockercombo": "51-21-49" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": true, + "message": "successfully updated locker" + } + ```

+ ### Enable Student Account In the case a students acount has been disabled, an admin would require to enable the account. - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/admin/enableStudent + ``` + + **Required:** + * Logged into an admin + * JSON: + ```jsonc + { + "sid": "123456" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": true, + "message": "successfully enabled student account" + } + ```

+ ### Enable Teacher Account In the case a teachers acount has been disabled, an admin would require to enable the account. - **To be Documented...** + **Method:** `POST` + ``` + /api/v1/admin/enableTeacher + ``` + + **Required:** + * Logged into an admin + * JSON: + ```jsonc + { + "tid": "123456" + } + ``` + + **Returns:** + * Status 200: `OK` + * JSON: + ```jsonc + { + "success": true, + "message": "successfully enabled teacher account" + } + ```