From 5ef1772c8c6c746ea70620ee9009f19d7d272b06 Mon Sep 17 00:00:00 2001 From: xangelo Date: Sat, 3 Jun 2023 05:24:56 -0400 Subject: [PATCH] start of account system This adds the auth table and two new columns on the players table to track account_type (session/auth) and the creation_date. --- migrations/20230602191259_auth.ts | 25 +++++++++++++++++++++++++ public/assets/css/game.css | 8 ++++++++ public/index.html | 2 ++ src/client/index.ts | 1 + src/shared/auth.ts | 5 +++++ src/shared/player.ts | 2 ++ 6 files changed, 43 insertions(+) create mode 100644 migrations/20230602191259_auth.ts create mode 100644 src/shared/auth.ts diff --git a/migrations/20230602191259_auth.ts b/migrations/20230602191259_auth.ts new file mode 100644 index 0000000..a180de1 --- /dev/null +++ b/migrations/20230602191259_auth.ts @@ -0,0 +1,25 @@ +import { Knex } from "knex"; + + +export async function up(knex: Knex): Promise { + return knex.schema.createTable('auth', function(table) { + table.uuid('id').primary(); + table.string('username').notNullable(); + table.string('password').notNullable(); + table.timestamp('create_date').defaultTo(knex.raw('NOW()')) + }) + .alterTable('players', function(table) { + table.string('account_type').notNullable().defaultTo('session'); + table.timestamp('create_date').defaultTo(knex.raw('NOW()')) + }) +} + + +export async function down(knex: Knex): Promise { + return knex.schema.dropTable('auth') + .alterTable('players', function(table) { + table.dropColumn('account_type') + table.dropColumn('create_date') + }); +} + diff --git a/public/assets/css/game.css b/public/assets/css/game.css index cd00b1a..07de4aa 100644 --- a/public/assets/css/game.css +++ b/public/assets/css/game.css @@ -29,6 +29,14 @@ section { background-color: #fff; } +#announcements { + padding: 1rem; + line-height: 1.2rem; + border: solid 1px #000; + background-color: #fff; + margin-bottom: 1rem; +} + .alert { padding: 0.3rem; margin-bottom: 0.3rem; diff --git a/public/index.html b/public/index.html index 21e59b3..a5eec89 100644 --- a/public/index.html +++ b/public/index.html @@ -29,6 +29,8 @@
  • Explore
  • + +