14 lines
454 B
TypeScript
14 lines
454 B
TypeScript
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
|
|
import { Response } from 'express';
|
|
import { Building } from 'src/objects/building/entities/building.entity';
|
|
|
|
/**
|
|
* Get the building from the response.
|
|
*/
|
|
export const CurrentBuilding = createParamDecorator(
|
|
(data: unknown, ctx: ExecutionContext) => {
|
|
const response = ctx.switchToHttp().getResponse() as Response;
|
|
return response.locals.building as Building;
|
|
},
|
|
);
|