feat: refactor folder structure (#4498)

* feat: wip refactor folder structure

* Fix

* fix position

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jérémy M
2024-03-15 14:40:58 +01:00
committed by GitHub
parent 52f1b3ac98
commit 94487f6737
760 changed files with 3215 additions and 3155 deletions
@@ -0,0 +1,25 @@
import { BadRequestException } from '@nestjs/common';
import { Request } from 'express';
const ALLOWED_DEPTH_VALUES = [1, 2];
export const computeDepth = (request: Request): number | undefined => {
if (!request.query.depth) {
return undefined;
}
const depth = +request.query.depth;
if (isNaN(depth) || !ALLOWED_DEPTH_VALUES.includes(depth)) {
throw new BadRequestException(
`'depth=${
request.query.depth
}' parameter invalid. Allowed values are ${ALLOWED_DEPTH_VALUES.join(
', ',
)}`,
);
}
return depth;
};