From c0425540b8f8474ca560adf249997203ef8fa0dc Mon Sep 17 00:00:00 2001 From: ctc-devops <90984711+ctc-devops@users.noreply.github.com> Date: Sat, 25 Nov 2023 12:42:39 -0800 Subject: [PATCH] Make CRUD SQL queries for Users Table (#25) * Added UPDATE and DELETE queries for user table * added Get, Get pending accounts, and Post * implemented changes from pr feedback --------- Co-authored-by: Sean Fong Co-authored-by: Philip Jian --- server/queries/users.sql | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 server/queries/users.sql diff --git a/server/queries/users.sql b/server/queries/users.sql new file mode 100644 index 0000000..1700cdc --- /dev/null +++ b/server/queries/users.sql @@ -0,0 +1,29 @@ +-- PUT/:uid - Updates an existing user as approved +UPDATE + users +SET + approved = TRUE +WHERE + id = ?; + +-- DELETE/:uid - Deletes an existing user given their id +DELETE FROM + users +WHERE + id = ?; + +-- GET - Returns all data from the Users table +SELECT * FROM + users; + +-- GET/pending-accounts - Returns all data from Users table who are currently pending approval +SELECT * FROM + users +WHERE + approved = FALSE; + +-- POST - Adds a new row into Users table +INSERT INTO + users (id, email, "type", approved) +VALUES + (?,?,?,?); \ No newline at end of file