Skip to content

Commit

Permalink
refactor: Refactor in AdminPermissionGuards
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreSoftwareDeveloper committed Jun 17, 2024
1 parent 1102538 commit 691f8b6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions backend/src/utils/guards/admin-permission.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DatabaseService } from "@/database/database.service";
import { eq } from "drizzle-orm";
import { core_users } from "@/plugins/core/admin/database/schema/users";
import { Reflector } from "@nestjs/core";
import { Ctx } from "../types/context.type";
import { Ctx } from "@vitnode/backend";

@Injectable()
export class AdminPermissionGuards implements CanActivate {
Expand Down Expand Up @@ -34,8 +34,7 @@ export class AdminPermissionGuards implements CanActivate {
context.getHandler()
);

const { req } = ctx.getContext();
const userId = req.user.id;
const userId = ctx.getContext().user.id;
const user = await this.databaseService.db.query.core_users.findFirst({
where: eq(core_users.id, userId)
});
Expand Down

0 comments on commit 691f8b6

Please sign in to comment.