ADD /report
parent
ec3e76181c
commit
60573fc9ec
3
main.py
3
main.py
|
|
@ -343,6 +343,7 @@ async def reporting(get: CL.CL_REPORTING,api_key: APIKey = Depends(auth.get_api_
|
||||||
user_check = database(f"SELECT username from users where username = '{get.username}'","Kunden","")
|
user_check = database(f"SELECT username from users where username = '{get.username}'","Kunden","")
|
||||||
if not user_check:
|
if not user_check:
|
||||||
print("User not exist")
|
print("User not exist")
|
||||||
|
# TBD add Message to Admin by Gotify or E-Mail
|
||||||
else:
|
else:
|
||||||
entry = database(f"SELECT s.customer_ID,s.service_ID from `server` s where s.privat_ipaddress LIKE '%{get.ipaddress}%'","Kunden","")
|
entry = database(f"SELECT s.customer_ID,s.service_ID from `server` s where s.privat_ipaddress LIKE '%{get.ipaddress}%'","Kunden","")
|
||||||
customer_ID = entry[0][0]
|
customer_ID = entry[0][0]
|
||||||
|
|
@ -350,7 +351,7 @@ async def reporting(get: CL.CL_REPORTING,api_key: APIKey = Depends(auth.get_api_
|
||||||
reportingdate = datetime.now()
|
reportingdate = datetime.now()
|
||||||
reportingdate = reportingdate.strftime("%Y-%m-%d %H:%M:%S")
|
reportingdate = reportingdate.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
print(reportingdate)
|
print(reportingdate)
|
||||||
#database(f"INSERT INTO `Kunden.services.reporting` (username,service_ID,customer_ID,reportingdate,lastaccess) VALUES ('{get.username}','{service_ID}','{customer_ID}',{reportingdate}',{get.lastaccess}'","","")
|
database(f"INSERT INTO `Kunden.services.reporting` (username,service_ID,customer_ID,reportingdate,lastaccess) VALUES ('{get.username}','{service_ID}','{customer_ID}',{reportingdate}',{get.lastaccess}'","","")
|
||||||
print(f"{service_ID} - {customer_ID}")
|
print(f"{service_ID} - {customer_ID}")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue