@axium/notes 0.3.1 → 0.3.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.
- package/dist/server.js +4 -4
- package/lib/Note.svelte +1 -1
- package/package.json +4 -4
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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';
|
|
@@ -31,12 +31,12 @@ addRoute({
|
|
|
31
31
|
path: '/api/notes/:id',
|
|
32
32
|
params: { id: z.uuid() },
|
|
33
33
|
async GET(request, { id }) {
|
|
34
|
-
const { item } = await
|
|
34
|
+
const { item } = await authRequestForItem(request, 'notes', id, { read: true });
|
|
35
35
|
return item;
|
|
36
36
|
},
|
|
37
37
|
async PATCH(request, { id }) {
|
|
38
38
|
const init = await parseBody(request, NoteInit);
|
|
39
|
-
await
|
|
39
|
+
await authRequestForItem(request, 'notes', id, { edit: true });
|
|
40
40
|
return await database
|
|
41
41
|
.updateTable('notes')
|
|
42
42
|
.set(init)
|
|
@@ -47,7 +47,7 @@ addRoute({
|
|
|
47
47
|
.catch(withError('Could not update note'));
|
|
48
48
|
},
|
|
49
49
|
async DELETE(request, { id }) {
|
|
50
|
-
await
|
|
50
|
+
await authRequestForItem(request, 'notes', id, { manage: true });
|
|
51
51
|
return await database
|
|
52
52
|
.deleteFrom('notes')
|
|
53
53
|
.where('id', '=', id)
|
package/lib/Note.svelte
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/notes",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Notes for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"build": "tsc"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@axium/client": ">=0.
|
|
39
|
-
"@axium/core": ">=0.
|
|
40
|
-
"@axium/server": ">=0.
|
|
38
|
+
"@axium/client": ">=0.13.0",
|
|
39
|
+
"@axium/core": ">=0.19.0",
|
|
40
|
+
"@axium/server": ">=0.35.0",
|
|
41
41
|
"@sveltejs/kit": "^2.27.3",
|
|
42
42
|
"utilium": "^2.4.0"
|
|
43
43
|
},
|