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