فهرست منبع

history input no auth

ming 3 سال پیش
والد
کامیت
62d837ae58
1فایلهای تغییر یافته به همراه11 افزوده شده و 0 حذف شده
  1. 11 0
      api/main.py

+ 11 - 0
api/main.py

@@ -683,6 +683,17 @@ async def history_input(token: str = Depends(oauth2_scheme)):
         logs.append({'id':row['id'],'name':row['name'],'avatar':row['avatar'],'text_content':row['text_content'].split(','),'link':row['link'],'image_urls':row['image_urls'].split(',')})
     return logs
 
+@app.post("/history_input_noAuth")
+async def history_input_noAuth():
+    db_check()
+    user_id = get_user_id(token)
+    user_obj = first(db.query('SELECT * FROM users where id ="'+str(user_id)+'"'))
+    statement = 'SELECT * FROM history_input WHERE user_id="'+str(user_id)+'" ORDER BY timestamp DESC LIMIT 50'
+
+    logs = []
+    for row in db.query(statement):
+        logs.append({'id':row['id'],'name':row['name'],'avatar':row['avatar'],'text_content':row['text_content'].split(','),'link':row['link'],'image_urls':row['image_urls'].split(',')})
+    return logs
 
 
 @AuthJWT.load_config