@porulle/plugin-wishlist 0.11.0 → 0.14.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/dist/routes/wishlist.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { router } from "@porulle/core";
|
|
1
|
+
import { requireUserId, router } from "@porulle/core";
|
|
2
2
|
import { z } from "@hono/zod-openapi";
|
|
3
3
|
export function buildWishlistRoutes(service, ctx) {
|
|
4
4
|
const r = router("Wishlist", "/wishlist", ctx);
|
|
5
5
|
r.get("/").summary("List my wishlist").auth()
|
|
6
6
|
.handler(async ({ actor, orgId }) => {
|
|
7
|
-
const result = await service.list(orgId, actor
|
|
7
|
+
const result = await service.list(orgId, requireUserId(actor));
|
|
8
8
|
if (!result.ok)
|
|
9
9
|
throw new Error(result.error);
|
|
10
10
|
return result.value;
|
|
@@ -13,14 +13,14 @@ export function buildWishlistRoutes(service, ctx) {
|
|
|
13
13
|
.input(z.object({ entityId: z.string().uuid(), note: z.string().max(500).optional() }))
|
|
14
14
|
.handler(async ({ input, actor, orgId }) => {
|
|
15
15
|
const body = input;
|
|
16
|
-
const result = await service.add(orgId, actor
|
|
16
|
+
const result = await service.add(orgId, requireUserId(actor), body);
|
|
17
17
|
if (!result.ok)
|
|
18
18
|
throw new Error(result.error);
|
|
19
19
|
return result.value;
|
|
20
20
|
});
|
|
21
21
|
r.delete("/{id}").summary("Remove from wishlist").auth()
|
|
22
22
|
.handler(async ({ params, actor, orgId }) => {
|
|
23
|
-
const result = await service.remove(orgId, actor
|
|
23
|
+
const result = await service.remove(orgId, requireUserId(actor), params.id);
|
|
24
24
|
if (!result.ok)
|
|
25
25
|
throw new Error(result.error);
|
|
26
26
|
return result.value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/plugin-wishlist",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@hono/zod-openapi": "^1.2.2",
|
|
21
21
|
"hono": "^4.12.5",
|
|
22
|
-
"@porulle/core": "0.
|
|
22
|
+
"@porulle/core": "0.14.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^24.5.2",
|
|
26
26
|
"typescript": "5.9.2",
|
|
27
27
|
"vitest": "^3.2.4",
|
|
28
|
-
"@porulle/
|
|
29
|
-
"@porulle/
|
|
28
|
+
"@porulle/typescript-config": "0.1.0",
|
|
29
|
+
"@porulle/eslint-config": "0.1.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
package/src/routes/wishlist.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { router } from "@porulle/core";
|
|
1
|
+
import { requireUserId, router } from "@porulle/core";
|
|
2
2
|
import { z } from "@hono/zod-openapi";
|
|
3
3
|
import type { WishlistService } from "../services/wishlist-service.js";
|
|
4
4
|
import type { PluginRouteRegistration } from "@porulle/core";
|
|
@@ -11,7 +11,7 @@ export function buildWishlistRoutes(
|
|
|
11
11
|
|
|
12
12
|
r.get("/").summary("List my wishlist").auth()
|
|
13
13
|
.handler(async ({ actor, orgId }) => {
|
|
14
|
-
const result = await service.list(orgId, actor
|
|
14
|
+
const result = await service.list(orgId, requireUserId(actor));
|
|
15
15
|
if (!result.ok) throw new Error(result.error);
|
|
16
16
|
return result.value;
|
|
17
17
|
});
|
|
@@ -20,14 +20,14 @@ export function buildWishlistRoutes(
|
|
|
20
20
|
.input(z.object({ entityId: z.string().uuid(), note: z.string().max(500).optional() }))
|
|
21
21
|
.handler(async ({ input, actor, orgId }) => {
|
|
22
22
|
const body = input as { entityId: string; note?: string };
|
|
23
|
-
const result = await service.add(orgId, actor
|
|
23
|
+
const result = await service.add(orgId, requireUserId(actor), body);
|
|
24
24
|
if (!result.ok) throw new Error(result.error);
|
|
25
25
|
return result.value;
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
r.delete("/{id}").summary("Remove from wishlist").auth()
|
|
29
29
|
.handler(async ({ params, actor, orgId }) => {
|
|
30
|
-
const result = await service.remove(orgId, actor
|
|
30
|
+
const result = await service.remove(orgId, requireUserId(actor), params.id!);
|
|
31
31
|
if (!result.ok) throw new Error(result.error);
|
|
32
32
|
return result.value;
|
|
33
33
|
});
|