@axium/tasks 0.4.2 → 0.4.3

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.
Files changed (2) hide show
  1. package/dist/server.js +8 -8
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import { checkAuthForItem, checkAuthForUser } from '@axium/server/auth';
1
+ import { authRequestForItem, checkAuthForUser } from '@axium/server/auth';
2
2
  import { database } from '@axium/server/database';
3
3
  import { parseBody, withError } from '@axium/server/requests';
4
4
  import { addRoute } from '@axium/server/routes';
@@ -37,7 +37,7 @@ addRoute({
37
37
  path: '/api/task_lists/:id',
38
38
  params: { id: z.uuid() },
39
39
  async GET(request, { id }) {
40
- const { item } = await checkAuthForItem(request, 'task_lists', id, { read: true });
40
+ const { item } = await authRequestForItem(request, 'task_lists', id, { read: true });
41
41
  const tasks = await database
42
42
  .selectFrom('tasks')
43
43
  .selectAll()
@@ -48,7 +48,7 @@ addRoute({
48
48
  },
49
49
  async PUT(request, { id: listId }) {
50
50
  const init = await parseBody(request, TaskInit.omit({ listId: true }));
51
- await checkAuthForItem(request, 'task_lists', listId, { edit: true });
51
+ await authRequestForItem(request, 'task_lists', listId, { edit: true });
52
52
  return await database
53
53
  .insertInto('tasks')
54
54
  .values({ summary: '', ...init, listId })
@@ -57,7 +57,7 @@ addRoute({
57
57
  .catch(withError('Could not update task list'));
58
58
  },
59
59
  async PATCH(request, { id }) {
60
- await checkAuthForItem(request, 'task_lists', id, { edit: true });
60
+ await authRequestForItem(request, 'task_lists', id, { edit: true });
61
61
  const init = await parseBody(request, TaskListInit);
62
62
  return await database
63
63
  .updateTable('task_lists')
@@ -69,7 +69,7 @@ addRoute({
69
69
  },
70
70
  async POST(request, { id }) {
71
71
  const body = await parseBody(request, TaskListUpdate);
72
- await checkAuthForItem(request, 'task_lists', id, { edit: true });
72
+ await authRequestForItem(request, 'task_lists', id, { edit: true });
73
73
  if (typeof body.all_completed == 'boolean') {
74
74
  await database
75
75
  .updateTable('tasks')
@@ -83,7 +83,7 @@ addRoute({
83
83
  return {};
84
84
  },
85
85
  async DELETE(request, { id }) {
86
- await checkAuthForItem(request, 'task_lists', id, { manage: true });
86
+ await authRequestForItem(request, 'task_lists', id, { manage: true });
87
87
  return await database
88
88
  .deleteFrom('task_lists')
89
89
  .where('id', '=', id)
@@ -103,7 +103,7 @@ addRoute({
103
103
  .where('id', '=', id)
104
104
  .executeTakeFirstOrThrow()
105
105
  .catch(withError('Could not get task'));
106
- await checkAuthForItem(request, 'task_lists', task.listId, { edit: true });
106
+ await authRequestForItem(request, 'task_lists', task.listId, { edit: true });
107
107
  return await database
108
108
  .updateTable('tasks')
109
109
  .set(init)
@@ -119,7 +119,7 @@ addRoute({
119
119
  .where('id', '=', id)
120
120
  .executeTakeFirstOrThrow()
121
121
  .catch(withError('Could not fetch task'));
122
- await checkAuthForItem(request, 'task_lists', task.listId, { manage: true });
122
+ await authRequestForItem(request, 'task_lists', task.listId, { manage: true });
123
123
  return await database
124
124
  .deleteFrom('tasks')
125
125
  .where('id', '=', id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/tasks",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Tasks for Axium",
6
6
  "funding": {
@@ -37,7 +37,7 @@
37
37
  "peerDependencies": {
38
38
  "@axium/client": ">=0.13.0",
39
39
  "@axium/core": ">=0.19.0",
40
- "@axium/server": ">=0.34.0",
40
+ "@axium/server": ">=0.35.0",
41
41
  "@sveltejs/kit": "^2.27.3",
42
42
  "utilium": "^2.3.8"
43
43
  },