Compare commits

..

No commits in common. "52ba6988fd33cda5700f7f3563364f25b6612b92" and "b925683aa42180c33f0b69171477616f77722207" have entirely different histories.

2 changed files with 5 additions and 25 deletions

2
app.py
View File

@ -142,4 +142,4 @@ def logout():
# Run the application
if __name__ == '__main__':
app.run(port=5000, debug=True)
app.run(port=5000, debug=True)

View File

@ -41,17 +41,6 @@ def get_user_by_email(email: str):
return user
def delete_user(id: int):
query = f"DELETE FROM habits WHERE user_id = {id};"
query2 = f"DELETE FROM users WHERE id = {id};"
conn = con3()
cursor = conn.cursor()
cursor.execute(query)
cursor.execute(query2)
conn.commit()
conn.close()
def create_habit(name: str, user_id: int, times: int, unit: int, slot: int, note: str | None=None):
now = datetime.now().isoformat()
query = (f"INSERT INTO habits (user_id, name, note, times, unit, list_index, created_at, updated_at) VALUES ('{user_id}', "
@ -69,9 +58,9 @@ def get_habit(id: int):
conn = con3()
cursor = conn.cursor()
cursor.execute(query)
habit = cursor.fetchone()
habits = cursor.fetchone()
conn.close()
return habit
return habits
def get_habits(user_id: int):
@ -79,15 +68,6 @@ def get_habits(user_id: int):
conn = con3()
cursor = conn.cursor()
cursor.execute(query)
habits = cursor.fetchall()
habits = cursor.fetchone()
conn.close()
return habits
def delete_habit(id: int):
query = f"DELETE FROM habits WHERE id = {id};"
conn = con3()
cursor = conn.cursor()
cursor.execute(query)
conn.commit()
conn.close()
return habits