|
1 | 1 | import { bagSchema } from "discit-types"; |
2 | 2 |
|
3 | | -import { assertRequestIsAuthorized, authHeaderSchema, resMessageSchema } from "@helpers"; |
| 3 | +import { assertIsRequestAuthorized, authHeaderSchema, resMessageSchema } from "@helpers"; |
4 | 4 | import { type OpenAPIHono, createRoute, z } from "@hono/zod-openapi"; |
5 | 5 | import { Bag } from "@models"; |
6 | 6 |
|
@@ -31,7 +31,7 @@ export const initBagRoutes = (app: OpenAPIHono) => { |
31 | 31 | }), |
32 | 32 | async c => { |
33 | 33 | const { authorization } = c.req.valid("header"); |
34 | | - assertRequestIsAuthorized(authorization); |
| 34 | + assertIsRequestAuthorized(authorization); |
35 | 35 | const { user_id } = c.req.valid("query"); |
36 | 36 | const bags = await Bag.getBags(user_id); |
37 | 37 | return c.json(bags, 200); |
@@ -68,7 +68,7 @@ export const initBagRoutes = (app: OpenAPIHono) => { |
68 | 68 | }), |
69 | 69 | async c => { |
70 | 70 | const { authorization } = c.req.valid("header"); |
71 | | - assertRequestIsAuthorized(authorization); |
| 71 | + assertIsRequestAuthorized(authorization); |
72 | 72 | const { id } = c.req.valid("param"); |
73 | 73 | const bag = await Bag.assertBagExists(id); |
74 | 74 | return c.json(bag, 200); |
@@ -112,7 +112,7 @@ export const initBagRoutes = (app: OpenAPIHono) => { |
112 | 112 | }), |
113 | 113 | async c => { |
114 | 114 | const { authorization } = c.req.valid("header"); |
115 | | - assertRequestIsAuthorized(authorization); |
| 115 | + assertIsRequestAuthorized(authorization); |
116 | 116 | const { user_id, name } = c.req.valid("json"); |
117 | 117 | const bag = await Bag.createBag(user_id, name); |
118 | 118 | return c.json(bag, 201); |
@@ -160,7 +160,7 @@ export const initBagRoutes = (app: OpenAPIHono) => { |
160 | 160 | }), |
161 | 161 | async c => { |
162 | 162 | const { authorization } = c.req.valid("header"); |
163 | | - assertRequestIsAuthorized(authorization); |
| 163 | + assertIsRequestAuthorized(authorization); |
164 | 164 | const { id, disc_id } = c.req.valid("json"); |
165 | 165 | const bag = await Bag.addDiscToBag(id, disc_id); |
166 | 166 | return c.json(bag, 200); |
@@ -208,7 +208,7 @@ export const initBagRoutes = (app: OpenAPIHono) => { |
208 | 208 | }), |
209 | 209 | async c => { |
210 | 210 | const { authorization } = c.req.valid("header"); |
211 | | - assertRequestIsAuthorized(authorization); |
| 211 | + assertIsRequestAuthorized(authorization); |
212 | 212 | const { id, disc_id } = c.req.valid("json"); |
213 | 213 | const bag = await Bag.removeDiscFromBag(id, disc_id); |
214 | 214 | return c.json(bag, 200); |
@@ -256,7 +256,7 @@ export const initBagRoutes = (app: OpenAPIHono) => { |
256 | 256 | }), |
257 | 257 | async c => { |
258 | 258 | const { authorization } = c.req.valid("header"); |
259 | | - assertRequestIsAuthorized(authorization); |
| 259 | + assertIsRequestAuthorized(authorization); |
260 | 260 | const { id, name } = c.req.valid("json"); |
261 | 261 | const bag = await Bag.updateBagName(id, name); |
262 | 262 | return c.json(bag, 200); |
@@ -293,7 +293,7 @@ export const initBagRoutes = (app: OpenAPIHono) => { |
293 | 293 | }), |
294 | 294 | async c => { |
295 | 295 | const { authorization } = c.req.valid("header"); |
296 | | - assertRequestIsAuthorized(authorization); |
| 296 | + assertIsRequestAuthorized(authorization); |
297 | 297 | const { id } = c.req.valid("param"); |
298 | 298 | const bag = await Bag.deleteBag(id); |
299 | 299 | return c.json(bag, 200); |
|
0 commit comments