fix: Use correct auth middleware name (requireAuth)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Router, Status } from "https://deno.land/x/oak@v12.6.1/mod.ts";
|
||||
import { query, execute, getConnection } from "../db/connection.ts";
|
||||
import { authMiddleware, AuthState } from "../middleware/auth.ts";
|
||||
import { requireAuth } from "../middleware/auth.ts";
|
||||
import type { AuthState } from "../types/index.ts";
|
||||
|
||||
const router = new Router<AuthState>();
|
||||
|
||||
@@ -44,7 +45,7 @@ function generateId(): string {
|
||||
// GET /api/v1/inbox - List inbox items for current user
|
||||
// ============================================
|
||||
|
||||
router.get("/api/v1/inbox", authMiddleware, async (ctx) => {
|
||||
router.get("/api/v1/inbox", requireAuth, async (ctx) => {
|
||||
const userId = ctx.state.user.id;
|
||||
const orgId = ctx.state.orgId;
|
||||
|
||||
@@ -176,7 +177,7 @@ router.get("/api/v1/inbox", authMiddleware, async (ctx) => {
|
||||
// GET /api/v1/inbox/stats - Get inbox statistics
|
||||
// ============================================
|
||||
|
||||
router.get("/api/v1/inbox/stats", authMiddleware, async (ctx) => {
|
||||
router.get("/api/v1/inbox/stats", requireAuth, async (ctx) => {
|
||||
const userId = ctx.state.user.id;
|
||||
const orgId = ctx.state.orgId;
|
||||
|
||||
@@ -231,7 +232,7 @@ router.get("/api/v1/inbox/stats", authMiddleware, async (ctx) => {
|
||||
// POST /api/v1/inbox - Create new inbox item
|
||||
// ============================================
|
||||
|
||||
router.post("/api/v1/inbox", authMiddleware, async (ctx) => {
|
||||
router.post("/api/v1/inbox", requireAuth, async (ctx) => {
|
||||
const body = await ctx.request.body({ type: "json" }).value;
|
||||
const creatorId = ctx.state.user.id;
|
||||
const creatorRole = ctx.state.user.role;
|
||||
@@ -355,7 +356,7 @@ router.post("/api/v1/inbox", authMiddleware, async (ctx) => {
|
||||
// PUT /api/v1/inbox/:id - Update inbox item
|
||||
// ============================================
|
||||
|
||||
router.put("/api/v1/inbox/:id", authMiddleware, async (ctx) => {
|
||||
router.put("/api/v1/inbox/:id", requireAuth, async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const userId = ctx.state.user.id;
|
||||
const orgId = ctx.state.orgId;
|
||||
@@ -455,7 +456,7 @@ router.put("/api/v1/inbox/:id", authMiddleware, async (ctx) => {
|
||||
// PUT /api/v1/inbox/:id/status - Quick status update
|
||||
// ============================================
|
||||
|
||||
router.put("/api/v1/inbox/:id/status", authMiddleware, async (ctx) => {
|
||||
router.put("/api/v1/inbox/:id/status", requireAuth, async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const userId = ctx.state.user.id;
|
||||
const orgId = ctx.state.orgId;
|
||||
@@ -494,7 +495,7 @@ router.put("/api/v1/inbox/:id/status", authMiddleware, async (ctx) => {
|
||||
// DELETE /api/v1/inbox/:id - Delete inbox item
|
||||
// ============================================
|
||||
|
||||
router.delete("/api/v1/inbox/:id", authMiddleware, async (ctx) => {
|
||||
router.delete("/api/v1/inbox/:id", requireAuth, async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const userId = ctx.state.user.id;
|
||||
const orgId = ctx.state.orgId;
|
||||
@@ -523,7 +524,7 @@ router.delete("/api/v1/inbox/:id", authMiddleware, async (ctx) => {
|
||||
// GET /api/v1/inbox/team - List inbox items for team (manager+)
|
||||
// ============================================
|
||||
|
||||
router.get("/api/v1/inbox/team", authMiddleware, async (ctx) => {
|
||||
router.get("/api/v1/inbox/team", requireAuth, async (ctx) => {
|
||||
const userRole = ctx.state.user.role;
|
||||
const orgId = ctx.state.orgId;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user