Add Card add remove endpoints
This commit is contained in:
@@ -62,8 +62,29 @@ def set_movie_watched(movie_id: str):
|
||||
|
||||
|
||||
def add_card(card: Card):
|
||||
pass
|
||||
sql = """
|
||||
INSERT INTO cards (title, description, point_value)
|
||||
VALUES (?, ?, ?)
|
||||
"""
|
||||
values = (
|
||||
card.title,
|
||||
card.description,
|
||||
card.point_value,
|
||||
)
|
||||
try:
|
||||
db_run(sql, values)
|
||||
return {"message": "Card added successfully"}
|
||||
except Exception as e:
|
||||
return {"message": f"Error adding card: {e}"}
|
||||
|
||||
|
||||
def remove_card(card_id: str):
|
||||
pass
|
||||
sql = f"""
|
||||
DELETE FROM cards WHERE id = '{card_id}'
|
||||
"""
|
||||
|
||||
try:
|
||||
db_run(sql)
|
||||
return {"message": "Card removed successfully"}
|
||||
except Exception as e:
|
||||
return {"message": f"Error removing card: {e}"}
|
||||
|
||||
Reference in New Issue
Block a user