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