update : condition on Get method
This commit is contained in:
parent
4453cc49d7
commit
e7cf3e881f
|
|
@ -9,7 +9,7 @@ import { rolesToUsers } from "../../drizzle/schema/rolesToUsers";
|
|||
import { rolesSchema } from "../../drizzle/schema/roles";
|
||||
import HonoEnv from "../../types/HonoEnv";
|
||||
import authInfo from "../../middlewares/authInfo";
|
||||
import { notFound } from "../../errors/DashboardError";
|
||||
import { forbidden, notFound } from "../../errors/DashboardError";
|
||||
import checkPermission from "../../middlewares/checkPermission";
|
||||
import requestValidator from "../../utils/requestValidator";
|
||||
import { HTTPException } from "hono/http-exception";
|
||||
|
|
@ -33,11 +33,12 @@ const assessmentRequestRoute = new Hono<HonoEnv>()
|
|||
async (c) => {
|
||||
const currentUser = c.get("currentUser");
|
||||
const userId = currentUser?.id; // Mengambil userId dari currentUser yang disimpan di context
|
||||
if (!userId) {
|
||||
// Handle case where userId is undefined
|
||||
return c.text("User not authenticated", 401);
|
||||
}
|
||||
|
||||
if (!userId) {
|
||||
throw forbidden({
|
||||
message: "User not authenticated"
|
||||
});
|
||||
}
|
||||
const { page, limit, q } = c.req.valid("query");
|
||||
|
||||
// Query untuk menghitung total data
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user