added db connection to auth server and added usermanagement code
This commit is contained in:
20
Auth Server/database.py
Normal file
20
Auth Server/database.py
Normal 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()
|
Reference in New Issue
Block a user