chore: add some
This commit is contained in:
@@ -313,6 +313,7 @@ export const enum InvoiceMessage {
|
||||
USER_ID_SHOULD_BE_A_UUID = "شناسه کاربر باید یک UUID معتبر باشد",
|
||||
CREATED = "فاکتور با موفقیت ایجاد شد",
|
||||
SEARCH_QUERY_MUST_BE_A_STRING = "رشته جستجو باید یک رشته باشد",
|
||||
NOT_FOUND_BY_ID = "فاکتوری با این شناسه یافت نشد",
|
||||
}
|
||||
|
||||
export const enum LearningMessage {
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
// eslint-disable-next-line import/no-named-as-default
|
||||
import Decimal from "decimal.js";
|
||||
import { ValueTransformer } from "typeorm";
|
||||
|
||||
export class DecimalTransformer {
|
||||
to(value: Decimal | string | number): string {
|
||||
return new Decimal(value).toString();
|
||||
export class DecimalTransformer implements ValueTransformer {
|
||||
// to(value: Decimal | string | number): string {
|
||||
// return new Decimal(value).toString();
|
||||
// }
|
||||
|
||||
// from(value: string): number {
|
||||
// return new Decimal(value).toNumber();
|
||||
// }
|
||||
|
||||
to(value: Decimal | null): string | null {
|
||||
return value ? value.toString() : "0"; // Ensure it's always a valid number
|
||||
}
|
||||
|
||||
from(value: string): number {
|
||||
return new Decimal(value).toNumber();
|
||||
from(value: string | null): number {
|
||||
return value ? new Decimal(value).toNumber() : new Decimal(0).toNumber(); // Default to 0 if null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user