From 5582868df77810445a91845529e8d2cafd4f74a1 Mon Sep 17 00:00:00 2001 From: Sean Fong Date: Tue, 21 Nov 2023 04:04:29 +0000 Subject: [PATCH 1/3] Added UPDATE and DELETE queries for user table --- server/queries/users.sql | 13 +++++++++++++ 1 file changed, 13 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..f40f4dc --- /dev/null +++ b/server/queries/users.sql @@ -0,0 +1,13 @@ +-- 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 = ?; \ No newline at end of file From d3113433328edbcd925a0ccd04cafcb9349f0c79 Mon Sep 17 00:00:00 2001 From: Philip Jian Date: Wed, 22 Nov 2023 23:06:27 -0800 Subject: [PATCH 2/3] added Get, Get pending accounts, and Post --- .vscode/settings.json | 4 ++++ server/queries/users.sql | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..89d1965 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" +} \ No newline at end of file diff --git a/server/queries/users.sql b/server/queries/users.sql index f40f4dc..0ba40ba 100644 --- a/server/queries/users.sql +++ b/server/queries/users.sql @@ -10,4 +10,20 @@ WHERE DELETE FROM users WHERE - id = ?; \ No newline at end of file + 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 From 8e08fbd34dfb97ed6917ad060657fdd4ef431af9 Mon Sep 17 00:00:00 2001 From: Philip Jian Date: Fri, 24 Nov 2023 20:22:13 -0800 Subject: [PATCH 3/3] implemented changes from pr feedback --- .vscode/settings.json | 4 ---- server/queries/users.sql | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 89d1965..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode" -} \ No newline at end of file diff --git a/server/queries/users.sql b/server/queries/users.sql index 0ba40ba..1700cdc 100644 --- a/server/queries/users.sql +++ b/server/queries/users.sql @@ -14,16 +14,16 @@ WHERE -- GET - Returns all data from the Users table SELECT * FROM - Users; + users; -- GET/pending-accounts - Returns all data from Users table who are currently pending approval SELECT * FROM - Users + users WHERE - approved = false; + approved = FALSE; -- POST - Adds a new row into Users table INSERT INTO - Users (id, email, "type", approved) + users (id, email, "type", approved) VALUES (?,?,?,?); \ No newline at end of file