ADD /report

master
root 2024-07-29 15:44:44 +02:00
parent 66268900f6
commit ec3e76181c
1 changed files with 9 additions and 9 deletions

18
main.py
View File

@ -343,15 +343,15 @@ 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")
next 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]
service_ID = entry[0][1] service_ID = entry[0][1]
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}")
## Startet den API-Server ## Startet den API-Server