|
1 | 1 | import { createRoute, OpenAPIHono } from '@hono/zod-openapi'; |
| 2 | +import { authMiddleware } from 'src/middleware/auth.ts'; |
2 | 3 | import { z } from 'zod'; |
3 | 4 | import { DBTables } from '../../constants/db.ts'; |
4 | | -import { authorizeAdmin, authorizeOrganizer, authorizeVolunteer } from '../../middleware/createMiddleware.ts'; |
| 5 | +import { authorizeAdmin, authorizeOrganizer } from '../../middleware/createMiddleware.ts'; |
5 | 6 | import { |
6 | 7 | type DataResponse, |
7 | 8 | generateDataResponeSchema, |
@@ -76,8 +77,7 @@ publicTeamRoutes.openapi( |
76 | 77 | description: 'Successful response', |
77 | 78 | content: { 'application/json': { schema: generatePaginatedResponseSchema(z.array(TeamSchema)) } } |
78 | 79 | } |
79 | | - }, |
80 | | - middleware: [authorizeVolunteer] as const |
| 80 | + } |
81 | 81 | }), |
82 | 82 | async (context) => { |
83 | 83 | const teams = await getAllTeams(context.env.database); |
@@ -134,7 +134,7 @@ protectedTeamRoutes.openapi( |
134 | 134 | content: { 'application/json': { schema: StatusResponseSchema } } |
135 | 135 | } |
136 | 136 | }, |
137 | | - middleware: [authorizeAdmin] as const |
| 137 | + middleware: [authMiddleware, authorizeAdmin] as const |
138 | 138 | }), |
139 | 139 | async (context) => { |
140 | 140 | const { id } = context.req.valid('param'); |
@@ -177,7 +177,7 @@ protectedTeamRoutes.openapi( |
177 | 177 | content: { 'application/json': { schema: StatusResponseSchema } } |
178 | 178 | } |
179 | 179 | }, |
180 | | - middleware: [authorizeAdmin] as const |
| 180 | + middleware: [authMiddleware, authorizeAdmin] as const |
181 | 181 | }), |
182 | 182 | async (context) => { |
183 | 183 | const body = context.req.valid('json'); |
@@ -218,7 +218,7 @@ protectedTeamRoutes.openapi( |
218 | 218 | content: { 'application/json': { schema: StatusResponseSchema } } |
219 | 219 | } |
220 | 220 | }, |
221 | | - middleware: [authorizeOrganizer] as const |
| 221 | + middleware: [authMiddleware, authorizeOrganizer] as const |
222 | 222 | }), |
223 | 223 | async (context) => { |
224 | 224 | const { id } = context.req.valid('param'); |
|
0 commit comments