@shophost/rest-api 2.0.26 → 2.0.28
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/README.md +3 -3
- package/package.json +1 -1
- package/prisma.config.ts +1 -1
- package/scripts/shophost-rest-api.mjs +6 -9
- package/src/app.js +2 -1
- package/src/app.js.map +1 -1
- package/src/core/lib/prisma.d.ts +26 -26
- package/src/features/access/access.handler.d.ts +2 -0
- package/src/features/access/access.handler.js +83 -0
- package/src/features/access/access.handler.js.map +1 -0
- package/src/features/access/access.route.d.ts +11 -0
- package/src/features/access/access.route.js +203 -0
- package/src/features/access/access.route.js.map +1 -0
- package/src/features/access/access.schema.d.ts +47 -0
- package/src/features/access/access.schema.js +108 -0
- package/src/features/access/access.schema.js.map +1 -0
- package/src/features/access/access.service.d.ts +111 -0
- package/src/features/access/access.service.js +273 -0
- package/src/features/access/access.service.js.map +1 -0
- package/src/features/cart/cart.schema.d.ts +3 -3
- package/src/features/cart/cart.service.d.ts +2 -2
- package/src/features/index.d.ts +1 -0
- package/src/features/index.js +1 -0
- package/src/features/index.js.map +1 -1
- package/src/features/order/recipient.schema.d.ts +2 -2
- package/src/features/organization/organization.schema.d.ts +2 -2
- package/src/features/product/product-modifier.schema.d.ts +1 -1
- package/src/features/product/product.schema.d.ts +3 -3
- package/src/features/product/product.service.d.ts +4 -4
- package/src/features/product-category/product-category.schema.d.ts +14 -14
- package/src/features/product-category/product-category.service.d.ts +2 -2
- package/src/schemas/index.d.ts +1 -0
- package/src/schemas/index.js +1 -0
- package/src/schemas/index.js.map +1 -1
- package/src/test/integration/test-helpers.d.ts +41 -41
- package/src/test/integration/test-helpers.js +2 -2
- package/src/test/integration/test-helpers.js.map +1 -1
- package/src/test/setup-test-env.js +3 -3
- package/src/test/setup-test-env.js.map +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ The published package includes a CLI so a fresh project can push the packaged Pr
|
|
|
51
51
|
- `.env`
|
|
52
52
|
- the shell environment
|
|
53
53
|
2. Use one of these variables:
|
|
54
|
-
- `
|
|
54
|
+
- `DATABASE_URL`
|
|
55
55
|
- `DATABASE_URL`
|
|
56
56
|
3. Run:
|
|
57
57
|
|
|
@@ -65,7 +65,7 @@ Example:
|
|
|
65
65
|
|
|
66
66
|
```env
|
|
67
67
|
# .env.local
|
|
68
|
-
|
|
68
|
+
DATABASE_URL=postgresql://user:password@host:5432/dbname?sslmode=require
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
You can pass regular Prisma `db push` flags through as well:
|
|
@@ -78,7 +78,7 @@ pnpm exec shophost-rest-api db push --url "postgresql://user:password@host:5432/
|
|
|
78
78
|
Notes:
|
|
79
79
|
|
|
80
80
|
- `.env.local` overrides `.env`
|
|
81
|
-
- `
|
|
81
|
+
- `DATABASE_URL` takes precedence over `DATABASE_URL`
|
|
82
82
|
- the CLI uses the `schema.prisma` and `prisma.config.ts` shipped inside `@shophost/rest-api`
|
|
83
83
|
|
|
84
84
|
## Development
|
package/package.json
CHANGED
package/prisma.config.ts
CHANGED
|
@@ -15,7 +15,7 @@ function firstDefined(...names: string[]) {
|
|
|
15
15
|
|
|
16
16
|
export default defineConfig({
|
|
17
17
|
datasource: {
|
|
18
|
-
url: firstDefined("
|
|
18
|
+
url: firstDefined("DATABASE_URL", "DATABASE_URL"),
|
|
19
19
|
shadowDatabaseUrl: firstDefined(
|
|
20
20
|
"POSTGRES_URL_NON_POOLING",
|
|
21
21
|
"DIRECT_DATABASE_URL"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import dotenv from "dotenv";
|
|
2
3
|
|
|
3
4
|
import { spawn } from "node:child_process";
|
|
4
5
|
import { existsSync } from "node:fs";
|
|
5
6
|
import { createRequire } from "node:module";
|
|
6
7
|
import { dirname, join } from "node:path";
|
|
7
8
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
import dotenv from "dotenv";
|
|
9
9
|
|
|
10
10
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
11
|
const packageRoot = join(__dirname, "..");
|
|
@@ -30,7 +30,7 @@ Environment:
|
|
|
30
30
|
.env.local
|
|
31
31
|
.env
|
|
32
32
|
DATABASE_URL
|
|
33
|
-
|
|
33
|
+
DATABASE_URL
|
|
34
34
|
`);
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -38,9 +38,7 @@ function getPrismaCliPath() {
|
|
|
38
38
|
try {
|
|
39
39
|
return require.resolve("prisma/build/index.js");
|
|
40
40
|
} catch (error) {
|
|
41
|
-
console.error(
|
|
42
|
-
"Could not resolve the Prisma CLI from @shophost/rest-api."
|
|
43
|
-
);
|
|
41
|
+
console.error("Could not resolve the Prisma CLI from @shophost/rest-api.");
|
|
44
42
|
console.error(
|
|
45
43
|
"Reinstall dependencies and make sure the package was installed correctly."
|
|
46
44
|
);
|
|
@@ -127,8 +125,7 @@ const reservedFlag = dbPushArgs.find(
|
|
|
127
125
|
RESERVED_FLAGS.includes(arg) ||
|
|
128
126
|
RESERVED_FLAGS.some((flag) => arg.startsWith(`${flag}=`))
|
|
129
127
|
);
|
|
130
|
-
const isDbPushHelp =
|
|
131
|
-
dbPushArgs.includes("--help") || dbPushArgs.includes("-h");
|
|
128
|
+
const isDbPushHelp = dbPushArgs.includes("--help") || dbPushArgs.includes("-h");
|
|
132
129
|
|
|
133
130
|
if (reservedFlag) {
|
|
134
131
|
console.error(
|
|
@@ -160,10 +157,10 @@ if (
|
|
|
160
157
|
!isDbPushHelp &&
|
|
161
158
|
!hasUrlOverride &&
|
|
162
159
|
!process.env.DATABASE_URL &&
|
|
163
|
-
!process.env.
|
|
160
|
+
!process.env.DATABASE_URL
|
|
164
161
|
) {
|
|
165
162
|
console.error(
|
|
166
|
-
"Set DATABASE_URL or
|
|
163
|
+
"Set DATABASE_URL or DATABASE_URL, or add it to `.env.local` / `.env`, before running `shophost-rest-api db push`."
|
|
167
164
|
);
|
|
168
165
|
process.exit(1);
|
|
169
166
|
}
|
package/src/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { cors } from "hono/cors";
|
|
3
3
|
import { createApiRouter, createUnavailableAuth, handleAppError, } from "./core/hono/hono";
|
|
4
|
-
import { buildCartHandler, buildFileHandler, buildHealthHandler, buildLocationHandler, buildManufacturerHandler, buildOrderHandler, buildOrganizationHandler, buildPaymentHandler, buildProductCategoryHandler, buildProductHandler, buildReservationHandler, buildShippingHandler, buildShippingMethodHandler, buildWebhookHandler, } from "./features";
|
|
4
|
+
import { buildAccessHandler, buildCartHandler, buildFileHandler, buildHealthHandler, buildLocationHandler, buildManufacturerHandler, buildOrderHandler, buildOrganizationHandler, buildPaymentHandler, buildProductCategoryHandler, buildProductHandler, buildReservationHandler, buildShippingHandler, buildShippingMethodHandler, buildWebhookHandler, } from "./features";
|
|
5
5
|
const defaultCorsOptions = {
|
|
6
6
|
allowHeaders: [
|
|
7
7
|
"Content-Type",
|
|
@@ -37,6 +37,7 @@ export const buildApiApp = ({ corsOptions, maps, payment, prisma, resolveAuth =
|
|
|
37
37
|
app.route("/", buildFileHandler(prisma));
|
|
38
38
|
app.route("/", buildProductCategoryHandler(prisma));
|
|
39
39
|
app.route("/", buildProductHandler(prisma));
|
|
40
|
+
app.route("/", buildAccessHandler(prisma));
|
|
40
41
|
app.route("/", buildShippingMethodHandler(prisma));
|
|
41
42
|
app.route("/", buildOrderHandler(prisma, payment !== null && payment !== void 0 ? payment : {}));
|
|
42
43
|
app.route("/", buildCartHandler(prisma));
|
package/src/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../packages/rest-api/src/app.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAEL,eAAe,EACf,qBAAqB,EACrB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL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B,CAAC,MAAM,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC,CAAC;IAE3D,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,YAAY,EAAE,CAAC;QAClC,GAAG,CAAC,KAAK,CACP,GAAG,EACH,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAC7D,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
package/src/core/lib/prisma.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
18
18
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
user: {
|
|
22
22
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
23
23
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
24
24
|
limit?: P["limit"] | undefined;
|
|
@@ -30,7 +30,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
30
30
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
member: {
|
|
34
34
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
35
35
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
36
36
|
limit?: P["limit"] | undefined;
|
|
@@ -42,7 +42,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
42
42
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
organization: {
|
|
46
46
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
47
47
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
48
48
|
limit?: P["limit"] | undefined;
|
|
@@ -54,7 +54,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
54
54
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
file: {
|
|
58
58
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
59
59
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
60
60
|
limit?: P["limit"] | undefined;
|
|
@@ -66,7 +66,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
66
66
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
payment: {
|
|
70
70
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
71
71
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
72
72
|
limit?: P["limit"] | undefined;
|
|
@@ -78,7 +78,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
78
78
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
shippingMethod: {
|
|
82
82
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
83
83
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
84
84
|
limit?: P["limit"] | undefined;
|
|
@@ -90,7 +90,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
90
90
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
openingTimes: {
|
|
94
94
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
95
95
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
96
96
|
limit?: P["limit"] | undefined;
|
|
@@ -102,7 +102,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
102
102
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
-
|
|
105
|
+
closingTimes: {
|
|
106
106
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
107
107
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
108
108
|
limit?: P["limit"] | undefined;
|
|
@@ -114,7 +114,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
114
114
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
115
115
|
};
|
|
116
116
|
};
|
|
117
|
-
|
|
117
|
+
address: {
|
|
118
118
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
119
119
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
120
120
|
limit?: P["limit"] | undefined;
|
|
@@ -126,7 +126,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
126
126
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
|
-
|
|
129
|
+
session: {
|
|
130
130
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
131
131
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
132
132
|
limit?: P["limit"] | undefined;
|
|
@@ -138,7 +138,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
138
138
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
|
-
|
|
141
|
+
account: {
|
|
142
142
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
143
143
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
144
144
|
limit?: P["limit"] | undefined;
|
|
@@ -150,7 +150,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
150
150
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
151
151
|
};
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
verification: {
|
|
154
154
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
155
155
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
156
156
|
limit?: P["limit"] | undefined;
|
|
@@ -162,7 +162,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
162
162
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
|
-
|
|
165
|
+
invitation: {
|
|
166
166
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
167
167
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
168
168
|
limit?: P["limit"] | undefined;
|
|
@@ -420,7 +420,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
420
420
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
421
421
|
};
|
|
422
422
|
};
|
|
423
|
-
|
|
423
|
+
user: {
|
|
424
424
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
425
425
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
426
426
|
limit?: P["limit"] | undefined;
|
|
@@ -432,7 +432,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
432
432
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
433
433
|
};
|
|
434
434
|
};
|
|
435
|
-
|
|
435
|
+
member: {
|
|
436
436
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
437
437
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
438
438
|
limit?: P["limit"] | undefined;
|
|
@@ -444,7 +444,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
444
444
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
445
445
|
};
|
|
446
446
|
};
|
|
447
|
-
|
|
447
|
+
organization: {
|
|
448
448
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
449
449
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
450
450
|
limit?: P["limit"] | undefined;
|
|
@@ -456,7 +456,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
456
456
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
457
457
|
};
|
|
458
458
|
};
|
|
459
|
-
|
|
459
|
+
file: {
|
|
460
460
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
461
461
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
462
462
|
limit?: P["limit"] | undefined;
|
|
@@ -468,7 +468,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
468
468
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
469
469
|
};
|
|
470
470
|
};
|
|
471
|
-
|
|
471
|
+
payment: {
|
|
472
472
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
473
473
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
474
474
|
limit?: P["limit"] | undefined;
|
|
@@ -480,7 +480,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
480
480
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
481
481
|
};
|
|
482
482
|
};
|
|
483
|
-
|
|
483
|
+
shippingMethod: {
|
|
484
484
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
485
485
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
486
486
|
limit?: P["limit"] | undefined;
|
|
@@ -492,7 +492,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
492
492
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
493
493
|
};
|
|
494
494
|
};
|
|
495
|
-
|
|
495
|
+
openingTimes: {
|
|
496
496
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
497
497
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
498
498
|
limit?: P["limit"] | undefined;
|
|
@@ -504,7 +504,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
504
504
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
505
505
|
};
|
|
506
506
|
};
|
|
507
|
-
|
|
507
|
+
closingTimes: {
|
|
508
508
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
509
509
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
510
510
|
limit?: P["limit"] | undefined;
|
|
@@ -516,7 +516,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
516
516
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
517
517
|
};
|
|
518
518
|
};
|
|
519
|
-
|
|
519
|
+
address: {
|
|
520
520
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
521
521
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
522
522
|
limit?: P["limit"] | undefined;
|
|
@@ -528,7 +528,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
528
528
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
529
529
|
};
|
|
530
530
|
};
|
|
531
|
-
|
|
531
|
+
session: {
|
|
532
532
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
533
533
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
534
534
|
limit?: P["limit"] | undefined;
|
|
@@ -540,7 +540,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
540
540
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
541
541
|
};
|
|
542
542
|
};
|
|
543
|
-
|
|
543
|
+
account: {
|
|
544
544
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
545
545
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
546
546
|
limit?: P["limit"] | undefined;
|
|
@@ -552,7 +552,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
552
552
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
553
553
|
};
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
verification: {
|
|
556
556
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
557
557
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
558
558
|
limit?: P["limit"] | undefined;
|
|
@@ -564,7 +564,7 @@ export declare const createPrismaClient: (options: CreatePrismaClientOptions) =>
|
|
|
564
564
|
}) => Promise<[import("@prisma/client/runtime/client").Result<T, A, "findMany">, import("prisma-extension-pagination").CursorPaginationMeta]>;
|
|
565
565
|
};
|
|
566
566
|
};
|
|
567
|
-
|
|
567
|
+
invitation: {
|
|
568
568
|
paginate: () => <T, A>(this: T, args?: import("@prisma/client/runtime/client").Exact<A, Omit<import("@prisma/client/runtime/client").Args<T, "findMany">, "cursor" | "take" | "skip">> | undefined) => {
|
|
569
569
|
withPages: <TOptions extends Omit<P, "limit">, P extends import("prisma-extension-pagination").PageNumberPaginationOptions>(options?: (TOptions & {
|
|
570
570
|
limit?: P["limit"] | undefined;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { createApiRouter } from "../../core/hono/hono";
|
|
3
|
+
import { accessRoute } from "./access.route";
|
|
4
|
+
import { AccessService } from "./access.service";
|
|
5
|
+
export const buildAccessHandler = (prisma) => {
|
|
6
|
+
const app = createApiRouter();
|
|
7
|
+
app.openapi(accessRoute.getMembers, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const auth = c.get("auth");
|
|
9
|
+
const params = c.req.valid("param");
|
|
10
|
+
const query = c.req.valid("query");
|
|
11
|
+
yield auth.isGranted("read");
|
|
12
|
+
const service = new AccessService(prisma);
|
|
13
|
+
const result = yield service.getMembers(params.organizationId, Object.assign({}, query));
|
|
14
|
+
return c.json(result, 200);
|
|
15
|
+
}));
|
|
16
|
+
app.openapi(accessRoute.getMember, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const auth = c.get("auth");
|
|
18
|
+
const params = c.req.valid("param");
|
|
19
|
+
yield auth.isGranted("read");
|
|
20
|
+
const service = new AccessService(prisma);
|
|
21
|
+
const member = yield service.getMember(params.organizationId, params.memberId);
|
|
22
|
+
return c.json(member, 200);
|
|
23
|
+
}));
|
|
24
|
+
app.openapi(accessRoute.updateMemberRole, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const auth = c.get("auth");
|
|
26
|
+
const params = c.req.valid("param");
|
|
27
|
+
const body = c.req.valid("json");
|
|
28
|
+
const user = yield auth.isGranted("update");
|
|
29
|
+
const service = new AccessService(prisma);
|
|
30
|
+
const updated = yield service.updateMemberRole(params.organizationId, params.memberId, user.id, body);
|
|
31
|
+
return c.json(updated, 200);
|
|
32
|
+
}));
|
|
33
|
+
app.openapi(accessRoute.deleteMember, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
const auth = c.get("auth");
|
|
35
|
+
const params = c.req.valid("param");
|
|
36
|
+
const user = yield auth.isGranted("delete");
|
|
37
|
+
const service = new AccessService(prisma);
|
|
38
|
+
yield service.deleteMember(params.organizationId, params.memberId, user.id);
|
|
39
|
+
return c.body(null, 204);
|
|
40
|
+
}));
|
|
41
|
+
app.openapi(accessRoute.createInvitation, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
const auth = c.get("auth");
|
|
43
|
+
const params = c.req.valid("param");
|
|
44
|
+
const body = c.req.valid("json");
|
|
45
|
+
const user = yield auth.isGranted("create");
|
|
46
|
+
const service = new AccessService(prisma);
|
|
47
|
+
const invitation = yield service.createInvitation(params.organizationId, user.id, body);
|
|
48
|
+
return c.json(invitation, 201);
|
|
49
|
+
}));
|
|
50
|
+
app.openapi(accessRoute.getInvitations, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const auth = c.get("auth");
|
|
52
|
+
const params = c.req.valid("param");
|
|
53
|
+
yield auth.isGranted("read");
|
|
54
|
+
const service = new AccessService(prisma);
|
|
55
|
+
const invitations = yield service.getInvitations(params.organizationId);
|
|
56
|
+
return c.json(invitations, 200);
|
|
57
|
+
}));
|
|
58
|
+
app.openapi(accessRoute.deleteInvitation, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
const auth = c.get("auth");
|
|
60
|
+
const params = c.req.valid("param");
|
|
61
|
+
yield auth.isGranted("delete");
|
|
62
|
+
const service = new AccessService(prisma);
|
|
63
|
+
yield service.deleteInvitation(params.organizationId, params.invitationId);
|
|
64
|
+
return c.body(null, 204);
|
|
65
|
+
}));
|
|
66
|
+
app.openapi(accessRoute.getUserInvitations, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
const auth = c.get("auth");
|
|
68
|
+
const user = yield auth.getCurrentUser();
|
|
69
|
+
const service = new AccessService(prisma);
|
|
70
|
+
const invitations = yield service.getUserInvitations(user.email);
|
|
71
|
+
return c.json(invitations, 200);
|
|
72
|
+
}));
|
|
73
|
+
app.openapi(accessRoute.acceptInvitation, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
const auth = c.get("auth");
|
|
75
|
+
const params = c.req.valid("param");
|
|
76
|
+
const user = yield auth.getCurrentUser();
|
|
77
|
+
const service = new AccessService(prisma);
|
|
78
|
+
const member = yield service.acceptInvitation(params.invitationId, user.id);
|
|
79
|
+
return c.json(member, 200);
|
|
80
|
+
}));
|
|
81
|
+
return app;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=access.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.handler.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/features/access/access.handler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAwB,EAAE,EAAE;IAC7D,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;IAE9B,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,CAAO,CAAM,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEnC,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAE7B,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,oBACxD,KAAK,EACR,CAAC;QAEH,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC,CAAA,CAAC,CAAC;IAEH,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,CAAO,CAAM,EAAE,EAAE;QAClD,MAAM,IAAI,GAAG,CA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