refactor: project service boundaries

This commit is contained in:
Carlos Valente
2024-06-24 14:09:25 +02:00
committed by Carlos Valente
parent 20d9df2501
commit ad69c0ff80
9 changed files with 168 additions and 144 deletions
@@ -5,9 +5,10 @@ import { Request, Response } from 'express';
import { DataProvider } from '../../classes/data-provider/DataProvider.js';
import { failEmptyObjects } from '../../utils/routerUtils.js';
import { extractPin } from '../../services/project-service/ProjectService.js';
import { isDocker } from '../../setup/index.js';
import { extractPin } from './settings.utils.js';
export async function getSettings(_req: Request, res: Response<Settings>) {
const settings = DataProvider.getSettings();
const obfuscatedSettings = { ...settings };
@@ -0,0 +1,15 @@
/**
* Business logic for resolving a string
*/
export function extractPin(value: string | undefined | null, fallback: string | null): string | null {
if (value === null) {
return value;
}
if (typeof value === 'undefined') {
return fallback;
}
if (value.length === 0) {
return null;
}
return value;
}