Added new pages, and added user approval and login to external services (Still need to add service tokens)
This commit is contained in:
25
initdb.py
25
initdb.py
@@ -49,6 +49,27 @@ def createTables(dbuser, dbpass, dbhost, dbname):
|
||||
""")
|
||||
print("Table 'groups' created or already exists")
|
||||
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS services (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
key uuid UNIQUE DEFAULT gen_random_uuid(),
|
||||
name VARCHAR(255) UNIQUE NOT NULL,
|
||||
permissions JSON,
|
||||
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
""")
|
||||
print("Table 'services' created or already exists")
|
||||
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS requestTokens (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
owner_id uuid REFERENCES users(id)
|
||||
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
expiration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP + INTERVAL '1 hour'
|
||||
)
|
||||
""")
|
||||
print("Table 'requestTokens' created or already exists")
|
||||
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
@@ -66,7 +87,7 @@ def createTables(dbuser, dbpass, dbhost, dbname):
|
||||
CREATE TABLE IF NOT EXISTS userData (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id uuid REFERENCES users(id),
|
||||
service_id VARCHAR(255) NOT NULL,
|
||||
service_id uuid NOT NULL,
|
||||
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
property VARCHAR(255) NOT NULL,
|
||||
value VARCHAR(255) NOT NULL
|
||||
@@ -78,7 +99,7 @@ def createTables(dbuser, dbpass, dbhost, dbname):
|
||||
CREATE TABLE IF NOT EXISTS groupData (
|
||||
id SERIAL PRIMARY KEY,
|
||||
group_id uuid REFERENCES groups(id),
|
||||
service_id VARCHAR(255) NOT NULL,
|
||||
service_id uuid NOT NULL,
|
||||
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
property VARCHAR(255) NOT NULL,
|
||||
value VARCHAR(255) NOT NULL
|
||||
|
||||
Reference in New Issue
Block a user