Project Initialization

This commit is contained in:
Muluhabt
2026-05-12 15:17:16 +03:00
parent 33fa742e8a
commit 3b8b6979db
259 changed files with 15962 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
// TODO: integrate @edr/auth — this decorator currently returns whatever was
// attached to request.user by the (not-yet-wired) auth middleware. Once the
// auth package is integrated, replace this with the real user type.
export const CurrentUser = createParamDecorator(
(_data: unknown, ctx: ExecutionContext) => {
const request = ctx.switchToHttp().getRequest();
return request.user ?? null;
},
);

View File

@@ -0,0 +1,8 @@
import { SetMetadata } from '@nestjs/common';
export const IS_PUBLIC_KEY = 'isPublic';
// TODO: integrate @edr/auth — pair with the JwtAuthGuard from the auth package
// so it skips authentication for routes marked @Public(). Until then, this is
// just metadata.
export const Public = () => SetMetadata(IS_PUBLIC_KEY, true);

View File

@@ -0,0 +1,8 @@
import { SetMetadata } from '@nestjs/common';
export const ROLES_KEY = 'roles';
// TODO: integrate @edr/auth — pair this metadata with a RolesGuard from the
// auth package. Until then, this decorator only sets metadata and has no
// runtime effect.
export const Roles = (...roles: string[]) => SetMetadata(ROLES_KEY, roles);