first commit

This commit is contained in:
Mateusz Gruszczyński
2026-04-05 13:40:27 +02:00
commit 9a6e77a5fc
89 changed files with 18276 additions and 0 deletions

4
api/src/utils/decimal.ts Normal file
View File

@@ -0,0 +1,4 @@
export const decimalTransformer = {
to: (value: number | null | undefined) => value == null ? null : value.toFixed(2),
from: (value: string | number | null | undefined) => value == null ? 0 : Number(value)
};

13
api/src/utils/http.ts Normal file
View File

@@ -0,0 +1,13 @@
import type { Proof } from '../entities/Proof.js';
export const buildProofUrl = (storedName: string | null) => storedName ? `/uploads/${storedName}` : null;
export const serializeProof = (proof: Proof) => ({
id: proof.id,
type: proof.type,
label: proof.label,
note: proof.note,
originalName: proof.originalName,
mimeType: proof.mimeType,
fileSize: proof.fileSize,
fileUrl: buildProofUrl(proof.storedName),
createdAt: proof.createdAt
});