aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/db
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/db')
-rw-r--r--vnext/server/db/index.js5
-rw-r--r--vnext/server/db/users.js14
2 files changed, 19 insertions, 0 deletions
diff --git a/vnext/server/db/index.js b/vnext/server/db/index.js
new file mode 100644
index 00000000..7a029627
--- /dev/null
+++ b/vnext/server/db/index.js
@@ -0,0 +1,5 @@
+import postgres from 'postgres'
+
+const sql = postgres({ database: 'juick', host: process.env.PG_HOST })
+
+export default sql
diff --git a/vnext/server/db/users.js b/vnext/server/db/users.js
new file mode 100644
index 00000000..2201b1ef
--- /dev/null
+++ b/vnext/server/db/users.js
@@ -0,0 +1,14 @@
+import sql from './index'
+
+/**
+ * Count users
+ */
+export async function get_count() {
+ const count = await sql`
+ select
+ count(*)
+ from users
+ where banned=0
+ `
+ return count
+}