first commit
This commit is contained in:
4
api/src/utils/decimal.ts
Normal file
4
api/src/utils/decimal.ts
Normal 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
13
api/src/utils/http.ts
Normal 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
|
||||
});
|
||||
Reference in New Issue
Block a user