added db connection to auth server and added usermanagement code

This commit is contained in:
2023-12-04 14:26:12 +01:00
parent 48acef0436
commit da68c8ee8d
5 changed files with 124 additions and 6 deletions

20
Auth Server/database.py Normal file
View File

@ -0,0 +1,20 @@
import psycopg2
class Database:
__conn:psycopg2.connect
__cursor:psycopg2.cursor
def __init__(self, database:str, host:str, user:str, password:str, port:str):
self.__conn = psycopg2.connect(database=database, host=host, user=user, password=password, port=port)
self.__cursor = self.__conn.cursor()
def getConnection(self) -> psycopg2.connect:
return self.__conn
def fetchall(self, query:str):
self.__cursor.execute(query)
return self.__cursor.fetchall()
def fetchall(self, query:str):
self.__cursor.execute(query)
return self.__cursor.fetchone()