@zinn-dev/core 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.ts CHANGED
@@ -49,6 +49,8 @@ export const project = {
49
49
  })!;
50
50
  lastColumnOrder = columnOrder;
51
51
  }
52
+
53
+ return project;
52
54
  },
53
55
  getAll: dbProject.getAll,
54
56
  delete: (key: string) => {
@@ -59,6 +61,7 @@ export const project = {
59
61
  }
60
62
 
61
63
  dbProject.deleteByKey(key);
64
+ return project;
62
65
  },
63
66
  standardizeKey: standardizeProjectKey,
64
67
  };
@@ -94,12 +97,13 @@ export const column = {
94
97
  }
95
98
 
96
99
  const lastColOrder = allProjectColumns[allProjectColumns.length - 1]?.column_order ?? null;
97
- const res = dbColumn.create({
100
+
101
+ return dbColumn.create({
98
102
  id: randomUUIDv7(),
99
103
  name: column.name,
100
104
  column_order: generateKeyBetween(lastColOrder, null),
101
105
  project_id: project.id,
102
- });
106
+ })!;
103
107
  },
104
108
  };
105
109
 
@@ -205,7 +209,7 @@ export const task = {
205
209
  title: props.title,
206
210
  description: props.description,
207
211
  updated_at: Date.now(),
208
- });
212
+ })!;
209
213
  },
210
214
  /**
211
215
  * Moves a task to another column in its project.
@@ -245,7 +249,7 @@ export const task = {
245
249
  column_id: columnMatch.id,
246
250
  task_order: order,
247
251
  updated_at: Date.now(),
248
- });
252
+ })!;
249
253
  },
250
254
  order: (props: TaskOrderProps) => {
251
255
  const { taskKey, direction } = props;
@@ -317,11 +321,13 @@ export const task = {
317
321
  futureNextTask?.task_order ?? null,
318
322
  ),
319
323
  updated_at: Date.now(),
320
- });
324
+ })!;
321
325
  },
322
326
  delete: (taskKey: string) => {
323
327
  const taskMatch = getTaskByKey(taskKey);
324
- return dbTask.deleteById(taskMatch.id);
328
+ dbTask.deleteById(taskMatch.id);
329
+
330
+ return taskMatch;
325
331
  },
326
332
  archive: (taskKey: string) => {
327
333
  const taskMatch = getTaskByKey(taskKey);
@@ -331,7 +337,8 @@ export const task = {
331
337
  }
332
338
 
333
339
  const now = Date.now();
334
- return dbTask.update({ id: taskMatch.id, updated_at: now, archived_at: now });
340
+
341
+ return dbTask.update({ id: taskMatch.id, updated_at: now, archived_at: now })!;
335
342
  },
336
343
  unarchive: (taskKey: string) => {
337
344
  const taskMatch = getTaskByKey(taskKey);
@@ -348,6 +355,6 @@ export const task = {
348
355
  task_order: order,
349
356
  updated_at: Date.now(),
350
357
  archived_at: null,
351
- });
358
+ })!;
352
359
  },
353
360
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zinn-dev/core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Shared logic for zinn, a kanban workflow in the terminal.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/db/task.ts CHANGED
@@ -92,7 +92,7 @@ export function create(task: Omit<Task, "archived_at">) {
92
92
  ${DB_TABLE.task} (id, project_id, column_id, number, title, description, task_order, created_at, updated_at)
93
93
  VALUES ($id, $project_id, $column_id, $number, $title, $description, $task_order, $created_at, $updated_at);`);
94
94
 
95
- return q.run({
95
+ q.run({
96
96
  $id: task.id,
97
97
  $project_id: task.project_id,
98
98
  $column_id: task.column_id,
@@ -103,6 +103,8 @@ export function create(task: Omit<Task, "archived_at">) {
103
103
  $created_at: task.created_at,
104
104
  $updated_at: task.updated_at,
105
105
  });
106
+
107
+ return { ...task, archived_at: null };
106
108
  }
107
109
 
108
110
  const TASK_UPDATE_COLUMNS = [