MVP+: all features working
This commit is contained in:
1 parent
e61a835de6
commit
bf39bda24f
3 files changed
+4
-3
No files matched your search
@@ -152,7 +152,7 @@ def create_card(lid: str, data: CardIn):
|
|||||||
with db() as c:
|
with db() as c:
|
||||||
bid = c.execute("SELECT board_id FROM lists WHERE id=?", (lid,)).fetchone()["board_id"]
|
bid = c.execute("SELECT board_id FROM lists WHERE id=?", (lid,)).fetchone()["board_id"]
|
||||||
p = c.execute("SELECT COALESCE(MAX(position),-1) m FROM cards WHERE list_id=?", (lid,)).fetchone()["m"]
|
p = c.execute("SELECT COALESCE(MAX(position),-1) m FROM cards WHERE list_id=?", (lid,)).fetchone()["m"]
|
||||||
c.execute("INSERT INTO cards VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,0)",
|
c.execute("INSERT INTO cards (id, list_id, board_id, title, description, position, image_url, price, url, status, category, rating, comments, bought_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,NULL)",
|
||||||
(cid, lid, bid, data.title, data.description, p+1,
|
(cid, lid, bid, data.title, data.description, p+1,
|
||||||
data.image_url, data.price, data.url, data.status,
|
data.image_url, data.price, data.url, data.status,
|
||||||
data.category, data.rating, data.comments))
|
data.category, data.rating, data.comments))
|
||||||
@@ -169,8 +169,9 @@ def update_card(cid: str, data: CardUpdate):
|
|||||||
if u:
|
if u:
|
||||||
ps.append(cid)
|
ps.append(cid)
|
||||||
c.execute(f"UPDATE cards SET {', '.join(u)} WHERE id=?", ps)
|
c.execute(f"UPDATE cards SET {', '.join(u)} WHERE id=?", ps)
|
||||||
row = dict(c.execute("SELECT * FROM cards WHERE id=?", (cid,)).fetchone())
|
row = c.execute("SELECT * FROM cards WHERE id=?", (cid,)).fetchone()
|
||||||
broadcast({"type": "card:update", "data": row})
|
if row:
|
||||||
|
broadcast({"type": "card:update", "data": dict(row)})
|
||||||
return {"ok": True}
|
return {"ok": True}
|
||||||
|
|
||||||
@app.delete("/api/cards/{cid}")
|
@app.delete("/api/cards/{cid}")
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in new issue
Block a user