kin: KIN-089 При попытке добавить креды прод сервера для проекта corelock вылетает 500 Internal Server Error
This commit is contained in:
parent
e80e50ba0c
commit
4a65d90218
13 changed files with 1215 additions and 4 deletions
|
|
@ -869,6 +869,55 @@ def add_chat_message(
|
|||
return _row_to_dict(row)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Task Attachments (KIN-090)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def create_attachment(
|
||||
conn: sqlite3.Connection,
|
||||
task_id: str,
|
||||
filename: str,
|
||||
path: str,
|
||||
mime_type: str,
|
||||
size: int,
|
||||
) -> dict:
|
||||
"""Create a task attachment record. path must be absolute."""
|
||||
cur = conn.execute(
|
||||
"""INSERT INTO task_attachments (task_id, filename, path, mime_type, size)
|
||||
VALUES (?, ?, ?, ?, ?)""",
|
||||
(task_id, filename, path, mime_type, size),
|
||||
)
|
||||
conn.commit()
|
||||
row = conn.execute(
|
||||
"SELECT * FROM task_attachments WHERE id = ?", (cur.lastrowid,)
|
||||
).fetchone()
|
||||
return _row_to_dict(row)
|
||||
|
||||
|
||||
def list_attachments(conn: sqlite3.Connection, task_id: str) -> list[dict]:
|
||||
"""List all attachments for a task ordered by creation time."""
|
||||
rows = conn.execute(
|
||||
"SELECT * FROM task_attachments WHERE task_id = ? ORDER BY created_at",
|
||||
(task_id,),
|
||||
).fetchall()
|
||||
return _rows_to_list(rows)
|
||||
|
||||
|
||||
def get_attachment(conn: sqlite3.Connection, attachment_id: int) -> dict | None:
|
||||
"""Get a single attachment by id."""
|
||||
row = conn.execute(
|
||||
"SELECT * FROM task_attachments WHERE id = ?", (attachment_id,)
|
||||
).fetchone()
|
||||
return _row_to_dict(row)
|
||||
|
||||
|
||||
def delete_attachment(conn: sqlite3.Connection, attachment_id: int) -> bool:
|
||||
"""Delete attachment record. Returns True if deleted, False if not found."""
|
||||
cur = conn.execute("DELETE FROM task_attachments WHERE id = ?", (attachment_id,))
|
||||
conn.commit()
|
||||
return cur.rowcount > 0
|
||||
|
||||
|
||||
def get_chat_messages(
|
||||
conn: sqlite3.Connection,
|
||||
project_id: str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue