@axium/notes 0.1.11 → 0.1.12
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 +5 -10
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -18,8 +18,7 @@ expectedTypes.notes = {
|
|
|
18
18
|
addRoute({
|
|
19
19
|
path: '/api/users/:id/notes',
|
|
20
20
|
params: { id: z.uuid() },
|
|
21
|
-
async GET(request,
|
|
22
|
-
const userId = params.id;
|
|
21
|
+
async GET(request, { id: userId }) {
|
|
23
22
|
await checkAuthForUser(request, userId);
|
|
24
23
|
return await database
|
|
25
24
|
.selectFrom('notes')
|
|
@@ -28,9 +27,8 @@ addRoute({
|
|
|
28
27
|
.execute()
|
|
29
28
|
.catch(withError('Could not get notes'));
|
|
30
29
|
},
|
|
31
|
-
async PUT(request,
|
|
30
|
+
async PUT(request, { id: userId }) {
|
|
32
31
|
const init = await parseBody(request, NoteInit);
|
|
33
|
-
const userId = params.id;
|
|
34
32
|
await checkAuthForUser(request, userId);
|
|
35
33
|
return await database
|
|
36
34
|
.insertInto('notes')
|
|
@@ -43,14 +41,12 @@ addRoute({
|
|
|
43
41
|
addRoute({
|
|
44
42
|
path: '/api/notes/:id',
|
|
45
43
|
params: { id: z.uuid() },
|
|
46
|
-
async GET(request,
|
|
47
|
-
const id = params.id;
|
|
44
|
+
async GET(request, { id }) {
|
|
48
45
|
const { item } = await checkAuthForItem(request, 'notes', id, Permission.Read);
|
|
49
46
|
return item;
|
|
50
47
|
},
|
|
51
|
-
async PATCH(request,
|
|
48
|
+
async PATCH(request, { id }) {
|
|
52
49
|
const init = await parseBody(request, NoteInit);
|
|
53
|
-
const id = params.id;
|
|
54
50
|
await checkAuthForItem(request, 'notes', id, Permission.Edit);
|
|
55
51
|
return await database
|
|
56
52
|
.updateTable('notes')
|
|
@@ -61,8 +57,7 @@ addRoute({
|
|
|
61
57
|
.executeTakeFirstOrThrow()
|
|
62
58
|
.catch(withError('Could not update note'));
|
|
63
59
|
},
|
|
64
|
-
async DELETE(request,
|
|
65
|
-
const id = params.id;
|
|
60
|
+
async DELETE(request, { id }) {
|
|
66
61
|
await checkAuthForItem(request, 'notes', id, Permission.Manage);
|
|
67
62
|
return await database
|
|
68
63
|
.deleteFrom('notes')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/notes",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Notes for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@axium/client": ">=0.6.0",
|
|
38
38
|
"@axium/core": ">=0.10.0",
|
|
39
|
-
"@axium/server": ">=0.
|
|
39
|
+
"@axium/server": ">=0.27.0",
|
|
40
40
|
"@sveltejs/kit": "^2.27.3",
|
|
41
41
|
"utilium": "^2.4.0"
|
|
42
42
|
},
|