aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-07-13 11:20:23 -0700
committerAdam Soltys <[email protected]>2021-07-13 11:21:33 -0700
commit6388e2b98843ad8ee5db855632334174efdaeedc (patch)
tree701647d738d0b13cd41bdf9b75180e4923422d76 /db
parentfc3e802856d1209ee9e47e3f0a2a073c475bd7ae (diff)
downloadcoinos-server-6388e2b98843ad8ee5db855632334174efdaeedc.tar.gz
coinos-server-6388e2b98843ad8ee5db855632334174efdaeedc.zip
user admin field and auth middleware
Diffstat (limited to 'db')
-rw-r--r--db/migrations/20210713174217_add_admin_to_users.js11
-rw-r--r--db/models/users.js9
2 files changed, 20 insertions, 0 deletions
diff --git a/db/migrations/20210713174217_add_admin_to_users.js b/db/migrations/20210713174217_add_admin_to_users.js
new file mode 100644
index 00000000..c8e009b1
--- /dev/null
+++ b/db/migrations/20210713174217_add_admin_to_users.js
@@ -0,0 +1,11 @@
+exports.up = async function(knex) {
+ return knex.schema.table("users", function(table) {
+ table.boolean("admin");
+ });
+};
+
+exports.down = async function(knex) {
+ return knex.schema.table("users", function(table) {
+ table.dropColumn("admin");
+ });
+};
diff --git a/db/models/users.js b/db/models/users.js
index e2275229..2abf1c79 100644
--- a/db/models/users.js
+++ b/db/models/users.js
@@ -10,6 +10,15 @@ const attributes = {
comment: null,
field: "id"
},
+ admin: {
+ type: DataTypes.BOOLEAN,
+ allowNull: true,
+ defaultValue: false,
+ primaryKey: false,
+ autoIncrement: false,
+ comment: null,
+ field: "admin"
+ },
locked: {
type: DataTypes.BOOLEAN,
allowNull: true,