aboutsummaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/init.py1
-rw-r--r--src/db/tasks.py16
2 files changed, 12 insertions, 5 deletions
diff --git a/src/db/init.py b/src/db/init.py
index c1835eb..cb8a4a8 100644
--- a/src/db/init.py
+++ b/src/db/init.py
@@ -12,6 +12,7 @@ def init(path):
" created_at INTEGER NOT NULL,"
" modified_at INTEGER NOT NULL,"
" name TEXT NOT NULL,"
+ " description TEXT,"
" duration INTEGER,"
" tag TEXT"
" )")
diff --git a/src/db/tasks.py b/src/db/tasks.py
index d03877b..e22a315 100644
--- a/src/db/tasks.py
+++ b/src/db/tasks.py
@@ -10,6 +10,7 @@ def get(cursor: Cursor) -> Task:
" created_at,"
" modified_at,"
" name,"
+ " description,"
" duration,"
" tag"
" FROM tasks")
@@ -22,8 +23,9 @@ def get(cursor: Cursor) -> Task:
created_at = task[1],
modified_at = task[2],
name = task[3],
- duration = task[4],
- tag = task[5]
+ description = task[4],
+ duration = task[5],
+ tag = task[6]
))
return res
@@ -35,16 +37,18 @@ def insert(cursor: Cursor, form: ValidTaskForm):
" created_at,"
" modified_at,"
" name,"
+ " description,"
" duration,"
" tag"
- " ) VALUES (?, ?, ?, ?, ?)",
- (now, now, form.name, form.duration, form.tag))
+ " ) VALUES (?, ?, ?, ?, ?, ?)",
+ (now, now, form.name, form.description, form.duration, form.tag))
return Task(
id = cursor.lastrowid,
created_at = now,
modified_at = now,
name = form.name,
+ description = form.description,
duration = form.duration,
tag = form.tag
)
@@ -57,16 +61,18 @@ def update(cursor: Cursor, task: Task, form: ValidTaskForm):
" SET"
" modified_at = ?,"
" name = ?,"
+ " description = ?,"
" duration = ?,"
" tag = ?"
" WHERE id = ?",
- (now, form.name, form.duration, form.tag, task.id))
+ (now, form.name, form.description, form.duration, form.tag, task.id))
return Task(
id = task.id,
created_at = task.created_at,
modified_at = now,
name = form.name,
+ description = form.description,
duration = form.duration,
tag = form.tag
)