|
|
@@ -2,6 +2,7 @@ import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
|
import { z } from 'zod';
|
|
|
import { AppDataSource } from '@d8d/shared-utils';
|
|
|
import { authMiddleware } from '@d8d/auth-module';
|
|
|
+import { AuthContext } from '@d8d/shared-types';
|
|
|
import { PaymentService } from '../../services/payment.service.js';
|
|
|
import { PaymentCreateRequestSchema, PaymentCreateResponseSchema } from '../../schemas/payment.schema.js';
|
|
|
|
|
|
@@ -9,6 +10,7 @@ import { PaymentCreateRequestSchema, PaymentCreateResponseSchema } from '../../s
|
|
|
const createPaymentRoute = createRoute({
|
|
|
method: 'post',
|
|
|
path: '/',
|
|
|
+ middleware: [authMiddleware],
|
|
|
request: {
|
|
|
body: {
|
|
|
content: {
|
|
|
@@ -36,8 +38,7 @@ const createPaymentRoute = createRoute({
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-const app = new OpenAPIHono()
|
|
|
- .use(authMiddleware)
|
|
|
+const app = new OpenAPIHono<AuthContext>()
|
|
|
.openapi(createPaymentRoute, async (c) => {
|
|
|
try {
|
|
|
const paymentData = c.req.valid('json');
|