Pull Request branch dev-clone to main #1

Merged
gitea merged 429 commits from dev-clone into main 2024-12-23 09:31:34 +00:00
Showing only changes of commit e7cf3e881f - Show all commits

View File

@ -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